Documentation ¶
Index ¶
- Constants
- func EmptyCLIContext() *cli.Context
- func Head(val interface{}) *models.Head
- func MustAddAccountToKeyStore(t testing.TB, account *models.Account, keyJSONBytes []byte, ...)
- func MustAddAttemptToTx(t *testing.T, store esStore.Store, txID uuid.UUID, attempt *models.TxAttempt)
- func MustAddRandomAccountToKeystore(t testing.TB, store esStore.Store, keyStore client.KeyStoreInterface, ...) (account *models.Account, address common.Address)
- func MustGenerateRandomAccount(t testing.TB, opts ...interface{}) (account *models.Account, keyJSONBytes []byte)
- func MustInsertConfirmedTxWithAttempt(t *testing.T, store esStore.Store, nonce int64, broadcastBeforeBlockNum int64, ...) *models.Tx
- func MustInsertFatalErrorTx(t *testing.T, store esStore.Store, fromAddress common.Address) *models.Tx
- func MustInsertInProgressTxWithAttempt(t *testing.T, store esStore.Store, nonce int64, fromAddress common.Address) *models.Tx
- func MustInsertRandomAccount(t testing.TB, store esStore.Store, opts ...interface{}) *models.Account
- func MustInsertTxReceipt(t *testing.T, store esStore.Store, blockNumber int64, blockHash common.Hash, ...) *models.TxReceipt
- func MustInsertUnconfirmedTxWithBroadcastAttempt(t *testing.T, store esStore.Store, nonce int64, fromAddress common.Address) *models.Tx
- func MustJSONDel(t *testing.T, json, path string) string
- func MustJSONSet(t *testing.T, json, path string, value interface{}) string
- func NewAddress() common.Address
- func NewConfig(t testing.TB) *types.Config
- func NewHash() common.Hash
- func NewRandomInt64() int64
- func NewStore(t testing.TB) store.Store
- func NewTx(t *testing.T, fromAddress common.Address) *models.Tx
- func NewTxAttempt(t *testing.T, txID uuid.UUID) *models.TxAttempt
- func Random32Byte() (b [32]byte)
- type MockHeadTrackable
- func (m *MockHeadTrackable) Connect(bn *models.Head) error
- func (m *MockHeadTrackable) ConnectedCount() int32
- func (m *MockHeadTrackable) Disconnect()
- func (m *MockHeadTrackable) DisconnectedCount() int32
- func (m *MockHeadTrackable) OnNewLongestChain(context.Context, *models.Head)
- func (m *MockHeadTrackable) OnNewLongestChainCount() int32
- type NeverSleeper
Constants ¶
const (
Password = "password"
)
Variables ¶
This section is empty.
Functions ¶
func EmptyCLIContext ¶
func MustAddAttemptToTx ¶
func MustInsertFatalErrorTx ¶
func MustInsertRandomAccount ¶
func MustInsertRandomAccount(t testing.TB, store esStore.Store, opts ...interface{}) *models.Account
MustInsertRandomAccount inserts a randomly generated (not cryptographically secure) account for testing If using this with the keystore, it should be called before the keystore loads keys from the database
func MustInsertTxReceipt ¶
func MustJSONDel ¶
MustJSONDel uses sjson.Delete to remove a path from a JSON string and returns the string
func MustJSONSet ¶
MustJSONSet uses sjson.Set to set a path in a JSON string and returns the string See https://github.com/tidwall/sjson
func NewRandomInt64 ¶
func NewRandomInt64() int64
func Random32Byte ¶
func Random32Byte() (b [32]byte)
Types ¶
type MockHeadTrackable ¶
type MockHeadTrackable struct { ConnectedCallback func(bn *models.Head) // contains filtered or unexported fields }
MockHeadTrackable allows you to mock HeadTrackable
func (*MockHeadTrackable) Connect ¶
func (m *MockHeadTrackable) Connect(bn *models.Head) error
Connect increases the connected count by one
func (*MockHeadTrackable) ConnectedCount ¶
func (m *MockHeadTrackable) ConnectedCount() int32
ConnectedCount returns the count of connections made, safely.
func (*MockHeadTrackable) Disconnect ¶
func (m *MockHeadTrackable) Disconnect()
Disconnect increases the disconnected count by one
func (*MockHeadTrackable) DisconnectedCount ¶
func (m *MockHeadTrackable) DisconnectedCount() int32
DisconnectedCount returns the count of disconnections made, safely.
func (*MockHeadTrackable) OnNewLongestChain ¶
func (m *MockHeadTrackable) OnNewLongestChain(context.Context, *models.Head)
OnNewLongestChain increases the OnNewLongestChainCount count by one
func (*MockHeadTrackable) OnNewLongestChainCount ¶
func (m *MockHeadTrackable) OnNewLongestChainCount() int32
OnNewLongestChainCount returns the count of new heads, safely.
type NeverSleeper ¶
type NeverSleeper struct{}
NeverSleeper is a struct that never sleeps
func (NeverSleeper) Duration ¶
func (ns NeverSleeper) Duration() time.Duration
Duration returns a duration