File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -333,13 +333,23 @@ func (ct *ClaimTrie) ResetHeight(height int32) error {
333333 if passedHashFork {
334334 names = nil // force them to reconsider all names
335335 }
336+
337+ var fullRebuildRequired bool
338+
336339 err = ct .merkleTrie .SetRoot (hash )
337340 if err == merkletrie .ErrFullRebuildRequired {
341+ fullRebuildRequired = true
342+ } else if err != nil {
343+ return errors .Wrapf (err , "setRoot" )
344+ }
345+
346+ if fullRebuildRequired {
338347 ct .runFullTrieRebuild (names , nil )
339348 }
340349
341350 if ! ct .MerkleHash ().IsEqual (hash ) {
342- return errors .Errorf ("unable to restore the hash at height %d" , height )
351+ return errors .Errorf ("unable to restore the hash at height %d" +
352+ " (fullTriedRebuilt: %t)" , height , fullRebuildRequired )
343353 }
344354
345355 return errors .WithStack (ct .blockRepo .Delete (height + 1 , oldHeight ))
You can’t perform that action at this time.
0 commit comments