-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix(manager): gossip any pending blocks not gossiped before (in case of restart or crash) #1045
Changes from 14 commits
a7ce1e0
d237280
010ef75
3c61d38
b6b4114
47ef995
9534e21
aab53d4
687c0c5
dc22794
33a5d63
429d59d
725b994
3d803f7
752ff34
302b880
e2ab37f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -519,6 +519,11 @@ func (c *Client) blockGossipReceived(ctx context.Context, block []byte) { | |
c.logger.Error("Publishing event.", "err", err) | ||
} | ||
if c.conf.BlockSyncEnabled { | ||
_, err := c.store.LoadBlockCid(gossipedBlock.Block.Header.Height) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this for optimization purposes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, this is just to avoid storing the block twice if already stored. |
||
// skip block already added to blocksync | ||
if err == nil { | ||
return | ||
} | ||
err = c.SaveBlock(ctx, gossipedBlock.Block.Header.Height, block) | ||
if err != nil { | ||
c.logger.Error("Adding block to blocksync store.", "err", err, "height", gossipedBlock.Block.Header.Height) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for cleanliness I'd suggest moving this code part to a
saveP2PBlock
method or some other name which makes sense an add a godoc to this function.also we why use
context.TODO()
? sThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to new func