From c27b42c77534dcc7ec35754a6c9b7e411fabf3c6 Mon Sep 17 00:00:00 2001 From: JBetz Date: Fri, 19 Apr 2024 21:57:53 +0200 Subject: [PATCH] When any asset fees is enabled, use transaction asset for fee asset even when options parameter is not provided --- src/wallet/rpc/spend.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp index 527520c40e..34f0d8305a 100644 --- a/src/wallet/rpc/spend.cpp +++ b/src/wallet/rpc/spend.cpp @@ -464,6 +464,9 @@ void FundTransaction(CWallet& wallet, CMutableTransaction& tx, CAmount& fee_out, bool lockUnspents = false; UniValue subtractFeeFromOutputs; std::set 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) { @@ -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(); } }