Skip to content

Commit

Permalink
When any asset fees is enabled, use transaction asset for fee asset e…
Browse files Browse the repository at this point in the history
…ven when options parameter is not provided
  • Loading branch information
JBetz committed Apr 21, 2024
1 parent c2d8a46 commit c27b42c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/wallet/rpc/spend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,9 @@ void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out,
bool lockUnspents = false;
UniValue subtractFeeFromOutputs;
std::set<int> setSubtractFeeFromOutputs;
if (g_con_any_asset_fees && !tx.vout.empty()) {
coinControl.m_fee_asset = tx.vout[0].nAsset.GetAsset();
}

if (!options.isNull()) {
if (options.type() == UniValue::VBOOL) {
Expand Down Expand Up @@ -516,8 +519,6 @@ void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out,
throw JSONRPCError(RPC_WALLET_ERROR, strprintf("Unknown label and invalid asset hex for fee: %s", feeAsset.GetHex()));
}
coinControl.m_fee_asset = feeAsset;
} else {
coinControl.m_fee_asset = tx.vout[0].nAsset.GetAsset();
}
}

Expand Down

0 comments on commit c27b42c

Please sign in to comment.