Use static calls for GetRequiredFee and GetMinimumFee, remove make_pair from emplace_back

This commit is contained in:
Jonas Schnelli 2017-03-28 09:06:46 +02:00
parent bb78c1599e
commit 44cabe6380
No known key found for this signature in database
GPG Key ID: 1EB776BB03C7922D

View File

@ -30,7 +30,7 @@ int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *pWal
for (auto& input : tx.vin) { for (auto& input : tx.vin) {
const auto mi = pWallet->mapWallet.find(input.prevout.hash); const auto mi = pWallet->mapWallet.find(input.prevout.hash);
assert(mi != pWallet->mapWallet.end() && input.prevout.n < mi->second.tx->vout.size()); assert(mi != pWallet->mapWallet.end() && input.prevout.n < mi->second.tx->vout.size());
vCoins.emplace_back(std::make_pair(&(mi->second), input.prevout.n)); vCoins.emplace_back(&(mi->second), input.prevout.n);
} }
if (!pWallet->DummySignTx(txNew, vCoins)) { if (!pWallet->DummySignTx(txNew, vCoins)) {
// This should never happen, because IsAllFromMe(ISMINE_SPENDABLE) // This should never happen, because IsAllFromMe(ISMINE_SPENDABLE)
@ -147,7 +147,7 @@ CFeeBumper::CFeeBumper(const CWallet *pWallet, const uint256 txidIn, int newConf
currentResult = BumpFeeResult::INVALID_PARAMETER; currentResult = BumpFeeResult::INVALID_PARAMETER;
return; return;
} }
CAmount requiredFee = pWallet->GetRequiredFee(maxNewTxSize); CAmount requiredFee = CWallet::GetRequiredFee(maxNewTxSize);
if (totalFee < requiredFee) { if (totalFee < requiredFee) {
vErrors.push_back(strprintf("Insufficient totalFee (cannot be less than required fee %s)", vErrors.push_back(strprintf("Insufficient totalFee (cannot be less than required fee %s)",
FormatMoney(requiredFee))); FormatMoney(requiredFee)));
@ -159,11 +159,11 @@ CFeeBumper::CFeeBumper(const CWallet *pWallet, const uint256 txidIn, int newConf
} else { } else {
// if user specified a confirm target then don't consider any global payTxFee // if user specified a confirm target then don't consider any global payTxFee
if (specifiedConfirmTarget) { if (specifiedConfirmTarget) {
nNewFee = pWallet->GetMinimumFee(maxNewTxSize, newConfirmTarget, mempool, CAmount(0)); nNewFee = CWallet::GetMinimumFee(maxNewTxSize, newConfirmTarget, mempool, CAmount(0));
} }
// otherwise use the regular wallet logic to select payTxFee or default confirm target // otherwise use the regular wallet logic to select payTxFee or default confirm target
else { else {
nNewFee = pWallet->GetMinimumFee(maxNewTxSize, newConfirmTarget, mempool); nNewFee = CWallet::GetMinimumFee(maxNewTxSize, newConfirmTarget, mempool);
} }
nNewFeeRate = CFeeRate(nNewFee, maxNewTxSize); nNewFeeRate = CFeeRate(nNewFee, maxNewTxSize);