diff options
| author | Wladimir J. van der Laan <[email protected]> | 2015-12-08 10:22:34 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2015-12-08 10:23:01 +0100 |
| commit | 0800092fc252dd85ea726c50c29086e62e179b5e (patch) | |
| tree | f8f033c7658799ceba7819a7581f451755192495 /src/wallet/wallet.cpp | |
| parent | Merge pull request #7180 (diff) | |
| parent | Added a test for the pruning of extraneous inputs after ApproximateBestSet (diff) | |
| download | discoin-0800092fc252dd85ea726c50c29086e62e179b5e.tar.xz discoin-0800092fc252dd85ea726c50c29086e62e179b5e.zip | |
Merge pull request #4906
fc0f52d Added a test for the pruning of extraneous inputs after ApproximateBestSet (Murch)
af9510e Moved set reduction to the end of ApproximateBestSubset to reduce performance impact (Murch)
5c03483 Coinselection prunes extraneous inputs from ApproximateBestSubset (AlSzacrel)
Diffstat (limited to 'src/wallet/wallet.cpp')
| -rw-r--r-- | src/wallet/wallet.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index d23d54e67..a262769c4 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1632,6 +1632,16 @@ static void ApproximateBestSubset(vector<pair<CAmount, pair<const CWalletTx*,uns } } } + + //Reduces the approximate best subset by removing any inputs that are smaller than the surplus of nTotal beyond nTargetValue. + for (unsigned int i = 0; i < vValue.size(); i++) + { + if (vfBest[i] && (nBest - vValue[i].first) >= nTargetValue ) + { + vfBest[i] = false; + nBest -= vValue[i].first; + } + } } bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int nConfTheirs, vector<COutput> vCoins, |