mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-09-13 13:00:10 +00:00

* Add basic wallet library * Add CLI * Add multisig support * Add persistence to wallet * Add tests * go mod tidy * Fix lint errors * Fix wallet send command * Always use the password as byte slice * Remove redundant empty string * Use different salt per private key * Don't sign a signed transaction * Add comment * Remove old wallet * Change directory permissions * Use NormalizeRPCServerAddress * Fix compilation errors
33 lines
910 B
Go
33 lines
910 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/kaspanet/kaspad/app/appmessage"
|
|
"github.com/kaspanet/kaspad/domain/dagconfig"
|
|
"github.com/kaspanet/kaspad/infrastructure/network/rpcclient"
|
|
"os"
|
|
)
|
|
|
|
func isUTXOSpendable(entry *appmessage.UTXOsByAddressesEntry, virtualSelectedParentBlueScore uint64, coinbaseMaturity uint64) bool {
|
|
if !entry.UTXOEntry.IsCoinbase {
|
|
return true
|
|
}
|
|
blockBlueScore := entry.UTXOEntry.BlockDAAScore
|
|
// TODO: Check for a better alternative than virtualSelectedParentBlueScore
|
|
return blockBlueScore+coinbaseMaturity < virtualSelectedParentBlueScore
|
|
}
|
|
|
|
func printErrorAndExit(err error) {
|
|
fmt.Fprintf(os.Stderr, "%s\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
func connectToRPC(params *dagconfig.Params, rpcServer string) (*rpcclient.RPCClient, error) {
|
|
rpcAddress, err := params.NormalizeRPCServerAddress(rpcServer)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return rpcclient.NewRPCClient(rpcAddress)
|
|
}
|