You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For swaps MM2 maintains trade fee variable calculated both for the taker and maker. It indicates tx fee to spend on swap payment and refund transactions (see maker_payment_trade_fee and taker_payment_trade_fee vars).
The trade fee vars contain sum of both payment tx and refund tx fee. However it may not be always accurate.
Consider where trade fee is used:
to generate a trade_preimage transaction returned to user to review and sign, see taker_swap_trade_preimage(). Seems it's not good to ask the user to allocate total fee for payment tx only.
to calculate max total value available for swap (see calc_max_maker_vol and calc_max_taker_vol fn) and check balance for swap (see check_balance_for_maker_swap and check_balance_for_taker_swap).
to get locked_amount for the swap.
Before PR #2051 swap trade fee always included refund fee.
In the PR #2051 the trade_preimage rpcs now return trade fee w/o the refund fee. But inside those rpcs check balance is called for which refund fee is needed. So it's better to have both payment and refund fee values separate.
Above is for swaps v1.
(For swaps v2, in currently implemented utxo case, trade fee var is used to check max balance for the swap. Actual tx fee is auto estimated in tx creation process, so no need to break trade fee into payment and refund tx fee.)
A related issue is #1848 with a more general task to reduce tx fees.
The text was updated successfully, but these errors were encountered:
For swaps MM2 maintains trade fee variable calculated both for the taker and maker. It indicates tx fee to spend on swap payment and refund transactions (see maker_payment_trade_fee and taker_payment_trade_fee vars).
The trade fee vars contain sum of both payment tx and refund tx fee. However it may not be always accurate.
Consider where trade fee is used:
Before PR #2051 swap trade fee always included refund fee.
In the PR #2051 the trade_preimage rpcs now return trade fee w/o the refund fee. But inside those rpcs check balance is called for which refund fee is needed. So it's better to have both payment and refund fee values separate.
Above is for swaps v1.
(For swaps v2, in currently implemented utxo case, trade fee var is used to check max balance for the swap. Actual tx fee is auto estimated in tx creation process, so no need to break trade fee into payment and refund tx fee.)
A related issue is #1848 with a more general task to reduce tx fees.
The text was updated successfully, but these errors were encountered: