Documentation ¶
Overview ¶
Package btctesting defines helpers to test Bitcoin.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mock ¶
type Mock struct { // The mock for the FindUnspent function. MockFindUnspent MockFindUnspent // The mock for the Broadcast function. MockBroadcast MockBroadcast }
Mock is used to mock a UnspentFinder and Broadcaster.
It implements github.com/stratumn/go-core/fossilizer.Adapter.
func (*Mock) Broadcast ¶
Broadcast implements github.com/stratumn/go-core/blockchain/btc.Broadcaster.Broadcast.
func (*Mock) FindUnspent ¶
func (a *Mock) FindUnspent(ctx context.Context, address *types.ReversedBytes20, amount int64) (btc.UnspentResult, error)
FindUnspent implements github.com/stratumn/go-core/blockchain/btc.UnspentFinder.FindUnspent.
type MockBroadcast ¶
type MockBroadcast struct { // The number of times the function was called. CalledCount int // The transaction that was passed to each call. CalledWith [][]byte // The last transaction that was passed. LastCalledWith []byte // An optional implementation of the function. Fn func(context.Context, []byte) error }
MockBroadcast mocks the Broadcast function.
type MockFindUnspent ¶
type MockFindUnspent struct { // The number of times the function was called. CalledCount int // The address that was passed to each call. CalledWithAddress []*types.ReversedBytes20 // The amount that was passed to each call. CalledWithAmount []int64 // The last address that was passed. LastCalledWithAddress *types.ReversedBytes20 // The last amount that was passed. LastCalledWithAmount int64 // An optional implementation of the function. Fn func(context.Context, *types.ReversedBytes20, int64) (btc.UnspentResult, error) }
MockFindUnspent mocks the FindUnspent function.
Click to show internal directories.
Click to hide internal directories.