Skip to content

Commit

Permalink
Refactor: vecTxIn -> vecOutPoints for CompactTallyItem (dashpay#1932)
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 authored and andvgal committed Dec 25, 2018
1 parent f6bc2c1 commit ed21e68
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/privatesend-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ bool CPrivateSendClient::MakeCollateralAmounts(const CompactTallyItem& tallyItem
LOCK2(cs_main, pwalletMain->cs_wallet);

// denominated input is always a single one, so we can check its amount directly and return early
if(!fTryDenominated && tallyItem.vecTxIn.size() == 1 && CPrivateSend::IsDenominatedAmount(tallyItem.nAmount))
if(!fTryDenominated && tallyItem.vecOutPoints.size() == 1 && CPrivateSend::IsDenominatedAmount(tallyItem.nAmount))
return false;

CWalletTx wtx;
Expand All @@ -1208,8 +1208,8 @@ bool CPrivateSendClient::MakeCollateralAmounts(const CompactTallyItem& tallyItem
coinControl.fAllowWatchOnly = false;
// send change to the same address so that we were able create more denoms out of it later
coinControl.destChange = tallyItem.txdest;
for (const auto& txin : tallyItem.vecTxIn)
coinControl.Select(txin.prevout);
for (const auto& outpoint : tallyItem.vecOutPoints)
coinControl.Select(outpoint);

bool fSuccess = pwalletMain->CreateTransaction(vecSend, wtx, reservekeyChange,
nFeeRet, nChangePosRet, strFail, &coinControl, true, ONLY_NONDENOMINATED);
Expand Down Expand Up @@ -1344,8 +1344,8 @@ bool CPrivateSendClient::CreateDenominated(const CompactTallyItem& tallyItem, bo
coinControl.fAllowWatchOnly = false;
// send change to the same address so that we were able create more denoms out of it later
coinControl.destChange = tallyItem.txdest;
for (const auto& txin : tallyItem.vecTxIn)
coinControl.Select(txin.prevout);
for (const auto& outpoint : tallyItem.vecOutPoints)
coinControl.Select(outpoint);

CWalletTx wtx;
CAmount nFeeRet = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3117,7 +3117,7 @@ bool CWallet::SelectCoinsGrouppedByAddresses(std::vector<CompactTallyItem>& vecT
CompactTallyItem& item = mapTally[txdest];
item.txdest = txdest;
item.nAmount += wtx.tx->vout[i].nValue;
item.vecTxIn.push_back(CTxIn(outpoint.hash, i));
item.vecOutPoints.emplace_back(outpoint.hash, i);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/wallet/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ struct CompactTallyItem
{
CTxDestination txdest;
CAmount nAmount;
std::vector<CTxIn> vecTxIn;
std::vector<COutPoint> vecOutPoints;
CompactTallyItem()
{
nAmount = 0;
Expand Down

0 comments on commit ed21e68

Please sign in to comment.