diff --git a/consensus/XDPoS/engines/engine_v1/engine.go b/consensus/XDPoS/engines/engine_v1/engine.go index 3df0e29369..c913a80773 100644 --- a/consensus/XDPoS/engines/engine_v1/engine.go +++ b/consensus/XDPoS/engines/engine_v1/engine.go @@ -476,7 +476,7 @@ func (x *XDPoS_v1) snapshot(chain consensus.ChainReader, number uint64, hash com headers []*types.Header snap *SnapshotV1 ) - for snap == nil { + for { // If an in-memory SnapshotV1 was found, use that if s, ok := x.recents.Get(hash); ok { snap = s.(*SnapshotV1) diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index 9bae8fd743..bb1e9bb4b4 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -390,7 +390,7 @@ func (c *Clique) snapshot(chain consensus.ChainReader, number uint64, hash commo headers []*types.Header snap *Snapshot ) - for snap == nil { + for { // If an in-memory snapshot was found, use that if s, ok := c.recents.Get(hash); ok { snap = s.(*Snapshot) diff --git a/trie/trie.go b/trie/trie.go index 834c4d79de..dea4ddbf1c 100644 --- a/trie/trie.go +++ b/trie/trie.go @@ -243,7 +243,7 @@ func (t *Trie) tryGetAllLeftKeyAndValue(origNode Node, prefix []byte, limit []by if err != nil { return nil, nil, n, false, err } - if err == nil && didResolve { + if didResolve { n = n.copy() n.Children[i] = newnode }