mirror of
https://github.com/monero-project/monero.git
synced 2025-07-27 22:05:27 -04:00
blockchain: add --reorg-notify
This will trigger if a reorg is seen. This may be used to do things like stop automated withdrawals on large reorgs. %s is replaced by the height at the split point %h is replaced by the height of the new chain %n is replaced by the number of new blocks after the reorg
This commit is contained in:
parent
1168e8d5d5
commit
7d2f817f5e
3 changed files with 32 additions and 1 deletions
|
@ -1043,6 +1043,11 @@ bool Blockchain::switch_to_alternative_blockchain(std::list<blocks_ext_by_hash::
|
|||
|
||||
m_hardfork->reorganize_from_chain_height(split_height);
|
||||
|
||||
std::shared_ptr<tools::Notify> reorg_notify = m_reorg_notify;
|
||||
if (reorg_notify)
|
||||
reorg_notify->notify("%s", std::to_string(split_height).c_str(), "%h", std::to_string(m_db->height()).c_str(),
|
||||
"%n", std::to_string(m_db->height() - split_height).c_str(), NULL);
|
||||
|
||||
MGINFO_GREEN("REORGANIZE SUCCESS! on height: " << split_height << ", new blockchain size: " << m_db->height());
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue