Documentation ¶
Index ¶
- Constants
- func ConvertHandlers(handlers *coinharness.NotificationHandlers) *rpcclient.NotificationHandlers
- func CreateBlock(prevBlock *dcrutil.Block, inclusionTxs []*dcrutil.Tx, blockVersion int32, ...) (*dcrutil.Block, error)
- func GenerateAndSubmitBlock(client coinharness.RPCClient, args *GenerateBlockArgs) (*dcrutil.Block, error)
- func GenerateAndSubmitBlockWithCustomCoinbaseOutputs(client coinharness.RPCClient, args *GenerateBlockArgs) (*dcrutil.Block, error)
- func IsCoinBaseTx(tx *coinharness.MessageTx) bool
- func NetworkFor(net coinharness.Network) string
- func NewRPCClient(config *rpcclient.ConnConfig, handlers *rpcclient.NotificationHandlers) (coinharness.RPCClient, error)
- func NewTestSeed(salt uint32) coinharness.Seed
- func NewTxFromBytes(txBytes []byte) (*coinharness.Tx, error)
- func PayToAddrScript(addr coinharness.Address) ([]byte, error)
- func PrivateKeyKeyToAddr(key coinharness.PrivateKey, net coinharness.Network) (coinharness.Address, error)
- func ReadBlockHeader(header []byte) coinharness.BlockHeader
- func TransactionRawToTx(wireTx *wire.MsgTx) *coinharness.MessageTx
- func TransactionTxToRaw(chTx *coinharness.MessageTx) *wire.MsgTx
- func TxSerializeSize(msg *coinharness.MessageTx) int
- type Address
- type BlockHeader
- type ConsoleCommandCook
- type ConsoleNodeFactory
- type ConsoleWalletFactory
- type ExtendedKey
- type GenerateBlockArgs
- type InMemoryWalletFactory
- type Network
- type PrivateKey
- type PublicKey
- type RPCClient
- func (c *RPCClient) AddNode(args *coinharness.AddNodeArguments) error
- func (c *RPCClient) CreateNewAccount(account string) error
- func (c *RPCClient) Disconnect()
- func (c *RPCClient) Generate(blocks uint32) (result []coinharness.Hash, e error)
- func (c *RPCClient) GetBalance() (*coinharness.GetBalanceResult, error)
- func (c *RPCClient) GetBestBlock() (coinharness.Hash, int64, error)
- func (c *RPCClient) GetBlock(hash coinharness.Hash) (*coinharness.MsgBlock, error)
- func (c *RPCClient) GetBlockCount() (int64, error)
- func (c *RPCClient) GetBuildVersion() (coinharness.BuildVersion, error)
- func (c *RPCClient) GetNewAddress(account string) (coinharness.Address, error)
- func (c *RPCClient) GetPeerInfo() ([]coinharness.PeerInfo, error)
- func (c *RPCClient) GetRawMempool(command interface{}) (result []coinharness.Hash, e error)
- func (c *RPCClient) Internal() interface{}
- func (c *RPCClient) ListAccounts() (map[string]coin.Amount, error)
- func (c *RPCClient) ListUnspent() ([]*coinharness.Unspent, error)
- func (c *RPCClient) LoadTxFilter(reload bool, addr []coinharness.Address) error
- func (c *RPCClient) NotifyBlocks() error
- func (c *RPCClient) SendRawTransaction(tx *coinharness.MessageTx, allowHighFees bool) (result coinharness.Hash, e error)
- func (c *RPCClient) Shutdown()
- func (c *RPCClient) SubmitBlock(block coinharness.Block) error
- func (c *RPCClient) ValidateAddress(address coinharness.Address) (*coinharness.ValidateAddressResult, error)
- func (c *RPCClient) WalletInfo() (*coinharness.WalletInfoResult, error)
- func (c *RPCClient) WalletLock() error
- func (c *RPCClient) WalletUnlock(passphrase string, timeoutSecs int64) error
- type RPCClientFactory
- type WalletConsoleCommandCook
Constants ¶
const TxTreeRegular int8 = 0
TxTreeRegular is the value for a normal transaction tree for a transaction's location in a block.
Variables ¶
This section is empty.
Functions ¶
func ConvertHandlers ¶
func ConvertHandlers(handlers *coinharness.NotificationHandlers) *rpcclient.NotificationHandlers
func CreateBlock ¶
func CreateBlock(prevBlock *dcrutil.Block, inclusionTxs []*dcrutil.Tx, blockVersion int32, blockTime time.Time, miningAddr dcrutil.Address, mineTo []wire.TxOut, net *chaincfg.Params) (*dcrutil.Block, error)
CreateBlock creates a new block building from the previous block with a specified blockversion and timestamp. If the timestamp passed is zero (not initialized), then the timestamp of the previous block will be used plus 1 second is used. Passing nil for the previous block results in a block that builds off of the genesis block for the specified chain.
func GenerateAndSubmitBlock ¶
func GenerateAndSubmitBlock(client coinharness.RPCClient, args *GenerateBlockArgs) (*dcrutil.Block, error)
GenerateAndSubmitBlock creates a block whose contents include the passed transactions and submits it to the running simnet node. For generating blocks with only a coinbase tx, callers can simply pass nil instead of transactions to be mined. Additionally, a custom block version can be set by the caller. An uninitialized time.Time should be used for the blockTime parameter if one doesn't wish to set a custom time.
func GenerateAndSubmitBlockWithCustomCoinbaseOutputs ¶
func GenerateAndSubmitBlockWithCustomCoinbaseOutputs(client coinharness.RPCClient, args *GenerateBlockArgs) (*dcrutil.Block, error)
GenerateAndSubmitBlockWithCustomCoinbaseOutputs creates a block whose contents include the passed coinbase outputs and transactions and submits it to the running simnet node. For generating blocks with only a coinbase tx, callers can simply pass nil instead of transactions to be mined. Additionally, a custom block version can be set by the caller. A blockVersion of -1 indicates that the current default block version should be used. An uninitialized time.Time should be used for the blockTime parameter if one doesn't wish to set a custom time. The mineTo list of outputs will be added to the coinbase; this is not checked for correctness until the block is submitted; thus, it is the caller's responsibility to ensure that the outputs are correct. If the list is empty, the coinbase reward goes to the wallet managed by the Harness.
func IsCoinBaseTx ¶
func IsCoinBaseTx(tx *coinharness.MessageTx) bool
func NetworkFor ¶
func NetworkFor(net coinharness.Network) string
networkFor resolves network argument for node and wallet console commands
func NewRPCClient ¶
func NewRPCClient(config *rpcclient.ConnConfig, handlers *rpcclient.NotificationHandlers) (coinharness.RPCClient, error)
func NewTestSeed ¶
func NewTestSeed(salt uint32) coinharness.Seed
NewTestSeed generates new test wallet seed using predefined array hdSeed and a custom salt number The wallet's final HD seed is: [hdSeed || salt]. This method ensures that each harness instance uses a deterministic root seed based on its salt.
func NewTxFromBytes ¶
func NewTxFromBytes(txBytes []byte) (*coinharness.Tx, error)
func PayToAddrScript ¶
func PayToAddrScript(addr coinharness.Address) ([]byte, error)
func PrivateKeyKeyToAddr ¶
func PrivateKeyKeyToAddr(key coinharness.PrivateKey, net coinharness.Network) (coinharness.Address, error)
PrivateKeyKeyToAddr maps the passed private to corresponding p2pkh address.
func ReadBlockHeader ¶
func ReadBlockHeader(header []byte) coinharness.BlockHeader
func TransactionRawToTx ¶
func TransactionRawToTx(wireTx *wire.MsgTx) *coinharness.MessageTx
func TransactionTxToRaw ¶
func TransactionTxToRaw(chTx *coinharness.MessageTx) *wire.MsgTx
func TxSerializeSize ¶
func TxSerializeSize(msg *coinharness.MessageTx) int
Types ¶
type Address ¶
func (*Address) ScriptAddress ¶
type BlockHeader ¶
type BlockHeader struct {
// contains filtered or unexported fields
}
func (*BlockHeader) Height ¶
func (h *BlockHeader) Height() int64
type ConsoleCommandCook ¶
type ConsoleCommandCook struct { }
func (*ConsoleCommandCook) CookArguments ¶
func (cook *ConsoleCommandCook) CookArguments(par *coinharness.ConsoleCommandNodeParams) map[string]interface{}
cookArguments prepares arguments for the command-line call
type ConsoleNodeFactory ¶
type ConsoleNodeFactory struct { // NodeExecutablePathProvider returns path to the dcrd executable NodeExecutablePathProvider commandline.ExecutablePathProvider ConsoleCommandCook ConsoleCommandCook RPCClientFactory RPCClientFactory }
ConsoleNodeFactory produces a new ConsoleNode-instance upon request
func (*ConsoleNodeFactory) NewNode ¶
func (factory *ConsoleNodeFactory) NewNode(config *coinharness.TestNodeConfig) coinharness.Node
NewNode creates and returns a fully initialized instance of the ConsoleNode.
type ConsoleWalletFactory ¶
type ConsoleWalletFactory struct { // WalletExecutablePathProvider returns path to the btcd executable WalletExecutablePathProvider commandline.ExecutablePathProvider ConsoleCommandCook WalletConsoleCommandCook RPCClientFactory RPCClientFactory }
ConsoleWalletFactory produces a new ConsoleWallet-instance upon request
func (*ConsoleWalletFactory) NewWallet ¶
func (factory *ConsoleWalletFactory) NewWallet(config *coinharness.TestWalletConfig) coinharness.Wallet
NewWallet creates and returns a fully initialized instance of the ConsoleWallet.
type ExtendedKey ¶
type ExtendedKey struct {
// contains filtered or unexported fields
}
func (*ExtendedKey) Child ¶
func (k *ExtendedKey) Child(u uint32) (coinharness.ExtendedKey, error)
func (*ExtendedKey) PrivateKey ¶
func (k *ExtendedKey) PrivateKey() (coinharness.PrivateKey, error)
type GenerateBlockArgs ¶
type GenerateBlockArgs struct { Txns []*dcrutil.Tx BlockVersion int32 BlockTime time.Time MineTo []wire.TxOut MiningAddress dcrutil.Address Network *chaincfg.Params }
GenerateBlockArgs bundles GenerateBlock() arguments to minimize diff in case a new argument for the function is added
type InMemoryWalletFactory ¶
type InMemoryWalletFactory struct { }
InMemoryWalletFactory produces a new InMemoryWallet-instance upon request
func (*InMemoryWalletFactory) NewWallet ¶
func (f *InMemoryWalletFactory) NewWallet(cfg *coinharness.TestWalletConfig) coinharness.Wallet
NewWallet creates and returns a fully initialized instance of the InMemoryWallet.
type Network ¶
func (*Network) CoinbaseMaturity ¶
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func (*PrivateKey) PublicKey ¶
func (k *PrivateKey) PublicKey() coinharness.PublicKey
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
func (*RPCClient) AddNode ¶
func (c *RPCClient) AddNode(args *coinharness.AddNodeArguments) error
func (*RPCClient) CreateNewAccount ¶
func (*RPCClient) Disconnect ¶
func (c *RPCClient) Disconnect()
func (*RPCClient) Generate ¶
func (c *RPCClient) Generate(blocks uint32) (result []coinharness.Hash, e error)
func (*RPCClient) GetBalance ¶
func (c *RPCClient) GetBalance() (*coinharness.GetBalanceResult, error)
func (*RPCClient) GetBestBlock ¶
func (c *RPCClient) GetBestBlock() (coinharness.Hash, int64, error)
func (*RPCClient) GetBlock ¶
func (c *RPCClient) GetBlock(hash coinharness.Hash) (*coinharness.MsgBlock, error)
func (*RPCClient) GetBlockCount ¶
func (*RPCClient) GetBuildVersion ¶
func (c *RPCClient) GetBuildVersion() (coinharness.BuildVersion, error)
func (*RPCClient) GetNewAddress ¶
func (c *RPCClient) GetNewAddress(account string) (coinharness.Address, error)
func (*RPCClient) GetPeerInfo ¶
func (c *RPCClient) GetPeerInfo() ([]coinharness.PeerInfo, error)
func (*RPCClient) GetRawMempool ¶
func (c *RPCClient) GetRawMempool(command interface{}) (result []coinharness.Hash, e error)
func (*RPCClient) ListUnspent ¶
func (c *RPCClient) ListUnspent() ([]*coinharness.Unspent, error)
func (*RPCClient) LoadTxFilter ¶
func (c *RPCClient) LoadTxFilter(reload bool, addr []coinharness.Address) error
func (*RPCClient) NotifyBlocks ¶
func (*RPCClient) SendRawTransaction ¶
func (c *RPCClient) SendRawTransaction(tx *coinharness.MessageTx, allowHighFees bool) (result coinharness.Hash, e error)
func (*RPCClient) SubmitBlock ¶
func (c *RPCClient) SubmitBlock(block coinharness.Block) error
func (*RPCClient) ValidateAddress ¶
func (c *RPCClient) ValidateAddress(address coinharness.Address) (*coinharness.ValidateAddressResult, error)
func (*RPCClient) WalletInfo ¶
func (c *RPCClient) WalletInfo() (*coinharness.WalletInfoResult, error)
func (*RPCClient) WalletLock ¶
type RPCClientFactory ¶
type RPCClientFactory struct { }
func (*RPCClientFactory) NewRPCConnection ¶
func (f *RPCClientFactory) NewRPCConnection(config coinharness.RPCConnectionConfig, handlers *coinharness.NotificationHandlers) (coinharness.RPCClient, error)
type WalletConsoleCommandCook ¶
type WalletConsoleCommandCook struct { }
func (*WalletConsoleCommandCook) CookArguments ¶
func (cook *WalletConsoleCommandCook) CookArguments(par *coinharness.ConsoleCommandWalletParams) map[string]interface{}
cookArguments prepares arguments for the command-line call