eth/filters: deliver the same block logs if reorg occured

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2023-07-25 11:17:33 +08:00
parent 3b3eb5aab5
commit 43afa1e462

View file

@ -408,12 +408,11 @@ func (api *FilterAPI) histLogs(notifier notifier, rpcSub *rpc.Subscription, from
} }
} }
case log := <-histLogs: case log := <-histLogs:
if reorged { // If ChainReorg is detected, we need to deliver the last block's full logs
continue if !reorged || delivered == log.BlockNumber {
}
// TODO: deliver the same block logs
delivered = log.BlockNumber delivered = log.BlockNumber
notifier.Notify(rpcSub.ID, &log) notifier.Notify(rpcSub.ID, &log)
}
case <-rpcSub.Err(): // client send an unsubscribe request case <-rpcSub.Err(): // client send an unsubscribe request
liveLogsSub.Unsubscribe() liveLogsSub.Unsubscribe()
closeC <- struct{}{} closeC <- struct{}{}