mirror of
https://github.com/monero-project/monero.git
synced 2024-12-04 23:51:08 +02:00
callback functions interface
This commit is contained in:
parent
8738c59ae9
commit
85d3200831
@ -295,9 +295,31 @@ struct Wallet2CallbackImpl : public tools::i_wallet2_callback
|
||||
}
|
||||
}
|
||||
|
||||
virtual void on_reorg(uint64_t height, uint64_t blocks_detached, size_t transfers_detached) { /* TODO */ }
|
||||
virtual boost::optional<epee::wipeable_string> on_get_password(const char *reason) { return boost::none; }
|
||||
virtual void on_pool_tx_removed(const crypto::hash &txid) { /* TODO */ }
|
||||
virtual void on_reorg(std::uint64_t height, std::uint64_t blocks_detached, std::size_t transfers_detached)
|
||||
{
|
||||
if (m_listener) {
|
||||
m_listener->onReorg(height, blocks_detached, transfers_detached);
|
||||
}
|
||||
}
|
||||
|
||||
virtual boost::optional<epee::wipeable_string> on_get_password(const char *reason)
|
||||
{
|
||||
if (m_listener) {
|
||||
auto password = m_listener->onGetPassword(reason);
|
||||
if (password) {
|
||||
return boost::make_optional(epee::wipeable_string((*password).data(), (*password).size()));
|
||||
}
|
||||
}
|
||||
return boost::none;
|
||||
}
|
||||
|
||||
virtual void on_pool_tx_removed(const crypto::hash &txid)
|
||||
{
|
||||
std::string txid_hex = epee::string_tools::pod_to_hex(txid);
|
||||
if (m_listener) {
|
||||
m_listener->onPoolTxRemoved(txid_hex);
|
||||
}
|
||||
}
|
||||
|
||||
WalletListener * m_listener;
|
||||
WalletImpl * m_wallet;
|
||||
|
@ -469,6 +469,21 @@ struct WalletListener
|
||||
* @brief If the listener is created before the wallet this enables to set created wallet object
|
||||
*/
|
||||
virtual void onSetWallet(Wallet * wallet) { (void)wallet; };
|
||||
|
||||
/**
|
||||
* @brief called on blockchain reorg
|
||||
*/
|
||||
virtual void onReorg(std::uint64_t height, std::uint64_t blocks_detached, std::size_t transfers_detached) = 0;
|
||||
|
||||
/**
|
||||
* @brief called by scan_output() to decrypt keys
|
||||
*/
|
||||
virtual optional<std::string> onGetPassword(const char *reason) = 0;
|
||||
|
||||
/**
|
||||
* @brief called when obsolete pool transactions get removed
|
||||
*/
|
||||
virtual void onPoolTxRemoved(const std::string &txid) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user