Bitcoin Core  21.99.0
P2P Digital Currency
Functions
Actions

Functions

static bool IsCurrentForAntiFeeSniping (interfaces::Chain &chain, const uint256 &block_hash)
 
static uint32_t GetLocktimeForNewTransaction (interfaces::Chain &chain, const uint256 &block_hash, int block_height)
 Return a height-based locktime for new transactions (uses the height of the current chain tip unless we are not synced with the current chain. More...
 
Balance CWallet::GetBalance (int min_depth=0, bool avoid_reuse=true) const
 
CAmount CWallet::GetAvailableBalance (const CCoinControl *coinControl=nullptr) const
 
void CWallet::AvailableCoins (std::vector< COutput > &vCoins, const CCoinControl *coinControl=nullptr, const CAmount &nMinimumAmount=1, const CAmount &nMaximumAmount=MAX_MONEY, const CAmount &nMinimumSumAmount=MAX_MONEY, const uint64_t nMaximumCount=0) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 populate vCoins with vector of available COutputs. More...
 
std::map< CTxDestination, std::vector< COutput > > CWallet::ListCoins () const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 Return list of available coins and locked coins grouped by non-change output address. More...
 
const CTxOutCWallet::FindNonChangeParentOutput (const CTransaction &tx, int output) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 Find non-change parent output. More...
 
bool CWallet::SelectCoinsMinConf (const CAmount &nTargetValue, const CoinEligibilityFilter &eligibility_filter, std::vector< COutput > coins, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet, const CoinSelectionParams &coin_selection_params, bool &bnb_used) const
 Shuffle and select coins until nTargetValue is reached while avoiding small change; This method is stochastic for some inputs and upon completion the coin set and corresponding actual target value is assembled param@[in] coins Set of UTXOs to consider. More...
 
bool CWallet::SelectCoins (const std::vector< COutput > &vAvailableCoins, const CAmount &nTargetValue, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet, const CCoinControl &coin_control, CoinSelectionParams &coin_selection_params, bool &bnb_used) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 Select a set of coins such that nValueRet >= nTargetValue and at least all coins from coin_control are selected; never select unconfirmed coins if they are not ours param@[out] setCoinsRet Populated with inputs including pre-selected inputs from coin_control and Coin Selection if successful. More...
 
bool CWallet::SignTransaction (CMutableTransaction &tx) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 Fetch the inputs and sign with SIGHASH_ALL. More...
 
bool CWallet::SignTransaction (CMutableTransaction &tx, const std::map< COutPoint, Coin > &coins, int sighash, std::map< int, std::string > &input_errors) const
 Sign the tx given the input coins and sighash. More...
 
TransactionError CWallet::FillPSBT (PartiallySignedTransaction &psbtx, bool &complete, int sighash_type=1, bool sign=true, bool bip32derivs=true, size_t *n_signed=nullptr) const
 Fills out a PSBT with information from the wallet. More...
 
SigningResult CWallet::SignMessage (const std::string &message, const PKHash &pkhash, std::string &str_sig) const
 
bool CWallet::FundTransaction (CMutableTransaction &tx, CAmount &nFeeRet, int &nChangePosInOut, bilingual_str &error, bool lockUnspents, const std::set< int > &setSubtractFeeFromOutputs, CCoinControl)
 Insert additional inputs into the transaction by calling CreateTransaction();. More...
 
OutputType CWallet::TransactionChangeType (const std::optional< OutputType > &change_type, const std::vector< CRecipient > &vecSend) const
 
bool CWallet::CreateTransactionInternal (const std::vector< CRecipient > &vecSend, CTransactionRef &tx, CAmount &nFeeRet, int &nChangePosInOut, bilingual_str &error, const CCoinControl &coin_control, FeeCalculation &fee_calc_out, bool sign)
 
bool CWallet::CreateTransaction (const std::vector< CRecipient > &vecSend, CTransactionRef &tx, CAmount &nFeeRet, int &nChangePosInOut, bilingual_str &error, const CCoinControl &coin_control, FeeCalculation &fee_calc_out, bool sign=true)
 Create a new transaction paying the recipients with a set of coins selected by SelectCoins(); Also create the change output, when needed. More...
 
void CWallet::CommitTransaction (CTransactionRef tx, mapValue_t mapValue, std::vector< std::pair< std::string, std::string >> orderForm)
 Submit the transaction to the node's mempool and then relay to peers. More...
 
DBErrors CWallet::LoadWallet (bool &fFirstRunRet)
 
DBErrors CWallet::ZapSelectTx (std::vector< uint256 > &vHashIn, std::vector< uint256 > &vHashOut) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
bool CWallet::SetAddressBookWithDB (WalletBatch &batch, const CTxDestination &address, const std::string &strName, const std::string &strPurpose)
 
bool CWallet::SetAddressBook (const CTxDestination &address, const std::string &strName, const std::string &purpose)
 
bool CWallet::DelAddressBook (const CTxDestination &address)
 
size_t CWallet::KeypoolCountExternalKeys () const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
unsigned int CWallet::GetKeyPoolSize () const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
bool CWallet::TopUpKeyPool (unsigned int kpSize=0)
 
bool CWallet::GetNewDestination (const OutputType type, const std::string label, CTxDestination &dest, std::string &error)
 
bool CWallet::GetNewChangeDestination (const OutputType type, CTxDestination &dest, std::string &error)
 
int64_t CWallet::GetOldestKeyPoolTime () const
 
void CWallet::MarkDestinationsDirty (const std::set< CTxDestination > &destinations) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 Marks all outputs in each one of the destinations dirty, so their cache is reset and does not return outdated information. More...
 
std::map< CTxDestination, CAmountCWallet::GetAddressBalances () const
 
std::set< std::set< CTxDestination > > CWallet::GetAddressGroupings () const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
std::set< CTxDestinationCWallet::GetLabelAddresses (const std::string &label) const
 
bool ReserveDestination::GetReservedDestination (CTxDestination &pubkey, bool internal)
 Reserve an address. More...
 
void ReserveDestination::KeepDestination ()
 Keep the address. Do not return it's key to the keypool when this object goes out of scope. More...
 
void ReserveDestination::ReturnDestination ()
 Return reserved address. More...
 
bool CWallet::DisplayAddress (const CTxDestination &dest) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 Display address on an external signer. More...
 
void CWallet::LockCoin (const COutPoint &output) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
void CWallet::UnlockCoin (const COutPoint &output) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
void CWallet::UnlockAllCoins () EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
bool CWallet::IsLockedCoin (uint256 hash, unsigned int n) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
void CWallet::ListLockedCoins (std::vector< COutPoint > &vOutpts) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 

Detailed Description

Function Documentation

◆ AvailableCoins()

void CWallet::AvailableCoins ( std::vector< COutput > &  vCoins,
const CCoinControl coinControl = nullptr,
const CAmount nMinimumAmount = 1,
const CAmount nMaximumAmount = MAX_MONEY,
const CAmount nMinimumSumAmount = MAX_MONEY,
const uint64_t  nMaximumCount = 0 
) const

populate vCoins with vector of available COutputs.

Definition at line 2209 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CommitTransaction()

void CWallet::CommitTransaction ( CTransactionRef  tx,
mapValue_t  mapValue,
std::vector< std::pair< std::string, std::string >>  orderForm 
)

Submit the transaction to the node's mempool and then relay to peers.

Should be called after CreateTransaction unless you want to abort broadcasting the transaction.

Parameters
[in]txThe transaction to be broadcast.
[in]mapValuekey-values to be set on the transaction.
[in]orderFormBIP 70 / BIP 21 order form details to be set on the transaction.

Definition at line 3210 of file wallet.cpp.

Here is the call graph for this function:

◆ CreateTransaction()

bool CWallet::CreateTransaction ( const std::vector< CRecipient > &  vecSend,
CTransactionRef tx,
CAmount nFeeRet,
int &  nChangePosInOut,
bilingual_str error,
const CCoinControl coin_control,
FeeCalculation fee_calc_out,
bool  sign = true 
)

Create a new transaction paying the recipients with a set of coins selected by SelectCoins(); Also create the change output, when needed.

Note
passing nChangePosInOut as -1 will result in setting a random position

Definition at line 3175 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateTransactionInternal()

bool CWallet::CreateTransactionInternal ( const std::vector< CRecipient > &  vecSend,
CTransactionRef tx,
CAmount nFeeRet,
int &  nChangePosInOut,
bilingual_str error,
const CCoinControl coin_control,
FeeCalculation fee_calc_out,
bool  sign 
)
private

Definition at line 2803 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DelAddressBook()

bool CWallet::DelAddressBook ( const CTxDestination address)

Definition at line 3336 of file wallet.cpp.

Here is the call graph for this function:

◆ DisplayAddress()

bool CWallet::DisplayAddress ( const CTxDestination dest)

Display address on an external signer.

Returns false if external signer support is not compiled

Definition at line 3642 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FillPSBT()

TransactionError CWallet::FillPSBT ( PartiallySignedTransaction psbtx,
bool &  complete,
int  sighash_type = 1,
bool  sign = true,
bool  bip32derivs = true,
size_t *  n_signed = nullptr 
) const

Fills out a PSBT with information from the wallet.

Fills in UTXOs if we have them. Tries to sign if sign=true. Sets complete if the PSBT is now complete (i.e. has all required signatures or signature-parts, and is ready to finalize.) Sets error and returns false if something goes wrong.

Parameters
[in]psbtxPartiallySignedTransaction to fill in
[out]completeindicates whether the PSBT is now complete
[in]sighash_typethe sighash type to use when signing (if PSBT does not specify)
[in]signwhether to sign or not
[in]bip32derivswhether to fill in bip32 derivation information if available return error

Definition at line 2601 of file wallet.cpp.

Here is the call graph for this function:

◆ FindNonChangeParentOutput()

const CTxOut & CWallet::FindNonChangeParentOutput ( const CTransaction tx,
int  output 
) const

Find non-change parent output.

Definition at line 2378 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FundTransaction()

bool CWallet::FundTransaction ( CMutableTransaction tx,
CAmount nFeeRet,
int &  nChangePosInOut,
bilingual_str error,
bool  lockUnspents,
const std::set< int > &  setSubtractFeeFromOutputs,
CCoinControl  coinControl 
)

Insert additional inputs into the transaction by calling CreateTransaction();.

Definition at line 2663 of file wallet.cpp.

Here is the call graph for this function:

◆ GetAddressBalances()

std::map< CTxDestination, CAmount > CWallet::GetAddressBalances ( ) const

Definition at line 3456 of file wallet.cpp.

Here is the call graph for this function:

◆ GetAddressGroupings()

std::set< std::set< CTxDestination > > CWallet::GetAddressGroupings ( ) const

Definition at line 3494 of file wallet.cpp.

Here is the call graph for this function:

◆ GetAvailableBalance()

CAmount CWallet::GetAvailableBalance ( const CCoinControl coinControl = nullptr) const

Definition at line 2194 of file wallet.cpp.

Here is the call graph for this function:

◆ GetBalance()

CWallet::Balance CWallet::GetBalance ( int  min_depth = 0,
bool  avoid_reuse = true 
) const

Definition at line 2165 of file wallet.cpp.

Here is the call graph for this function:

◆ GetKeyPoolSize()

unsigned int CWallet::GetKeyPoolSize ( ) const

Definition at line 3377 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetLabelAddresses()

std::set< CTxDestination > CWallet::GetLabelAddresses ( const std::string &  label) const

Definition at line 3587 of file wallet.cpp.

◆ GetLocktimeForNewTransaction()

static uint32_t GetLocktimeForNewTransaction ( interfaces::Chain chain,
const uint256 block_hash,
int  block_height 
)
static

Return a height-based locktime for new transactions (uses the height of the current chain tip unless we are not synced with the current chain.

Definition at line 2733 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNewChangeDestination()

bool CWallet::GetNewChangeDestination ( const OutputType  type,
CTxDestination dest,
std::string &  error 
)

Definition at line 3417 of file wallet.cpp.

Here is the call graph for this function:

◆ GetNewDestination()

bool CWallet::GetNewDestination ( const OutputType  type,
const std::string  label,
CTxDestination dest,
std::string &  error 
)

Definition at line 3398 of file wallet.cpp.

Here is the call graph for this function:

◆ GetOldestKeyPoolTime()

int64_t CWallet::GetOldestKeyPoolTime ( ) const

Definition at line 3432 of file wallet.cpp.

◆ GetReservedDestination()

bool ReserveDestination::GetReservedDestination ( CTxDestination pubkey,
bool  internal 
)

Reserve an address.

Definition at line 3602 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsCurrentForAntiFeeSniping()

static bool IsCurrentForAntiFeeSniping ( interfaces::Chain chain,
const uint256 block_hash 
)
static

Definition at line 2715 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsLockedCoin()

bool CWallet::IsLockedCoin ( uint256  hash,
unsigned int  n 
) const

Definition at line 3679 of file wallet.cpp.

Here is the caller graph for this function:

◆ KeepDestination()

void ReserveDestination::KeepDestination ( )

Keep the address. Do not return it's key to the keypool when this object goes out of scope.

Definition at line 3624 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ KeypoolCountExternalKeys()

size_t CWallet::KeypoolCountExternalKeys ( ) const

Definition at line 3365 of file wallet.cpp.

Here is the call graph for this function:

◆ ListCoins()

std::map< CTxDestination, std::vector< COutput > > CWallet::ListCoins ( ) const

Return list of available coins and locked coins grouped by non-change output address.

Definition at line 2337 of file wallet.cpp.

Here is the call graph for this function:

◆ ListLockedCoins()

void CWallet::ListLockedCoins ( std::vector< COutPoint > &  vOutpts) const

Definition at line 3687 of file wallet.cpp.

Here is the caller graph for this function:

◆ LoadWallet()

DBErrors CWallet::LoadWallet ( bool &  fFirstRunRet)

Definition at line 3250 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LockCoin()

void CWallet::LockCoin ( const COutPoint output)

Definition at line 3661 of file wallet.cpp.

Here is the caller graph for this function:

◆ MarkDestinationsDirty()

void CWallet::MarkDestinationsDirty ( const std::set< CTxDestination > &  destinations)

Marks all outputs in each one of the destinations dirty, so their cache is reset and does not return outdated information.

Definition at line 3442 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReturnDestination()

void ReserveDestination::ReturnDestination ( )

Return reserved address.

Definition at line 3633 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SelectCoins()

bool CWallet::SelectCoins ( const std::vector< COutput > &  vAvailableCoins,
const CAmount nTargetValue,
std::set< CInputCoin > &  setCoinsRet,
CAmount nValueRet,
const CCoinControl coin_control,
CoinSelectionParams coin_selection_params,
bool &  bnb_used 
) const

Select a set of coins such that nValueRet >= nTargetValue and at least all coins from coin_control are selected; never select unconfirmed coins if they are not ours param@[out] setCoinsRet Populated with inputs including pre-selected inputs from coin_control and Coin Selection if successful.

param@[out] nValueRet Total value of selected coins including pre-selected ones from coin_control and Coin Selection if successful.

Definition at line 2427 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SelectCoinsMinConf()

bool CWallet::SelectCoinsMinConf ( const CAmount nTargetValue,
const CoinEligibilityFilter eligibility_filter,
std::vector< COutput coins,
std::set< CInputCoin > &  setCoinsRet,
CAmount nValueRet,
const CoinSelectionParams coin_selection_params,
bool &  bnb_used 
) const

Shuffle and select coins until nTargetValue is reached while avoiding small change; This method is stochastic for some inputs and upon completion the coin set and corresponding actual target value is assembled param@[in] coins Set of UTXOs to consider.

These will be categorized into OutputGroups and filtered using eligibility_filter before selecting coins. param@[out] setCoinsRet Populated with the coins selected if successful. param@[out] nValueRet Used to return the total value of selected coins.

Definition at line 2396 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetAddressBook()

bool CWallet::SetAddressBook ( const CTxDestination address,
const std::string &  strName,
const std::string &  purpose 
)

Definition at line 3330 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetAddressBookWithDB()

bool CWallet::SetAddressBookWithDB ( WalletBatch batch,
const CTxDestination address,
const std::string &  strName,
const std::string &  strPurpose 
)
private

Definition at line 3310 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SignMessage()

SigningResult CWallet::SignMessage ( const std::string &  message,
const PKHash pkhash,
std::string &  str_sig 
) const

Definition at line 2651 of file wallet.cpp.

Here is the call graph for this function:

◆ SignTransaction() [1/2]

bool CWallet::SignTransaction ( CMutableTransaction tx) const

Fetch the inputs and sign with SIGHASH_ALL.

Definition at line 2568 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SignTransaction() [2/2]

bool CWallet::SignTransaction ( CMutableTransaction tx,
const std::map< COutPoint, Coin > &  coins,
int  sighash,
std::map< int, std::string > &  input_errors 
) const

Sign the tx given the input coins and sighash.

Definition at line 2586 of file wallet.cpp.

Here is the call graph for this function:

◆ TopUpKeyPool()

bool CWallet::TopUpKeyPool ( unsigned int  kpSize = 0)

Definition at line 3388 of file wallet.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TransactionChangeType()

OutputType CWallet::TransactionChangeType ( const std::optional< OutputType > &  change_type,
const std::vector< CRecipient > &  vecSend 
) const

Definition at line 2775 of file wallet.cpp.

Here is the caller graph for this function:

◆ UnlockAllCoins()

void CWallet::UnlockAllCoins ( )

Definition at line 3673 of file wallet.cpp.

◆ UnlockCoin()

void CWallet::UnlockCoin ( const COutPoint output)

Definition at line 3667 of file wallet.cpp.

◆ ZapSelectTx()

DBErrors CWallet::ZapSelectTx ( std::vector< uint256 > &  vHashIn,
std::vector< uint256 > &  vHashOut 
)

Definition at line 3279 of file wallet.cpp.

Here is the call graph for this function: