Skip to content

Commit

Permalink
Merge pull request #1988 from ElrondNetwork/prune-state-behind-final-bug
Browse files Browse the repository at this point in the history
Prune state only behind finalized
  • Loading branch information
iulianpascalau committed Jun 24, 2020
2 parents f319f74 + 86e5e23 commit 770d618
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion integrationTests/testProcessorNode.go
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ func (tpn *TestProcessorNode) initBlockProcessor(stateCheckpointModulus uint) {
return nil
},
GetHighestFinalBlockNonceCalled: func() uint64 {
return 0
return 100
},
ProbableHighestNonceCalled: func() uint64 {
return 0
Expand Down
4 changes: 4 additions & 0 deletions process/block/shardblock.go
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,10 @@ func (sp *shardProcessor) updateState(headers []data.HeaderHandler, currentHeade
sp.snapShotEpochStartFromMeta(currentHeader)

for _, hdr := range headers {
if sp.forkDetector.GetHighestFinalBlockNonce() < hdr.GetNonce() {
break
}

prevHeader, errNotCritical := process.GetShardHeaderFromStorage(hdr.GetPrevHash(), sp.marshalizer, sp.store)
if errNotCritical != nil {
log.Debug("could not get shard header from storage")
Expand Down

0 comments on commit 770d618

Please sign in to comment.