test: fix wallet_bumpfee.py

This commit is contained in:
Byron Hambly 2025-10-07 14:01:25 +02:00
parent 282d7bf9b6
commit 0865bc218a
No known key found for this signature in database
GPG key ID: DE8F6EA20A661697
5 changed files with 24 additions and 28 deletions

View file

@ -1188,7 +1188,7 @@ static RPCHelpMan decodepsbt()
result.pushKV("fallback_locktime", static_cast<uint64_t>(*psbtx.fallback_locktime));
}
result.pushKV("input_count", static_cast<uint64_t>(psbtx.inputs.size()));
result.pushKV("output_count", static_cast<uint64_t>(psbtx.inputs.size()));
result.pushKV("output_count", static_cast<uint64_t>(psbtx.outputs.size()));
if (psbtx.m_tx_modifiable != std::nullopt) {
result.pushKV("inputs_modifiable", psbtx.m_tx_modifiable->test(0));
result.pushKV("outputs_modifiable", psbtx.m_tx_modifiable->test(1));

View file

@ -309,6 +309,9 @@ Result CreateRateBumpTransaction(CWallet& wallet, const uint256& txid, const CCo
}
temp_mtx.vout = txouts;
temp_mtx.witness.vtxoutwit.clear(); // ELEMENTS
for (auto& inwit : temp_mtx.witness.vtxinwit) {
inwit.scriptWitness.SetNull();
}
const int64_t maxTxSize{CalculateMaximumSignedTxSize(CTransaction(temp_mtx), &wallet, &new_coin_control).vsize};
Result res = CheckFeeRate(wallet, temp_mtx, *new_coin_control.m_feerate, maxTxSize, old_fee, errors);
if (res != Result::OK) {

View file

@ -1869,6 +1869,7 @@ static util::Result<CreatedTransactionResult> CreateTransactionInternal(
}
// Error if this output is reduced to be below dust
txout.nValue = value;
if (IsDust(txout, wallet.chain().relayDustFee())) {
if (value < 0) {
return util::Error{_("The transaction amount is too small to pay the fee")};
@ -1876,8 +1877,6 @@ static util::Result<CreatedTransactionResult> CreateTransactionInternal(
return util::Error{_("The transaction amount is too small to send after the fee has been deducted")};
}
}
txout.nValue = value;
}
++i;
}

View file

@ -1789,13 +1789,18 @@ bool FillInputToWeight(CMutableTransaction& mtx, size_t nIn, int64_t target_weig
bool CWallet::DummySignTx(CMutableTransaction &txNew, const std::vector<CTxOut> &txouts, const CCoinControl* coin_control) const
{
// Fill in dummy signatures for fee calculation.
int nIn = 0;
size_t nIn = 0;
const bool can_grind_r = CanGrindR();
for (const auto& txout : txouts)
{
CTxIn& txin = txNew.vin[nIn];
// If weight was provided, fill the input to that weight
if (coin_control && coin_control->HasInputWeight(txin.prevout)) {
// ELEMENTS: ensure input witness is large enough for rare case in bumpfee
if (txNew.witness.vtxinwit.size() <= nIn) {
txNew.witness.vtxinwit.resize(nIn + 1);
}
assert(txNew.witness.vtxinwit.size() > nIn);
if (!FillInputToWeight(txNew, nIn, coin_control->GetInputWeight(txin.prevout))) {
return false;
}