06e1fb0b17 Add new format string placeholders for walletnotify to include relevant block information for transactions (Maayan Keshet)
Pull request description:
This patch includes two new format placeholders for walletnotify:
%b - the hash of the block containting the transaction (zeroed if a mempool transaction)
%h - the height of the block containing the transaction (zero if a mempool transaction)
I've included test suite changes to check and validate the above functional requirements as well as doc/help description changes.
**Motivation**
The walletnotify option is used to be notified of new transactions relevant to the wallet of the node.
A common usage pattern is to perform afterwards additional RPC calls to determine:
1. If this is a mempool transaction or not (i.e. are there any confirmations?)
2. What block was it included in?
3. Did this transaction was seen before and is now seen again because of a fork?
All of these questions can be answered with the current features, but the resulting RPC calls may be expensive in a heavily used node. As this information is readily available when calling the walletnotify callback, it makes sense to save expensive round trips by optionally sending this information at that point in time. I can definitely say we would like to use it in Fireblocks, my employer.
Please let me know of any questions and suggestions.
ACKs for top commit:
laanwj:
ACK 06e1fb0b17
Tree-SHA512: d2744e2a7a883f9c3a9fd32237110e048c4b6b11fea8221c33d10b74157f65bbc4351211f441e8c1a4af5d5d38e2ba6b1943a7673dc18860c0553d7b41e00775
argsman.AddArg("-walletbroadcast",strprintf("Make the wallet broadcast transactions (default: %u)",DEFAULT_WALLETBROADCAST),ArgsManager::ALLOW_ANY,OptionsCategory::WALLET);
argsman.AddArg("-walletdir=<dir>","Specify directory to hold wallets (default: <datadir>/wallets if it exists, otherwise <datadir>)",ArgsManager::ALLOW_ANY|ArgsManager::NETWORK_ONLY,OptionsCategory::WALLET);
#if HAVE_SYSTEM
argsman.AddArg("-walletnotify=<cmd>","Execute command when a wallet transaction changes. %s in cmd is replaced by TxID and %w is replaced by wallet name. %w is not currently implemented on windows. On systems where %w is supported, it should NOT be quoted because this would break shell escaping used to invoke the command.",ArgsManager::ALLOW_ANY,OptionsCategory::WALLET);
argsman.AddArg("-walletnotify=<cmd>","Execute command when a wallet transaction changes. %s in cmd is replaced by TxID, %w is replaced by wallet name, %b is replaced by the hash of the block including the transaction (set to 'unconfirmed' if the transaction is not included) and %h is replaced by the block height (-1 if not included). %w is not currently implemented on windows. On systems where %w is supported, it should NOT be quoted because this would break shell escaping used to invoke the command.",ArgsManager::ALLOW_ANY,OptionsCategory::WALLET);
#endif
argsman.AddArg("-walletrbf",strprintf("Send transactions with full-RBF opt-in enabled (RPC only, default: %u)",DEFAULT_WALLET_RBF),ArgsManager::ALLOW_ANY,OptionsCategory::WALLET);