From 562f673df8c24d365fb0d30fdc7d9bf7180309c1 Mon Sep 17 00:00:00 2001 From: Sergi Rene <sergi@datahop.network> Date: Wed, 28 Aug 2024 14:24:08 +0200 Subject: [PATCH] fix(p2p): update height in blocksync loop (#1035) --- p2p/client.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/p2p/client.go b/p2p/client.go index 4f5714ef0..2e9c6eb57 100644 --- a/p2p/client.go +++ b/p2p/client.go @@ -602,6 +602,11 @@ func (c *Client) retrieveBlockSyncLoop(ctx context.Context, msgHandler BlockSync c.logger.Debug("Blocksync block received ", "height", h) msgHandler(&block) + state, err := c.store.LoadState() + if err != nil { + return + } + h = max(h, state.NextHeight()-1) } c.blocksReceived.RemoveBlocksReceivedUpToHeight(state.NextHeight()) }