File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
core/src/consensus/tendermint Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -1708,12 +1708,17 @@ impl Worker {
17081708 // NOTE: Only the genesis block and the snapshot target don't have the parent in the blockchain
17091709 None => continue ,
17101710 } ;
1711- let term_seconds = if let Some ( p) = c. term_common_params ( parent_header. hash ( ) . into ( ) ) {
1711+ let grandparent_header = match c. block_header ( & BlockId :: Hash ( * header. parent_hash ( ) ) ) {
1712+ Some ( h) => h. decode ( ) ,
1713+ // Grandparent can be missing if the block number < 2 or there is a missing
1714+ None => continue ,
1715+ } ;
1716+ let term_seconds = if let Some ( p) = c. term_common_params ( grandparent_header. hash ( ) . into ( ) ) {
17121717 p. term_seconds ( )
17131718 } else {
17141719 continue
17151720 } ;
1716- if super :: engine:: is_term_changed ( & header , & parent_header , term_seconds) {
1721+ if super :: engine:: is_term_changed ( & parent_header , & grandparent_header , term_seconds) {
17171722 last_term_end = Some ( * block_hash) ;
17181723 }
17191724 }
You can’t perform that action at this time.
0 commit comments