ethutil

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

README

Concurrent_searchLog

concurrent_searchLog在go-ethereum中client.QueryFilter的基础上优化performance,主要优点如下:

  • 能够通过调用一个方法获取2k个以上的区块信息
  • 并发发送HTTP请求,性能为原本API的4倍左右
  • 使用控制反转优化因为频繁调用HTTP请求而出现的网络拥塞,极大降低了网络拥塞的可能性
  • 保证并发HTTP请求的原子性,在网络不会出现问题的情况下,一定能获取全部的日志

Documentation

Index

Constants

View Source
const EmergencyRecovery = 100
View Source
const MaxConcurrentNumber = 8e4
View Source
const MaxQueryBlockSize int64 = 2000
View Source
const Polygon_Node_URL = "https://polygon-mainnet.g.alchemy.com/v2/bG72w682SlQ0uQwUcSfbZmQAB1VPwpZd"
View Source
const SmoothRecoverRatio = 0.25

Variables

View Source
var DefaultSmoothRecoverTimes = time.Millisecond * 500
View Source
var TimeLess time.Duration = 1<<63 - 1

Functions

func GetClient

func GetClient() *ethclient.Client

func GetCurrentBlockNumber

func GetCurrentBlockNumber() (uint64, error)

func TestGetLogs

func TestGetLogs(t *testing.T)

Types

type FilterFunc

type FilterFunc func([]types.Log) error

type LogsStream

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

func GetEvent

func GetEvent(timeout time.Duration, from int64, to int64, address []common.Address, topics [][]common.Hash) (stream *LogsStream, err error)

func NewLogsStream

func NewLogsStream(log []types.Log) *LogsStream

func (*LogsStream) Done

func (l *LogsStream) Done() (logs []types.Log, err error)

func (*LogsStream) FilterLog

func (l *LogsStream) FilterLog(filter FilterFunc) *LogsStream

Jump to

Keyboard shortcuts

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