Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.h
Show First 20 Lines • Show All 644 Lines • ▼ Show 20 Lines | template <typename Stream> void Unserialize(Stream &s) { | ||||
mapValue.erase("n"); | mapValue.erase("n"); | ||||
} | } | ||||
private: | private: | ||||
std::vector<char> _ssExtra; | std::vector<char> _ssExtra; | ||||
}; | }; | ||||
struct CoinEligibilityFilter { | |||||
const int conf_mine; | |||||
const int conf_theirs; | |||||
const uint64_t max_ancestors; | |||||
CoinEligibilityFilter(int conf_mine_, int conf_theirs_, | |||||
uint64_t max_ancestors_) | |||||
: conf_mine(conf_mine_), conf_theirs(conf_theirs_), | |||||
max_ancestors(max_ancestors_) {} | |||||
}; | |||||
// forward declarations for ScanForWalletTransactions/RescanFromTime | // forward declarations for ScanForWalletTransactions/RescanFromTime | ||||
class WalletRescanReserver; | class WalletRescanReserver; | ||||
/** | /** | ||||
* A CWallet is an extension of a keystore, which also maintains a set of | * A CWallet is an extension of a keystore, which also maintains a set of | ||||
* transactions and balances, and provides the ability to create new | * transactions and balances, and provides the ability to create new | ||||
* transactions. | * transactions. | ||||
*/ | */ | ||||
class CWallet final : public CCryptoKeyStore, public CValidationInterface { | class CWallet final : public CCryptoKeyStore, public CValidationInterface { | ||||
private: | private: | ||||
static std::atomic<bool> fFlushScheduled; | static std::atomic<bool> fFlushScheduled; | ||||
▲ Show 20 Lines • Show All 210 Lines • ▼ Show 20 Lines | const CTxOut &FindNonChangeParentOutput(const CTransaction &tx, | ||||
int output) const; | int output) const; | ||||
/** | /** | ||||
* Shuffle and select coins until nTargetValue is reached while avoiding | * Shuffle and select coins until nTargetValue is reached while avoiding | ||||
* small change; This method is stochastic for some inputs and upon | * small change; This method is stochastic for some inputs and upon | ||||
* completion the coin set and corresponding actual target value is | * completion the coin set and corresponding actual target value is | ||||
* assembled. | * assembled. | ||||
*/ | */ | ||||
bool SelectCoinsMinConf(const Amount nTargetValue, int nConfMine, | bool SelectCoinsMinConf(const Amount nTargetValue, | ||||
int nConfTheirs, uint64_t nMaxAncestors, | const CoinEligibilityFilter &eligibilty_filter, | ||||
std::vector<COutput> vCoins, | std::vector<COutput> vCoins, | ||||
std::set<CInputCoin> &setCoinsRet, | std::set<CInputCoin> &setCoinsRet, | ||||
Amount &nValueRet) const; | Amount &nValueRet) const; | ||||
bool IsSpent(const TxId &txid, uint32_t n) const; | bool IsSpent(const TxId &txid, uint32_t n) const; | ||||
bool IsLockedCoin(const TxId &txid, uint32_t n) const; | bool IsLockedCoin(const TxId &txid, uint32_t n) const; | ||||
void LockCoin(const COutPoint &output); | void LockCoin(const COutPoint &output); | ||||
▲ Show 20 Lines • Show All 366 Lines • ▼ Show 20 Lines | public: | ||||
* Get a destination of the requested type (if possible) to the specified | * Get a destination of the requested type (if possible) to the specified | ||||
* script. This function will automatically add the necessary scripts to the | * script. This function will automatically add the necessary scripts to the | ||||
* wallet. | * wallet. | ||||
*/ | */ | ||||
CTxDestination AddAndGetDestinationForScript(const CScript &script, | CTxDestination AddAndGetDestinationForScript(const CScript &script, | ||||
OutputType); | OutputType); | ||||
/** Whether a given output is spendable by this wallet */ | /** Whether a given output is spendable by this wallet */ | ||||
bool OutputEligibleForSpending(const COutput &output, const int nConfMine, | bool OutputEligibleForSpending( | ||||
const int nConfTheirs, | const COutput &output, | ||||
const uint64_t nMaxAncestors) const; | const CoinEligibilityFilter &eligibilty_filter) const; | ||||
}; | }; | ||||
/** A key allocated from the key pool. */ | /** A key allocated from the key pool. */ | ||||
class CReserveKey final : public CReserveScript { | class CReserveKey final : public CReserveScript { | ||||
protected: | protected: | ||||
CWallet *pwallet; | CWallet *pwallet; | ||||
int64_t nIndex; | int64_t nIndex; | ||||
CPubKey vchPubKey; | CPubKey vchPubKey; | ||||
▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines |