mirror of
https://github.com/monero-project/monero.git
synced 2025-08-23 13:25:04 -04:00
wallet2: add on_reorg callback
This commit is contained in:
parent
50aa0e8b7f
commit
9c7d28b8ed
2 changed files with 5 additions and 1 deletions
|
@ -3780,7 +3780,7 @@ void wallet2::detach_blockchain(uint64_t height, std::map<std::pair<uint64_t, ui
|
|||
transfers_detached = std::distance(it, m_transfers.end());
|
||||
m_transfers.erase(it, m_transfers.end());
|
||||
|
||||
size_t blocks_detached = m_blockchain.size() - height;
|
||||
const uint64_t blocks_detached = m_blockchain.size() - height;
|
||||
m_blockchain.crop(height);
|
||||
|
||||
for (auto it = m_payments.begin(); it != m_payments.end(); )
|
||||
|
@ -3799,6 +3799,9 @@ void wallet2::detach_blockchain(uint64_t height, std::map<std::pair<uint64_t, ui
|
|||
++it;
|
||||
}
|
||||
|
||||
if (m_callback)
|
||||
m_callback->on_reorg(height, blocks_detached, transfers_detached);
|
||||
|
||||
LOG_PRINT_L0("Detached blockchain on height " << height << ", transfers detached " << transfers_detached << ", blocks detached " << blocks_detached);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue