forked from TrueCloudLab/neoneo-go
core: optimize persist() for the case when no next block found
If there is no next block in the cache, looping through the whole cache won't help.
This commit is contained in:
parent
7812fb28ea
commit
4f60fd3e8e
1 changed files with 3 additions and 0 deletions
|
@ -409,6 +409,9 @@ func (bc *Blockchain) persist(ctx context.Context) (err error) {
|
|||
}
|
||||
bc.blockCache.Delete(hash)
|
||||
persisted++
|
||||
} else {
|
||||
// no next block in the cache, no reason to continue looping
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue