wallet::CWallet::AddToWallet

Add the transaction to the wallet, wrapping it up inside a CWalletTx

Synopsis

Declared in <wallet/wallet.h>

CWalletTx*
AddToWallet(
    CTransactionRef tx,
    TxState const& state,
    UpdateWalletTxFn const& update_wtx = nullptr,
    bool rescanning_old_block = false);

Return Value

the recently added wtx pointer or nullptr if there was a db write error.

Parameters

NameDescription
txthe transaction to add
statethe chain state (block or mempool) in which the transaction was seen
update_wtxoptional callback to update the wallet transaction metadata
rescanning_old_blocktrue if the transaction was found during a rescan of old blocks