Skip to content

Commit 4c114af

Browse files
authored
Merge pull request #25582 from holiman/err_handling
consensus/beacon: don't ignore errors
2 parents 9ed10b9 + 45a660a commit 4c114af

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

consensus/beacon/consensus.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ func (beacon *Beacon) Author(header *types.Header) (common.Address, error) {
7979
// VerifyHeader checks whether a header conforms to the consensus rules of the
8080
// stock Ethereum consensus engine.
8181
func (beacon *Beacon) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error {
82-
reached, _ := IsTTDReached(chain, header.ParentHash, header.Number.Uint64()-1)
82+
reached, err := IsTTDReached(chain, header.ParentHash, header.Number.Uint64()-1)
83+
if err != nil {
84+
return err
85+
}
8386
if !reached {
8487
return beacon.ethone.VerifyHeader(chain, header, seal)
8588
}
@@ -116,11 +119,14 @@ func (beacon *Beacon) VerifyHeaders(chain consensus.ChainHeaderReader, headers [
116119

117120
if len(preHeaders) == 0 {
118121
// All the headers are pos headers. Verify that the parent block reached total terminal difficulty.
119-
if reached, _ := IsTTDReached(chain, headers[0].ParentHash, headers[0].Number.Uint64()-1); !reached {
122+
if reached, err := IsTTDReached(chain, headers[0].ParentHash, headers[0].Number.Uint64()-1); !reached {
120123
// TTD not reached for the first block, mark subsequent with invalid terminal block
124+
if err == nil {
125+
err = consensus.ErrInvalidTerminalBlock
126+
}
121127
results := make(chan error, len(headers))
122128
for i := 0; i < len(headers); i++ {
123-
results <- consensus.ErrInvalidTerminalBlock
129+
results <- err
124130
}
125131
return make(chan struct{}), results
126132
}

0 commit comments

Comments
 (0)