aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorMaayan Keshet <maayan@maayank.com>2021-03-15 16:26:05 +0200
committerMaayan Keshet <maayan@maayank.com>2021-03-15 18:45:36 +0200
commit06e1fb0b170a69996a7ce1ef5203785a7bc6b278 (patch)
treeea7b64dd9b7ea8adaab9536c21a939cabadab1d2 /src/wallet/wallet.cpp
parentc771fc0dc1bcb48fc6aa77b61c1ff31742ac8bb7 (diff)
downloadbitcoin-06e1fb0b170a69996a7ce1ef5203785a7bc6b278.tar.xz
Add new format string placeholders for walletnotify to include relevant block information for transactions
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 58ab124061..ac1b2a4c0a 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -944,6 +944,14 @@ CWalletTx* CWallet::AddToWallet(CTransactionRef tx, const CWalletTx::Confirmatio
if (!strCmd.empty())
{
boost::replace_all(strCmd, "%s", hash.GetHex());
+ if (confirm.status == CWalletTx::Status::CONFIRMED)
+ {
+ boost::replace_all(strCmd, "%b", confirm.hashBlock.GetHex());
+ boost::replace_all(strCmd, "%h", ToString(confirm.block_height));
+ } else {
+ boost::replace_all(strCmd, "%b", "unconfirmed");
+ boost::replace_all(strCmd, "%h", "-1");
+ }
#ifndef WIN32
// Substituting the wallet name isn't currently supported on windows
// because windows shell escaping has not been implemented yet: