@@ -79,7 +79,10 @@ func (beacon *Beacon) Author(header *types.Header) (common.Address, error) {
79
79
// VerifyHeader checks whether a header conforms to the consensus rules of the
80
80
// stock Ethereum consensus engine.
81
81
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
+ }
83
86
if ! reached {
84
87
return beacon .ethone .VerifyHeader (chain , header , seal )
85
88
}
@@ -116,11 +119,14 @@ func (beacon *Beacon) VerifyHeaders(chain consensus.ChainHeaderReader, headers [
116
119
117
120
if len (preHeaders ) == 0 {
118
121
// 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 {
120
123
// TTD not reached for the first block, mark subsequent with invalid terminal block
124
+ if err == nil {
125
+ err = consensus .ErrInvalidTerminalBlock
126
+ }
121
127
results := make (chan error , len (headers ))
122
128
for i := 0 ; i < len (headers ); i ++ {
123
- results <- consensus . ErrInvalidTerminalBlock
129
+ results <- err
124
130
}
125
131
return make (chan struct {}), results
126
132
}
0 commit comments