eth/filters: subscribe pending logs

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2023-06-27 01:04:09 +08:00
parent 223f05ff76
commit 7f3b72fe10

View file

@ -284,12 +284,12 @@ func (api *FilterAPI) logs(ctx context.Context, notifier notifier, rpcSub *rpc.S
to = rpc.BlockNumber(crit.ToBlock.Int64())
}
if to != rpc.LatestBlockNumber {
if to != rpc.LatestBlockNumber && to != rpc.PendingBlockNumber {
return errInvalidToBlock
}
// do live filter only
if from == rpc.LatestBlockNumber {
if from == rpc.LatestBlockNumber || from == rpc.PendingBlockNumber {
return api.liveLogs(ctx, notifier, rpcSub, crit)
}