Skip to content

Commit d8f5fc4

Browse files
committed
wallet: set '-walletnotify' script instead of access global args manager
1 parent 3477a28 commit d8f5fc4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/wallet/wallet.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ CWalletTx* CWallet::AddToWallet(CTransactionRef tx, const TxState& state, const
11081108

11091109
#if HAVE_SYSTEM
11101110
// notify an external script when a wallet transaction comes in or is updated
1111-
std::string strCmd = m_args.GetArg("-walletnotify", "");
1111+
std::string strCmd = m_notify_tx_changed_script;
11121112

11131113
if (!strCmd.empty())
11141114
{
@@ -2915,6 +2915,7 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
29152915
// should be possible to use std::allocate_shared.
29162916
std::shared_ptr<CWallet> walletInstance(new CWallet(chain, name, args, std::move(database)), ReleaseWallet);
29172917
walletInstance->m_keypool_size = std::max(args.GetIntArg("-keypool", DEFAULT_KEYPOOL_SIZE), int64_t{1});
2918+
walletInstance->m_notify_tx_changed_script = args.GetArg("-walletnotify", "");
29182919

29192920
// Load wallet
29202921
bool rescan_required = false;

src/wallet/wallet.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,9 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
645645
/** Number of pre-generated keys/scripts by each spkm (part of the look-ahead process, used to detect payments) */
646646
int64_t m_keypool_size{DEFAULT_KEYPOOL_SIZE};
647647

648+
/** Notify external script when a wallet transaction comes in or is updated (handled by -walletnotify) */
649+
std::string m_notify_tx_changed_script;
650+
648651
size_t KeypoolCountExternalKeys() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
649652
bool TopUpKeyPool(unsigned int kpSize = 0);
650653

0 commit comments

Comments
 (0)