Skip to content

Commit

Permalink
fix: set latesthead in newHeadCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
rymnc committed Sep 5, 2023
1 parent cbb266a commit 3c9d4be
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions waku/waku_rln_relay/group_manager/on_chain/group_manager.nim
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,7 @@ proc getAndHandleEvents(g: OnchainGroupManager,
return toBlock.get()
return fromBlock

let blockTable = await g.getBlockTable(fromBlock, toBlock)
if blockTable.len() > 0:
g.lastSeenBlockHead = getLatestBlockNumber()
let blockTable = await g.getBlockTable(fromBlock, toBlock)
await g.handleEvents(blockTable)
await g.handleRemovedEvents(blockTable)

Expand All @@ -337,6 +335,7 @@ proc getAndHandleEvents(g: OnchainGroupManager,
proc getNewHeadCallback(g: OnchainGroupManager): BlockHeaderHandler =
proc newHeadCallback(blockheader: BlockHeader) {.gcsafe.} =
let latestBlock = blockheader.number.uint
g.lastSeenBlockHead = latestBlock
trace "block received", blockNumber = latestBlock
# get logs from the last block
try:
Expand Down

0 comments on commit 3c9d4be

Please sign in to comment.