mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 21:26:42 +00:00
cmd/era: also check iterator error after loop
This commit is contained in:
parent
d367576093
commit
dccb358660
1 changed files with 5 additions and 2 deletions
|
|
@ -273,8 +273,8 @@ func checkAccumulator(e *era.Era) error {
|
|||
// accumulation across the entire set and are verified at the end.
|
||||
for it.Next() {
|
||||
// 1) next() walks the block index, so we're able to implicitly verify it.
|
||||
if itErr := it.Error(); itErr != nil {
|
||||
return fmt.Errorf("error reading block %d: %w", it.Number(), itErr)
|
||||
if it.Error() != nil {
|
||||
return fmt.Errorf("error reading block %d: %w", it.Number(), it.Error())
|
||||
}
|
||||
block, receipts, err := it.BlockAndReceipts()
|
||||
if err != nil {
|
||||
|
|
@ -294,6 +294,9 @@ func checkAccumulator(e *era.Era) error {
|
|||
td.Add(td, block.Difficulty())
|
||||
tds = append(tds, new(big.Int).Set(td))
|
||||
}
|
||||
if it.Error() != nil {
|
||||
return fmt.Errorf("error reading block %d: %w", it.Number(), it.Error())
|
||||
}
|
||||
// 4+5) Verify accumulator and total difficulty.
|
||||
got, err := era.ComputeAccumulator(hashes, tds)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue