System information
CL client & version: e.g. [email protected]
OS & Version: LINUX
Commit hash : a382917
Running this minimal snippet to subscribe to logs emitted by pending transactions.
func GetProvider(conn string) *ethclient.Client {
provider, err := ethclient.Dial(conn)
if err != nil {
fmt.Printf("faied to connect to geth node via ws. err=%v conn=%v\n", err, conn)
return nil
}
return provider
}
func MinimumLoop() {
localCh := make(chan types.Log)
provider = GetProvider(LOCAL_GETH_WS_CONN)
localSub, err := provider.SubscribeFilterLogs(
context.Background(),
ethereum.FilterQuery{
FromBlock: big.NewInt(-1),
ToBlock: big.NewInt(-1),
},
localCh,
)
if err != nil {
log.Fatalln(err)
}
for {
select {
case logLocal := <-localCh:
fmt.Println(logLocal.TxHash)
case err := <-localSub.Err():
log.Fatalln(err)
}
}
}
func main() {
MinimumLoop()
}
Expected behaviour
Volume of logs being printed from the loop should match number of actual transaction entering the mempool.
Actual behaviour
Pending logs are printed out very very slowly. At a rate of roughly 1 unique transaction per second. Something is definitely wrong,