Skip to content

Commit f4a3614

Browse files
authored
Merge pull request #1591 from cffls/v2.2.1-beta-candidate
eth: fix canonical chain state inconsistency in checkpoint verifier
2 parents da97795 + 3bc1485 commit f4a3614

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

eth/bor_checkpoint_verifier.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,17 @@ func borVerify(ctx context.Context, eth *Ethereum, handler *ethHandler, start ui
150150
if err != nil {
151151
log.Warn("Failed to insert canonical chain", "err", err)
152152
return hash, err
153-
} else {
154-
log.Info("Successfully inserted canonical chain")
155153
}
154+
155+
// Then explicitly set the final block as canonical to ensure proper canonical mapping
156+
finalBlock := canonicalChain[len(canonicalChain)-1]
157+
_, err = eth.BlockChain().SetCanonical(finalBlock)
158+
if err != nil {
159+
log.Warn("Failed to set canonical head after insertion", "err", err, "block", finalBlock.NumberU64(), "hash", finalBlock.Hash())
160+
return hash, err
161+
}
162+
163+
log.Info("Successfully inserted canonical chain")
156164
} else {
157165
log.Warn("Failed to insert canonical chain", "length", len(canonicalChain), "expected", length)
158166
return hash, errHashMismatch

params/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
const (
2626
VersionMajor = 2 // Major version component of the current release
2727
VersionMinor = 2 // Minor version component of the current release
28-
VersionPatch = 1 // Patch version component of the current release
28+
VersionPatch = 2 // Patch version component of the current release
2929
VersionMeta = "beta" // Version metadata to append to the version string
3030
)
3131

0 commit comments

Comments
 (0)