Documentation ¶
Index ¶
- func NewNonceStore(systemStore sqlstore.SystemStore) nonce.NonceStore
- func NewSimpleTracker(w *wallet.Wallet, backend bind.ContractBackend) nonce.NonceTracker
- type LocalTracker
- type NonceStore
- func (s *NonceStore) DeletePendingTxByHash(ctx context.Context, hash common.Hash) error
- func (s *NonceStore) InsertPendingTx(ctx context.Context, addr common.Address, nonce int64, hash common.Hash) error
- func (s *NonceStore) ListPendingTx(ctx context.Context, addr common.Address) ([]nonce.PendingTx, error)
- func (s *NonceStore) ReplacePendingTxByHash(ctx context.Context, oldHash common.Hash, newHash common.Hash) error
- type SimpleTracker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNonceStore ¶
func NewNonceStore(systemStore sqlstore.SystemStore) nonce.NonceStore
NewNonceStore creates a new nonce store.
func NewSimpleTracker ¶
func NewSimpleTracker(w *wallet.Wallet, backend bind.ContractBackend) nonce.NonceTracker
NewSimpleTracker returns a Simpler Tracker.
Types ¶
type LocalTracker ¶
type LocalTracker struct {
// contains filtered or unexported fields
}
LocalTracker implements a nonce tracker that stores nonce and pending txs locally.
func NewLocalTracker ¶
func NewLocalTracker( ctx context.Context, w *wallet.Wallet, nonceStore noncepkg.NonceStore, chainID tableland.ChainID, chainClient noncepkg.ChainClient, checkInterval time.Duration, minBlockChainDepth int, stuckInterval time.Duration, ) (*LocalTracker, error)
NewLocalTracker creates a new local tracker. The provided context is used only for initialization logic. For graceful closing, the caller should use the Close() API.
func (*LocalTracker) GetNonce ¶
func (t *LocalTracker) GetNonce(ctx context.Context) (noncepkg.RegisterPendingTx, noncepkg.UnlockTracker, int64)
GetNonce returns the nonce to be used in the next transaction. The call is blocked until the client calls unlock. The client should also call registerPendingTx if it managed to submit a transaction sucessuflly.
func (*LocalTracker) GetPendingCount ¶
func (t *LocalTracker) GetPendingCount(_ context.Context) int
GetPendingCount returns the number of pendings txs.
type NonceStore ¶
type NonceStore struct {
// contains filtered or unexported fields
}
NonceStore relies on the SQLStore implementation for now.
func (*NonceStore) DeletePendingTxByHash ¶
DeletePendingTxByHash deletes a pending tx.
func (*NonceStore) InsertPendingTx ¶
func (s *NonceStore) InsertPendingTx( ctx context.Context, addr common.Address, nonce int64, hash common.Hash, ) error
InsertPendingTx insert a new pending tx.
func (*NonceStore) ListPendingTx ¶
func (s *NonceStore) ListPendingTx( ctx context.Context, addr common.Address, ) ([]nonce.PendingTx, error)
ListPendingTx lists all pendings txs.
func (*NonceStore) ReplacePendingTxByHash ¶
func (s *NonceStore) ReplacePendingTxByHash(ctx context.Context, oldHash common.Hash, newHash common.Hash) error
ReplacePendingTxByHash replaces a pending tx hash with another and also bumps the counter to track how many times this happened for this nonce.
type SimpleTracker ¶
type SimpleTracker struct {
// contains filtered or unexported fields
}
SimpleTracker is a nonce tracker for testing purposes.
func (*SimpleTracker) GetNonce ¶
func (t *SimpleTracker) GetNonce(ctx context.Context) (nonce.RegisterPendingTx, nonce.UnlockTracker, int64)
GetNonce returns the nonce to be used in the next transaction.
func (*SimpleTracker) GetPendingCount ¶
func (t *SimpleTracker) GetPendingCount(_ context.Context) int
GetPendingCount returns the number of pendings txs.