aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCrypto City <cryptocity@example.com>2019-11-17 21:12:46 +0000
committerj-berman <justinberman@protonmail.com>2023-09-27 12:50:34 -0700
commit1df5630f23aef7b8fa14135966b615db78d2833a (patch)
treedbf445f3fd64dda0a594c474f0db2009a43aa644 /src
parentMerge pull request #8988 (diff)
downloadmonero-1df5630f23aef7b8fa14135966b615db78d2833a.tar.xz
wallet2: add on_reorg callback
Diffstat (limited to 'src')
-rw-r--r--src/wallet/wallet2.cpp3
-rw-r--r--src/wallet/wallet2.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index c5c66d4e5..86307a6d3 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -4313,6 +4313,9 @@ wallet2::detached_blockchain_data wallet2::detach_blockchain(uint64_t height, st
++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);
return dbd;
}
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index 11f55d6d4..59cedb8f4 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -139,6 +139,7 @@ private:
public:
// Full wallet callbacks
virtual void on_new_block(uint64_t height, const cryptonote::block& block) {}
+ virtual void on_reorg(uint64_t height, uint64_t blocks_detached, size_t transfers_detached) {}
virtual void on_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount, uint64_t burnt, const cryptonote::subaddress_index& subaddr_index, bool is_change, uint64_t unlock_time) {}
virtual void on_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount, const cryptonote::subaddress_index& subaddr_index) {}
virtual void on_money_spent(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& in_tx, uint64_t amount, const cryptonote::transaction& spend_tx, const cryptonote::subaddress_index& subaddr_index) {}