Bitcoin
Functions
Actions

Functions

static bool IsCurrentForAntiFeeSniping (interfaces::Chain &chain, interfaces::Chain::Lock &locked_chain)
 
static uint32_t GetLocktimeForNewTransaction (interfaces::Chain &chain, interfaces::Chain::Lock &locked_chain)
 
static int64_t GetOldestKeyTimeInPool (const std::set< int64_t > &setKeyPool, WalletBatch &batch)
 
Balance CWallet::GetBalance (int min_depth=0, bool avoid_reuse=true) const
 
CAmount CWallet::GetAvailableBalance (const CCoinControl *coinControl=nullptr) const
 
void CWallet::AvailableCoins (interfaces::Chain::Lock &locked_chain, std::vector< COutput > &vCoins, bool fOnlySafe=true, const CCoinControl *coinControl=nullptr, const CAmount &nMinimumAmount=1, const CAmount &nMaximumAmount=MAX_MONEY, const CAmount &nMinimumSumAmount=MAX_MONEY, const uint64_t nMaximumCount=0, const int nMinDepth=0, const int nMaxDepth=9999999) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
std::map< CTxDestination, std::vector< COutput > > CWallet::ListCoins (interfaces::Chain::Lock &locked_chain) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
const CTxOutCWallet::FindNonChangeParentOutput (const CTransaction &tx, int output) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
bool CWallet::SelectCoinsMinConf (const CAmount &nTargetValue, const CoinEligibilityFilter &eligibility_filter, std::vector< OutputGroup > groups, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet, const CoinSelectionParams &coin_selection_params, bool &bnb_used) const
 
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)
 
bool CWallet::SignTransaction (CMutableTransaction &tx) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
bool CWallet::FundTransaction (CMutableTransaction &tx, CAmount &nFeeRet, int &nChangePosInOut, std::string &strFailReason, bool lockUnspents, const std::set< int > &setSubtractFeeFromOutputs, CCoinControl)
 
OutputType CWallet::TransactionChangeType (OutputType change_type, const std::vector< CRecipient > &vecSend)
 
bool CWallet::CreateTransaction (interfaces::Chain::Lock &locked_chain, const std::vector< CRecipient > &vecSend, CTransactionRef &tx, ReserveDestination &reservedest, CAmount &nFeeRet, int &nChangePosInOut, std::string &strFailReason, const CCoinControl &coin_control, bool sign=true)
 
bool CWallet::CommitTransaction (CTransactionRef tx, mapValue_t mapValue, std::vector< std::pair< std::string, std::string >> orderForm, ReserveDestination &reservedest, CValidationState &state)
 
DBErrors CWallet::LoadWallet (bool &fFirstRunRet)
 
DBErrors CWallet::ZapSelectTx (std::vector< uint256 > &vHashIn, std::vector< uint256 > &vHashOut) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
DBErrors CWallet::ZapWalletTx (std::vector< CWalletTx > &vWtx)
 
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)
 
const std::string & CWallet::GetLabelName (const CScript &scriptPubKey) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
bool CWallet::NewKeyPool ()
 
size_t CWallet::KeypoolCountExternalKeys () EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
void CWallet::LoadKeyPool (int64_t nIndex, const CKeyPool &keypool) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
bool CWallet::TopUpKeyPool (unsigned int kpSize=0)
 
void CWallet::AddKeypoolPubkeyWithDB (const CPubKey &pubkey, const bool internal, WalletBatch &batch)
 
bool CWallet::ReserveKeyFromKeyPool (int64_t &nIndex, CKeyPool &keypool, bool fRequestedInternal)
 
void CWallet::KeepKey (int64_t nIndex)
 
void CWallet::ReturnKey (int64_t nIndex, bool fInternal, const CPubKey &pubkey)
 
bool CWallet::GetKeyFromPool (CPubKey &key, bool internal=false)
 Fetches a key from the keypool. More...
 
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 ()
 
std::map< CTxDestination, CAmountCWallet::GetAddressBalances (interfaces::Chain::Lock &locked_chain)
 
std::set< std::set< CTxDestination > > CWallet::GetAddressGroupings () EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
std::set< CTxDestinationCWallet::GetLabelAddresses (const std::string &label) const
 
