mirror of
https://github.com/dashpay/dash.git
synced 2024-12-29 05:49:11 +01:00
Preserve the shuffled order of coins with equal value to give more randomized coin selection.
This commit is contained in:
parent
4ce190a015
commit
d650f96d5f
@ -17,6 +17,15 @@ using namespace std;
|
|||||||
// mapWallet
|
// mapWallet
|
||||||
//
|
//
|
||||||
|
|
||||||
|
struct CompareValueOnly
|
||||||
|
{
|
||||||
|
bool operator()(const pair<int64, pair<const CWalletTx*, unsigned int> >& t1,
|
||||||
|
const pair<int64, pair<const CWalletTx*, unsigned int> >& t2) const
|
||||||
|
{
|
||||||
|
return t1.first < t2.first;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
CPubKey CWallet::GenerateNewKey()
|
CPubKey CWallet::GenerateNewKey()
|
||||||
{
|
{
|
||||||
bool fCompressed = CanSupportFeature(FEATURE_COMPRPUBKEY); // default to compressed public keys if we want 0.6.0 wallets
|
bool fCompressed = CanSupportFeature(FEATURE_COMPRPUBKEY); // default to compressed public keys if we want 0.6.0 wallets
|
||||||
@ -980,7 +989,7 @@ bool CWallet::SelectCoinsMinConf(int64 nTargetValue, int nConfMine, int nConfThe
|
|||||||
nTargetValue += CENT;
|
nTargetValue += CENT;
|
||||||
|
|
||||||
// Solve subset sum by stochastic approximation
|
// Solve subset sum by stochastic approximation
|
||||||
sort(vValue.rbegin(), vValue.rend());
|
sort(vValue.rbegin(), vValue.rend(), CompareValueOnly());
|
||||||
vector<char> vfIncluded;
|
vector<char> vfIncluded;
|
||||||
vector<char> vfBest(vValue.size(), true);
|
vector<char> vfBest(vValue.size(), true);
|
||||||
int64 nBest = nTotalLower;
|
int64 nBest = nTotalLower;
|
||||||
|
Loading…
Reference in New Issue
Block a user