Skip to content

Commit

Permalink
read initial block
Browse files Browse the repository at this point in the history
  • Loading branch information
brennanjl committed Nov 21, 2024
1 parent cc90fb8 commit 76ffe6c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/kwild/server/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,16 @@ func buildServer(d *coreDependencies, closers *closeFuncs) *Server {
}
txApp.SetReplayStatusChecker(cometBftNode.IsCatchup)

// we need to get the last known block info
block, err := cometBftClient.Block(d.ctx, nil)
if err != nil {
failBuild(err, "unable to fetch latest height")
}
// if initial startup, block will be nil
if block.Block != nil {
lastBlock.Set(block.Block.Height, block.Block.Time.Unix())
}

eventBroadcaster := buildEventBroadcaster(d, ev, wrappedCmtClient, txApp)
abciApp.SetEventBroadcaster(eventBroadcaster.RunBroadcast)

Expand Down

0 comments on commit 76ffe6c

Please sign in to comment.