mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
fix: use maximum uint64 value for receipt chain insertion
## Summary: Replace incorrect expression 2^64-1 (bitwise XOR, evaluates to 65) with the intended uint64 maximum. This was a logic bug that passes the wrong limit into InsertReceiptChain during Era import. ## Why: In Go ^ is bitwise XOR, not exponentiation. 2^64-1 does not produce max uint64 and causes incorrect behavior during import. Not an immediate remote-exec security vulnerability, but a correctness bug that can cause data/consensus problems when importing history. ## Fix: Use idiomatic ^uint64(0) to represent max uint64 without adding imports. ## Files changed: - cmd/utils/cmd.go
This commit is contained in:
parent
342285b139
commit
7db0dea699
1 changed files with 1 additions and 1 deletions
|
|
@ -311,7 +311,7 @@ func ImportHistory(chain *core.BlockChain, dir string, network string) error {
|
||||||
return fmt.Errorf("error reading receipts %d: %w", it.Number(), err)
|
return fmt.Errorf("error reading receipts %d: %w", it.Number(), err)
|
||||||
}
|
}
|
||||||
encReceipts := types.EncodeBlockReceiptLists([]types.Receipts{receipts})
|
encReceipts := types.EncodeBlockReceiptLists([]types.Receipts{receipts})
|
||||||
if _, err := chain.InsertReceiptChain([]*types.Block{block}, encReceipts, 2^64-1); err != nil {
|
if _, err := chain.InsertReceiptChain([]*types.Block{block}, encReceipts, ^uint64(0)); err != nil {
|
||||||
return fmt.Errorf("error inserting body %d: %w", it.Number(), err)
|
return fmt.Errorf("error inserting body %d: %w", it.Number(), err)
|
||||||
}
|
}
|
||||||
imported += 1
|
imported += 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue