aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/blockchain.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-01-09 14:29:28 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-01-28 19:32:31 +0000
commit23813c7160fa1236cc882cae0ae40f3bee339f91 (patch)
treeaab77e7ef5cde1080c7da9a2b15b1abe63710719 /src/cryptonote_core/blockchain.cpp
parentnotify: handle arbitrary tags (diff)
downloadmonero-23813c7160fa1236cc882cae0ae40f3bee339f91.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.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 7620dfd61..41357e72e 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -1073,6 +1073,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;
}