core: don't do useless DB reads if nothing was persisted
This commit is contained in:
parent
90d4299f0b
commit
9f7625d699
1 changed files with 11 additions and 11 deletions
|
@ -492,6 +492,7 @@ func (bc *Blockchain) persist() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if persisted > 0 {
|
||||||
bHeight, err := storage.CurrentBlockHeight(bc.store)
|
bHeight, err := storage.CurrentBlockHeight(bc.store)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -503,7 +504,6 @@ func (bc *Blockchain) persist() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if persisted > 0 {
|
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"persistedBlocks": diff,
|
"persistedBlocks": diff,
|
||||||
"persistedKeys": persisted,
|
"persistedKeys": persisted,
|
||||||
|
|
Loading…
Reference in a new issue