Documentation ¶
Index ¶
- type Config
- type EthClient
- type EthClientMock
- func (_m *EthClientMock) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
- func (_m *EthClientMock) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
- func (_m *EthClientMock) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
- type ReorgDetector
- type Subscription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // DBPath is the path to the database DBPath string `mapstructure:"DBPath"` // CheckReorgsInterval is the interval to check for reorgs in tracked blocks CheckReorgsInterval types.Duration `mapstructure:"CheckReorgsInterval"` }
Config is the configuration for the reorg detector
func (*Config) GetCheckReorgsInterval ¶
GetCheckReorgsInterval returns the interval to check for reorgs in tracked blocks
type EthClientMock ¶
EthClientMock is an autogenerated mock type for the EthClient type
func NewEthClientMock ¶
func NewEthClientMock(t interface { mock.TestingT Cleanup(func()) }) *EthClientMock
NewEthClientMock creates a new instance of EthClientMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*EthClientMock) HeaderByHash ¶
HeaderByHash provides a mock function with given fields: ctx, hash
func (*EthClientMock) HeaderByNumber ¶
func (_m *EthClientMock) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
HeaderByNumber provides a mock function with given fields: ctx, number
func (*EthClientMock) SubscribeNewHead ¶
func (_m *EthClientMock) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
SubscribeNewHead provides a mock function with given fields: ctx, ch
type ReorgDetector ¶
type ReorgDetector struct {
// contains filtered or unexported fields
}
func (*ReorgDetector) AddBlockToTrack ¶
func (rd *ReorgDetector) AddBlockToTrack(ctx context.Context, id string, num uint64, hash common.Hash) error
AddBlockToTrack adds a block to the tracked list for a subscriber
func (*ReorgDetector) Start ¶
func (rd *ReorgDetector) Start(ctx context.Context) (err error)
Start starts the reorg detector
func (*ReorgDetector) Subscribe ¶
func (rd *ReorgDetector) Subscribe(id string) (*Subscription, error)
Subscribe subscribes to reorg events
type Subscription ¶
Subscription is a subscription to reorg events