Fix #1824 don't end batch that we didn't start

This commit is contained in:
Howard Chu 2017-03-03 16:50:53 +00:00
parent 4e92ef4aa4
commit 296641e047
No known key found for this signature in database
GPG Key ID: FD2A70B44AB11BA7
1 changed files with 3 additions and 2 deletions

View File

@ -222,7 +222,7 @@ bool HardFork::reorganize_from_block_height(uint64_t height)
return false; return false;
db.set_batch_transactions(true); db.set_batch_transactions(true);
db.batch_start(); bool stop_batch = db.batch_start();
versions.clear(); versions.clear();
@ -250,7 +250,8 @@ bool HardFork::reorganize_from_block_height(uint64_t height)
add(db.get_block_from_height(h), h); add(db.get_block_from_height(h), h);
} }
db.batch_stop(); if (stop_batch)
db.batch_stop();
return true; return true;
} }