src/wallet.cpp
// Add a transaction to the wallet, or update it.
// pblock is optional, but should be provided if the transaction is known to be in a block.
// If fUpdate is true, existing transactions will be updated.
Add a transaction to the wallet, or update it.
pblock is optional, but should be provided if the transaction is known to be in a block.
If fUpdate is true, existing transactions will be updated.
Add a transaction to the wallet or update it . pblock is optional but should be provided if the transaction is known to be in a block . If fUpdate is true existing transactions will be updated .
bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pblock, bool fUpdate, bool fFindBlock)
{
    uint256 hash = tx.GetHash();
    {
        LOCK(cs_wallet);
        bool fExisted = mapWallet.count(hash);
        if (fExisted && !fUpdate)
            return false;
        if (fExisted || IsMine(tx) || IsFromMe(tx))
        {
            CWalletTx wtx(this, tx);
            if (pblock)
                wtx.SetMerkleBranch(pblock);
            return AddToWallet(wtx);
        }
        else
            WalletUpdateSpent(tx);
    }
    return false;
}
bool CWallet :: AddToWalletIfInvolvingMe ( const CTransaction & tx , const CBlock * pblock , bool fUpdate , bool fFindBlock ) { uint256 hash = tx . GetHash ( ) ; { LOCK ( cs_wallet ) ; bool fExisted = mapWallet . count ( hash ) ; if ( fExisted && ! fUpdate ) return false ; if ( fExisted || IsMine ( tx ) || IsFromMe ( tx ) ) { CWalletTx wtx ( this , tx ) ; if ( pblock ) wtx . SetMerkleBranch ( pblock ) ; return AddToWallet ( wtx ) ; } else WalletUpdateSpent ( tx ) ; } return false ; }
Add a transaction to the wallet, or update it.
Add a transaction to the wallet or update it .
// Get merkle branch if transaction was found in a block