fix tautological condition: nil == nil

This commit is contained in:
Daniel Liu 2024-10-29 09:14:23 +08:00
parent 371c3b6874
commit 5f66fb5de0
3 changed files with 3 additions and 3 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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
}