From 5f66fb5de017e176ffaecb03f0239624f051d31e Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Tue, 29 Oct 2024 09:14:23 +0800 Subject: [PATCH] fix tautological condition: nil == nil --- consensus/XDPoS/engines/engine_v1/engine.go | 2 +- consensus/clique/clique.go | 2 +- trie/trie.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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 }