QT: have output amounts propagated for subtractfeefromoutput logic

This commit is contained in:
Gregory Sanders 2019-04-09 13:29:31 -04:00
parent 2a334b73ec
commit 8048a6d8bf
3 changed files with 7 additions and 2 deletions

View file

@ -231,6 +231,7 @@ public:
bool sign,
int& change_pos,
CAmount& fee,
std::vector<CAmount>& out_amounts,
std::string& fail_reason) override
{
LOCK2(cs_main, m_wallet.cs_wallet);
@ -243,10 +244,12 @@ public:
pending->m_keys.emplace_back(new CReserveKey(&m_wallet));
}
}
BlindDetails blind_details;
if (!m_wallet.CreateTransaction(recipients, pending->m_tx, pending->m_keys, fee, change_pos,
fail_reason, coin_control, sign)) {
fail_reason, coin_control, sign, &blind_details)) {
return {};
}
out_amounts = blind_details.o_amounts;
return std::move(pending);
}
bool transactionCanBeAbandoned(const uint256& txid) override { return m_wallet.TransactionCanBeAbandoned(txid); }

View file

@ -138,6 +138,7 @@ public:
bool sign,
int& change_pos,
CAmount& fee,
std::vector<CAmount>& out_amounts,
std::string& fail_reason) = 0;
//! Return whether transaction can be abandoned.

View file

@ -234,9 +234,10 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
auto& newTx = transaction.getWtx();
std::vector<CAmount> out_amounts;
newTx = m_wallet->createTransaction(vecSend, coinControl, true /* sign */, nChangePosRet, nFeeRequired, strFailReason);
newTx = m_wallet->createTransaction(vecSend, coinControl, true /* sign */, nChangePosRet, nFeeRequired, out_amounts, strFailReason);
transaction.setTransactionFee(nFeeRequired);
if (fSubtractFeeFromAmount && newTx)
assert(out_amounts.size() == newTx->get().vout.size());
transaction.reassignAmounts(out_amounts, nChangePosRet);
if(!newTx)