@@ -971,10 +971,10 @@ bool CPrivateSendClientManager::DoAutomaticDenominating(CConnman& connman, bool
971
971
return false ;
972
972
}
973
973
974
- int nDnCount = dnodeman.CountDynodes ( );
974
+ int nDnCountEnabled = dnodeman.CountEnabled (MIN_PRIVATESEND_PEER_PROTO_VERSION );
975
975
976
976
// If we've used 90% of the Dynode list then drop the oldest first ~30%
977
- int nThreshold_high = nDnCount * 0.9 ;
977
+ int nThreshold_high = nDnCountEnabled * 0.9 ;
978
978
int nThreshold_low = nThreshold_high * 0.7 ;
979
979
LogPrint (" privatesend" , " Checking vecDynodesUsed: size: %d, threshold: %d\n " , (int )vecDynodesUsed.size (), nThreshold_high);
980
980
@@ -1371,6 +1371,11 @@ bool CPrivateSendClientSession::MakeCollateralAmounts(CConnman& connman)
1371
1371
return false ;
1372
1372
}
1373
1373
1374
+ // Start from smallest balances first to consume tiny amounts and cleanup UTXO a bit
1375
+ std::sort (vecTally.begin (), vecTally.end (), [](const CompactTallyItem& a, const CompactTallyItem& b) {
1376
+ return a.nAmount < b.nAmount ;
1377
+ });
1378
+
1374
1379
// First try to use only non-denominated funds
1375
1380
for (const auto & item : vecTally) {
1376
1381
if (!MakeCollateralAmounts (item, false , connman))
@@ -1483,6 +1488,11 @@ bool CPrivateSendClientSession::CreateDenominated(CConnman& connman)
1483
1488
return false ;
1484
1489
}
1485
1490
1491
+ // Start from largest balances first to speed things up by creating txes with larger/largest denoms included
1492
+ std::sort (vecTally.begin (), vecTally.end (), [](const CompactTallyItem& a, const CompactTallyItem& b) {
1493
+ return a.nAmount > b.nAmount ;
1494
+ });
1495
+
1486
1496
bool fCreateMixingCollaterals = !pwalletMain->HasCollateralInputs ();
1487
1497
1488
1498
for (const auto & item : vecTally) {
0 commit comments