txlogscanner

package
v0.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogToConsole

func LogToConsole(msg string)

func RebuildAvaiIndexes

func RebuildAvaiIndexes(clientsCount int, clientSleepTimes *map[int]int64) []int

func StartScanTxLogs

func StartScanTxLogs(txlogWatcher TxlogWatcher) error

开始扫描

Types

type SimpleTxLogWatcher

type SimpleTxLogWatcher struct {
	// contains filtered or unexported fields
}

简单交易管理结构

func NewSimpleTxLogWatcher

func NewSimpleTxLogWatcher(endpoints []string, scanStartBlock uint64, scanInterval time.Duration, callback func(*types.Log) error) *SimpleTxLogWatcher

构造一个新的简单tx管理结构(默认3秒钟扫描一次)

func (*SimpleTxLogWatcher) AddInterestedParams

func (watcher *SimpleTxLogWatcher) AddInterestedParams(address string, topic0 string)

添加关注的from address

func (*SimpleTxLogWatcher) Callback

func (watcher *SimpleTxLogWatcher) Callback(tx *types.Log) error

tx回调处理方法

func (*SimpleTxLogWatcher) GetEthClients

func (watcher *SimpleTxLogWatcher) GetEthClients() ([]*ethclient.Client, error)

func (*SimpleTxLogWatcher) GetInterestedAddresses added in v0.0.10

func (watcher *SimpleTxLogWatcher) GetInterestedAddresses() []common.Address

func (*SimpleTxLogWatcher) GetPerScanBlockCount added in v0.0.10

func (watcher *SimpleTxLogWatcher) GetPerScanBlockCount() uint64

func (*SimpleTxLogWatcher) GetScanInterval

func (watcher *SimpleTxLogWatcher) GetScanInterval() time.Duration

获取区块扫描间隔

func (*SimpleTxLogWatcher) GetScanStartBlock

func (watcher *SimpleTxLogWatcher) GetScanStartBlock() uint64

func (*SimpleTxLogWatcher) IsInterestedLog

func (watcher *SimpleTxLogWatcher) IsInterestedLog(addr string, topic0 string) bool

func (*SimpleTxLogWatcher) SetInfuraSecrets

func (watcher *SimpleTxLogWatcher) SetInfuraSecrets(secrets []string)

func (*SimpleTxLogWatcher) SetPerScanBlockCount added in v0.0.10

func (watcher *SimpleTxLogWatcher) SetPerScanBlockCount(perScanBlockCount uint64)

func (*SimpleTxLogWatcher) SetScanInterval

func (watcher *SimpleTxLogWatcher) SetScanInterval(interval time.Duration)

设置区块扫描间隔

type TxlogWatcher

type TxlogWatcher interface {
	//获取开始扫描的区块号
	GetScanStartBlock() uint64

	//获取节点地址
	GetEthClients() ([]*ethclient.Client, error)

	//获取单次扫描区块数
	GetPerScanBlockCount() uint64

	GetInterestedAddresses() []common.Address

	//是否是需要解析的tx
	IsInterestedLog(address string, topic0 string) bool

	//tx log回调处理方法
	Callback(txlog *types.Log) error

	//获取扫描间隔
	GetScanInterval() time.Duration
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL