diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 977f0233a23..7272ee51fba 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1108,7 +1108,7 @@ CWalletTx* CWallet::AddToWallet(CTransactionRef tx, const TxState& state, const #if HAVE_SYSTEM // notify an external script when a wallet transaction comes in or is updated - std::string strCmd = m_args.GetArg("-walletnotify", ""); + std::string strCmd = m_notify_tx_changed_script; if (!strCmd.empty()) { @@ -2915,6 +2915,7 @@ std::shared_ptr CWallet::Create(WalletContext& context, const std::stri // should be possible to use std::allocate_shared. std::shared_ptr walletInstance(new CWallet(chain, name, args, std::move(database)), ReleaseWallet); walletInstance->m_keypool_size = std::max(args.GetIntArg("-keypool", DEFAULT_KEYPOOL_SIZE), int64_t{1}); + walletInstance->m_notify_tx_changed_script = args.GetArg("-walletnotify", ""); // Load wallet bool rescan_required = false; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index a50c7eaa6ec..073c4910ff1 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -645,6 +645,9 @@ public: /** Number of pre-generated keys/scripts by each spkm (part of the look-ahead process, used to detect payments) */ int64_t m_keypool_size{DEFAULT_KEYPOOL_SIZE}; + /** Notify external script when a wallet transaction comes in or is updated (handled by -walletnotify) */ + std::string m_notify_tx_changed_script; + size_t KeypoolCountExternalKeys() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); bool TopUpKeyPool(unsigned int kpSize = 0);