mirror of
https://github.com/monero-project/monero.git
synced 2026-01-11 02:41:03 -05:00
Blockchain: cancel pop_blocks() operation on interupt
On SIGINT, `Blockchain::cancel()` is called, which sets `m_cancel` to `true`. This commit stops attempting to pop blocks from the chain once that flag is set. This should leave the blockchain in a well-define state, even if the `pop_blocks()` operation itself did not "complete".
This commit is contained in:
parent
6bb36309d6
commit
38bc62741b
1 changed files with 1 additions and 1 deletions
|
|
@ -562,7 +562,7 @@ void Blockchain::pop_blocks(uint64_t nblocks)
|
|||
const uint64_t blockchain_height = m_db->height();
|
||||
if (blockchain_height > 0)
|
||||
nblocks = std::min(nblocks, blockchain_height - 1);
|
||||
while (i < nblocks)
|
||||
while (i < nblocks && !m_cancel.load())
|
||||
{
|
||||
pop_block_from_blockchain();
|
||||
++i;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue