diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-09-03 14:19:15 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-09-29 08:44:18 +0000 |
commit | 734030046055f521a73e59b50fa2a16f48e34c8d (patch) | |
tree | 7f7f8b4d50b8a0138c3c22d39d447ca0a85d45b1 /src/wallet/wallet2.h | |
parent | Merge pull request #4423 (diff) | |
download | monero-734030046055f521a73e59b50fa2a16f48e34c8d.tar.xz |
add --block-notify to monerod and --tx-notify to monero-wallet-{cli,rpc}
Those take a command line of the form "A [B]", with A being the
name (and optional path, if not in the caller's CWD, but fully
qualified path is recommended, avoids possible security issues)
to a program, and optional arguments. Any occurence of the two
character string "%s" will be replaced by the hash of the block
or transaction which triggered the notification.
Tokenization is barebones. If you want things like pipes, calls
to paths with spaces, etc, then use a script (though exec time
will suffer).
block-notify is called when a new block is added onto the chain.
tx-notify is called when a new transaction happens with the
wallet as source and/or destination.
It is the notification program's responsibility to determine what
to do in those cases.
Note that this is asynchronous, so it is very possible that:
- the notification programs will be run out of order
- several events happen before the notification for the first one
A Windows port would be nice if someone wants to make one.
Diffstat (limited to '')
-rw-r--r-- | src/wallet/wallet2.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index acbc09c36..d38e92ca9 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -68,6 +68,7 @@ namespace tools { class ringdb; class wallet2; + class Notify; class wallet_keys_unlocker { @@ -1176,6 +1177,8 @@ namespace tools void change_password(const std::string &filename, const epee::wipeable_string &original_password, const epee::wipeable_string &new_password); + void set_tx_notify(const std::shared_ptr<tools::Notify> ¬ify) { m_tx_notify = notify; } + private: /*! * \brief Stores wallet information to wallet file. @@ -1353,6 +1356,8 @@ namespace tools boost::optional<epee::wipeable_string> m_encrypt_keys_after_refresh; bool m_unattended; + + std::shared_ptr<tools::Notify> m_tx_notify; }; } BOOST_CLASS_VERSION(tools::wallet2, 25) |