diff options
author | Maayan Keshet <maayan@maayank.com> | 2021-03-15 16:26:05 +0200 |
---|---|---|
committer | Maayan Keshet <maayan@maayank.com> | 2021-03-15 18:45:36 +0200 |
commit | 06e1fb0b170a69996a7ce1ef5203785a7bc6b278 (patch) | |
tree | ea7b64dd9b7ea8adaab9536c21a939cabadab1d2 /src/wallet/wallet.cpp | |
parent | c771fc0dc1bcb48fc6aa77b61c1ff31742ac8bb7 (diff) | |
download | bitcoin-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.cpp | 8 |
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: |