Skip to content

Commit

Permalink
fix: lagging nodes failed to sync (bnb-chain#1829) (#33)
Browse files Browse the repository at this point in the history
### Description

upstream PR bnb-chain#1829

expanding hard-coded field to avoid risks

### Rationale

FastFinality puts more information into the header.extra field to keep
vote information. For mainnet, on epoch height, it could be 1526 bytes,
which was 517 bytes before. So the hard-coded 700 bytes for header could
be no longer enough, increase it by 2 times would be enough.

this bug could cause P2P sync failure for nodes that are lagging behind,
since they would request access of ancient db, and GetBlockHeaders could
be failed.

Co-authored-by: lx <[email protected]>
  • Loading branch information
0xcb9ff9 and brilliant-lx authored Sep 12, 2023
1 parent deb9f2d commit 8c07b95
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/rawdb/accessors_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func ReadHeaderRange(db ethdb.Reader, number uint64, count uint64) []rlp.RawValu
return rlpHeaders
}
// read remaining from ancients
max := count * 700
max := count * 700 * 3
data, err := db.AncientRange(freezerHeaderTable, i+1-count, count, max)
if err == nil && uint64(len(data)) == count {
// the data is on the order [h, h+1, .., n] -- reordering needed
Expand Down

0 comments on commit 8c07b95

Please sign in to comment.