wallet: set '-walletnotify' script instead of access global args manager

This commit is contained in:
furszy 2023-01-18 10:00:20 -03:00
parent 3477a28dd3
commit d8f5fc4462
No known key found for this signature in database
GPG key ID: 5DD23CCC686AA623
2 changed files with 5 additions and 1 deletions

View file

@ -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> CWallet::Create(WalletContext& context, const std::stri
// should be possible to use std::allocate_shared.
std::shared_ptr<CWallet> 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;

View file

@ -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);