blocksync: code refactoring and bug fix

This commit is contained in:
Jasmina Malicevic
2022-05-13 13:59:01 +02:00
parent f776b6cea0
commit 9dc425f2fa
3 changed files with 68 additions and 65 deletions
+1 -1
View File
@@ -547,7 +547,7 @@ func (r *Reactor) poolRoutine(ctx context.Context, stateSynced bool, blockSyncCh
// TODO(sergio, jmalicevic): Should we also validate against the extended commit?
if r.lastTrustedBlock == nil || r.lastTrustedBlock.block == nil {
if r.initialState.LastBlockHeight != 0 {
r.lastTrustedBlock = &TrustedBlockData{r.store.LoadBlock(r.initialState.LastBlockHeight), r.store.LoadBlockCommit(r.initialState.LastBlockHeight)}
r.lastTrustedBlock = &TrustedBlockData{r.store.LoadBlock(r.initialState.LastBlockHeight), r.store.LoadSeenCommit()}
if r.lastTrustedBlock == nil {
panic("Failed to load last trusted block")
}