Skip to content

Commit

Permalink
Only set coin control fee asset when any asset fees is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
JBetz committed Apr 12, 2024
1 parent f1473e6 commit 15f8801
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/wallet/coincontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class CCoinControl
int m_min_depth = DEFAULT_MIN_DEPTH;
//! Maximum chain depth value for coin availability
int m_max_depth = DEFAULT_MAX_DEPTH;
//! ELEMENT: Override the chain's default fee asset if set
//! ELEMENT: Override the chain's default fee asset if set and con_any_asset_fees is enabled
std::optional<CAsset> m_fee_asset;

CCoinControl();
Expand Down
5 changes: 2 additions & 3 deletions src/wallet/rpc/spend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,18 @@ RPCHelpMan sendtoaddress()

SetFeeEstimateMode(*pwallet, coin_control, /* conf_target */ request.params[6], /* estimate_mode */ request.params[7], /* fee_rate */ request.params[11], /* override_min_fee */ false);

CAsset feeAsset = ::policyAsset;
if (g_con_any_asset_fees) {
// Default to using the same asset being sent in the transaction
feeAsset = asset;
CAsset feeAsset = asset;
if (request.params.size() > 12 && request.params[12].isStr() && !request.params[12].get_str().empty()) {
std::string strFeeAsset = request.params[12].get_str();
feeAsset = GetAssetFromString(strFeeAsset);
if (feeAsset.IsNull()) {
throw JSONRPCError(RPC_WALLET_ERROR, strprintf("Unknown label and invalid asset hex for fee: %s", feeAsset.GetHex()));
}
}
coin_control.m_fee_asset = feeAsset;
}
coin_control.m_fee_asset = feeAsset;

EnsureWalletIsUnlocked(*pwallet);

Expand Down

0 comments on commit 15f8801

Please sign in to comment.