From 734030046055f521a73e59b50fa2a16f48e34c8d Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Mon, 3 Sep 2018 14:19:15 +0000 Subject: 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. --- src/wallet/wallet2.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/wallet/wallet2.h') 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 ¬ify) { m_tx_notify = notify; } + private: /*! * \brief Stores wallet information to wallet file. @@ -1353,6 +1356,8 @@ namespace tools boost::optional m_encrypt_keys_after_refresh; bool m_unattended; + + std::shared_ptr m_tx_notify; }; } BOOST_CLASS_VERSION(tools::wallet2, 25) -- cgit v1.2.3