diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-01-09 14:29:28 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-02-12 12:16:04 +0000 |
commit | 7d2f817f5ea6091600d484b84799da0d27a8370c (patch) | |
tree | 8aec30ec1a03a76d8bc6490532c2a45813fa0376 /src/cryptonote_core/blockchain.cpp | |
parent | cryptonote_core: warn when the block rate deviates from expectations (diff) | |
download | monero-7d2f817f5ea6091600d484b84799da0d27a8370c.tar.xz |
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
Diffstat (limited to 'src/cryptonote_core/blockchain.cpp')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index ee57c9430..a0a1e3935 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -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; } |