mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Few fixes related to SelectCoinsGroupedByAddresses (#3144)
* Fix cache usage in SelectCoinsGroupedByAddresses * Reset cache flags in SelectCoinsGroupedByAddresses when a block is (dis)connected * MakeCollateralAmounts should call SelectCoinsGroupedByAddresses with a limited number of inputs
This commit is contained in:
parent
1acd4742c4
commit
db7f471c7d
@ -1423,8 +1423,12 @@ bool CPrivateSendClientSession::MakeCollateralAmounts(CConnman& connman)
|
||||
{
|
||||
if (!pwalletMain) return false;
|
||||
|
||||
// NOTE: We do not allow txes larger than 100kB, so we have to limit number of inputs here.
|
||||
// We still want to consume a lot of inputs to avoid creating only smaller denoms though.
|
||||
// Knowing that each CTxIn is at least 148b big, 400 inputs should take 400 x ~148b = ~60kB.
|
||||
// This still leaves more than enough room for another data of typical MakeCollateralAmounts tx.
|
||||
std::vector<CompactTallyItem> vecTally;
|
||||
if (!pwalletMain->SelectCoinsGroupedByAddresses(vecTally, false, false)) {
|
||||
if (!pwalletMain->SelectCoinsGroupedByAddresses(vecTally, false, false, true, 400)) {
|
||||
LogPrint("privatesend", "CPrivateSendClientSession::MakeCollateralAmounts -- SelectCoinsGroupedByAddresses can't find any inputs!\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -3002,8 +3002,9 @@ bool CWallet::SelectCoinsGroupedByAddresses(std::vector<CompactTallyItem>& vecTa
|
||||
|
||||
isminefilter filter = ISMINE_SPENDABLE;
|
||||
|
||||
// try to use cache for already confirmed anonymizable inputs, no cache should be used when the limit is specified
|
||||
if(nMaxOupointsPerAddress != -1 && fAnonymizable && fSkipUnconfirmed) {
|
||||
// Try using the cache for already confirmed anonymizable inputs.
|
||||
// This should only be used if nMaxOupointsPerAddress was NOT specified.
|
||||
if(nMaxOupointsPerAddress == -1 && fAnonymizable && fSkipUnconfirmed) {
|
||||
if(fSkipDenominated && fAnonymizableTallyCachedNonDenom) {
|
||||
vecTallyRet = vecAnonymizableTallyCachedNonDenom;
|
||||
LogPrint("selectcoins", "SelectCoinsGroupedByAddresses - using cache for non-denom inputs %d\n", vecTallyRet.size());
|
||||
@ -3075,8 +3076,9 @@ bool CWallet::SelectCoinsGroupedByAddresses(std::vector<CompactTallyItem>& vecTa
|
||||
vecTallyRet.push_back(item.second);
|
||||
}
|
||||
|
||||
// cache already confirmed anonymizable entries for later use, no cache should be saved when the limit is specified
|
||||
if(nMaxOupointsPerAddress != -1 && fAnonymizable && fSkipUnconfirmed) {
|
||||
// Cache already confirmed anonymizable entries for later use.
|
||||
// This should only be used if nMaxOupointsPerAddress was NOT specified.
|
||||
if(nMaxOupointsPerAddress == -1 && fAnonymizable && fSkipUnconfirmed) {
|
||||
if(fSkipDenominated) {
|
||||
vecAnonymizableTallyCachedNonDenom = vecTallyRet;
|
||||
fAnonymizableTallyCachedNonDenom = true;
|
||||
|
Loading…
Reference in New Issue
Block a user