bool ReserveDestination::GetReservedDestination (const OutputType type, 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...
 
void CWallet::MarkReserveKeysAsUsed (int64_t keypool_id) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
 
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

◆ AddKeypoolPubkeyWithDB()

void CWallet::AddKeypoolPubkeyWithDB ( const CPubKey pubkey,
const bool  internal,
WalletBatch batch 
)
private

◆ AvailableCoins()

void CWallet::AvailableCoins ( interfaces::Chain::Lock locked_chain,
std::vector< COutput > &  vCoins,
bool  fOnlySafe = true,
const CCoinControl coinControl = nullptr,
const CAmount nMinimumAmount = 1,
const CAmount nMaximumAmount = MAX_MONEY,
const CAmount nMinimumSumAmount = MAX_MONEY,
const uint64_t  nMaximumCount = 0,
const int  nMinDepth = 0,
const int  nMaxDepth = 9999999 
) const

populate vCoins with vector of available COutputs.

◆ CommitTransaction()

bool CWallet::CommitTransaction ( CTransactionRef  tx,
mapValue_t  mapValue,
std::vector< std::pair< std::string, std::string >>  orderForm,
ReserveDestination reservedest,
CValidationState state 
)

Call after CreateTransaction unless you want to abort

◆ CreateTransaction()

bool CWallet::CreateTransaction ( interfaces::Chain::Lock locked_chain,
const std::vector< CRecipient > &  vecSend,
CTransactionRef tx,
ReserveDestination reservedest,
CAmount nFeeRet,
int &  nChangePosInOut,
std::string &  strFailReason,
const CCoinControl coin_control,
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

◆ DelAddressBook()

bool CWallet::DelAddressBook ( const CTxDestination address)

◆ FindNonChangeParentOutput()

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

Find non-change parent output.

◆ FundTransaction()

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

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

◆ GetAddressBalances()

std::map< CTxDestination, CAmount > CWallet::GetAddressBalances ( interfaces::Chain::Lock locked_chain)

◆ GetAddressGroupings()

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

◆ GetAvailableBalance()

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

◆ GetBalance()

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

◆ GetKeyFromPool()

bool CWallet::GetKeyFromPool ( CPubKey key,
bool  internal = false 
)
private

Fetches a key from the keypool.

◆ GetLabelAddresses()

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

◆ GetLabelName()

const std::string & CWallet::GetLabelName ( const CScript scriptPubKey) const

◆ GetLocktimeForNewTransaction()

static uint32_t GetLocktimeForNewTransaction ( interfaces::Chain chain,
interfaces::Chain::Lock locked_chain 
)
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

◆ GetNewChangeDestination()

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

◆ GetNewDestination()

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

◆ GetOldestKeyPoolTime()

int64_t CWallet::GetOldestKeyPoolTime ( )

◆ GetOldestKeyTimeInPool()

static int64_t GetOldestKeyTimeInPool ( const std::set< int64_t > &  setKeyPool,
WalletBatch batch 
)
static

◆ GetReservedDestination()

bool ReserveDestination::GetReservedDestination ( const OutputType  type,
CTxDestination pubkey,
bool  internal 
)

Reserve an address.

◆ IsCurrentForAntiFeeSniping()

static bool IsCurrentForAntiFeeSniping ( interfaces::Chain chain,
interfaces::Chain::Lock locked_chain 
)
static

◆ IsLockedCoin()

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

◆ KeepDestination()

void ReserveDestination::KeepDestination ( )

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

◆ KeepKey()

void CWallet::KeepKey ( int64_t  nIndex)

◆ KeypoolCountExternalKeys()

size_t CWallet::KeypoolCountExternalKeys ( )

◆ ListCoins()

std::map< CTxDestination, std::vector< COutput > > CWallet::ListCoins ( interfaces::Chain::Lock locked_chain) const

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

◆ ListLockedCoins()

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

◆ LoadKeyPool()

void CWallet::LoadKeyPool ( int64_t  nIndex,
const CKeyPool keypool 
)

◆ LoadWallet()

DBErrors CWallet::LoadWallet ( bool &  fFirstRunRet)

◆ LockCoin()

void CWallet::LockCoin ( const COutPoint output)

◆ MarkReserveKeysAsUsed()

void CWallet::MarkReserveKeysAsUsed ( int64_t  keypool_id)

Marks all keys in the keypool up to and including reserve_key as used.

◆ NewKeyPool()

bool CWallet::NewKeyPool ( )

Mark old keypool keys as used, and generate all new keys

◆ ReserveKeyFromKeyPool()

bool CWallet::ReserveKeyFromKeyPool ( int64_t nIndex,
CKeyPool keypool,
bool  fRequestedInternal 
)

Reserves a key from the keypool and sets nIndex to its index

Parameters
[out]nIndexthe index of the key in keypool
[out]keypoolthe keypool the key was drawn from, which could be the the pre-split pool if present, or the internal or external pool
fRequestedInternaltrue if the caller would like the key drawn from the internal keypool, false if external is preferred
Returns
true if succeeded, false if failed due to empty keypool
Exceptions
std::runtime_errorif keypool read failed, key was invalid, was not found in the wallet, or was misclassified in the internal or external keypool

◆ ReturnDestination()

void ReserveDestination::ReturnDestination ( )

Return reserved address.

◆ ReturnKey()

void CWallet::ReturnKey ( int64_t  nIndex,
bool  fInternal,
const CPubKey pubkey 
)

◆ 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 coinControl are selected; Never select unconfirmed coins if they are not ours

◆ SelectCoinsMinConf()

bool CWallet::SelectCoinsMinConf ( const CAmount nTargetValue,
const CoinEligibilityFilter eligibility_filter,
std::vector< OutputGroup groups,
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

◆ SetAddressBook()

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

◆ SetAddressBookWithDB()

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

◆ SignTransaction()

bool CWallet::SignTransaction ( CMutableTransaction tx)

◆ TopUpKeyPool()

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

◆ TransactionChangeType()

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

◆ UnlockAllCoins()

void CWallet::UnlockAllCoins ( )

◆ UnlockCoin()

void CWallet::UnlockCoin ( const COutPoint output)

◆ ZapSelectTx()

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

◆ ZapWalletTx()

DBErrors CWallet::ZapWalletTx ( std::vector< CWalletTx > &  vWtx)