diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2017-02-23 11:20:16 -0500 |
---|---|---|
committer | NicolasDorier <nicolas.dorier@gmail.com> | 2017-03-10 05:11:10 +0000 |
commit | af61d9f78bec62ff3688d88409a53df9ff5bc591 (patch) | |
tree | 4d808ec76cd86bbeaeab7473a6527b9d8aeacfaf /src/wallet/wallet.h | |
parent | 8910b4717e5bb946ee6988f7fe9fd461f53a5935 (diff) | |
download | bitcoin-af61d9f78bec62ff3688d88409a53df9ff5bc591.tar.xz |
Add COutput::fSafe member for safe handling of unconfirmed outputs
This exposes a value computed in CWallet::AvailableCoins so it can used for
other things, like inclusion in listunspent output.
Diffstat (limited to 'src/wallet/wallet.h')
-rw-r--r-- | src/wallet/wallet.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index cae92a0b09..80201e8ce0 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -466,12 +466,23 @@ public: const CWalletTx *tx; int i; int nDepth; + + /** Whether we have the private keys to spend this output */ bool fSpendable; + + /** Whether we know how to spend this output, ignoring the lack of keys */ bool fSolvable; - COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn, bool fSolvableIn) + /** + * Whether this output is considered safe to spend. Unconfirmed transactions + * from outside keys and unconfirmed replacement transactions are considered + * unsafe and will not be used to fund new spending transactions. + */ + bool fSafe; + + COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn, bool fSolvableIn, bool fSafeIn) { - tx = txIn; i = iIn; nDepth = nDepthIn; fSpendable = fSpendableIn; fSolvable = fSolvableIn; + tx = txIn; i = iIn; nDepth = nDepthIn; fSpendable = fSpendableIn; fSolvable = fSolvableIn; fSafe = fSafeIn; } std::string ToString() const; @@ -740,7 +751,7 @@ public: /** * populate vCoins with vector of available COutputs. */ - void AvailableCoins(std::vector<COutput>& vCoins, bool fOnlyConfirmed=true, const CCoinControl *coinControl = NULL, bool fIncludeZeroValue=false) const; + void AvailableCoins(std::vector<COutput>& vCoins, bool fOnlySafe=true, const CCoinControl *coinControl = NULL, bool fIncludeZeroValue=false) const; /** * Shuffle and select coins until nTargetValue is reached while avoiding |