diff --git a/basicswap/http_server.py b/basicswap/http_server.py index 6715ff1..aae11d3 100644 --- a/basicswap/http_server.py +++ b/basicswap/http_server.py @@ -398,6 +398,11 @@ class HttpHandler(BaseHTTPRequestHandler): page_data['from_fee_override'] = ci_from.format_amount(ci_from.make_int(from_fee_override, r=1)) parsed_data['from_fee_override'] = page_data['from_fee_override'] + lock_spend_tx_vsize = ci_from.xmr_swap_alock_spend_tx_vsize() + lock_spend_tx_fee = ci_from.make_int(ci_from.make_int(from_fee_override, r=1) * lock_spend_tx_vsize / 1000, r=1) + page_data['amt_from_lock_spend_tx_fee'] = ci_from.format_amount(lock_spend_tx_fee // ci_from.COIN()) + page_data['tla_from'] = ci_from.ticker() + if coin_to == Coins.XMR: if b'fee_rate_to' in form_data: page_data['to_fee_override'] = form_data[b'fee_rate_to'][0].decode('utf-8') @@ -565,6 +570,10 @@ class HttpHandler(BaseHTTPRequestHandler): data['a_fee_rate_verify_src'] = fee_source data['a_fee_warn'] = xmr_offer.a_fee_rate < int_fee_rate_now + lock_spend_tx_vsize = ci_from.xmr_swap_alock_spend_tx_vsize() + lock_spend_tx_fee = ci_from.make_int(xmr_offer.a_fee_rate * lock_spend_tx_vsize / 1000, r=1) + data['amt_from_lock_spend_tx_fee'] = ci_from.format_amount(lock_spend_tx_fee // ci_from.COIN()) + if offer.was_sent: data['auto_accept'] = 'True' if offer.auto_accept_bids else 'False' diff --git a/basicswap/interface_btc.py b/basicswap/interface_btc.py index 8ae4b3e..0ae458b 100644 --- a/basicswap/interface_btc.py +++ b/basicswap/interface_btc.py @@ -111,6 +111,10 @@ class BTCInterface(CoinInterface): def compareFeeRates(a, b): return abs(a - b) < 20 + @staticmethod + def xmr_swap_alock_spend_tx_vsize(): + return 147 + def __init__(self, coin_settings, network): super().__init__() self.rpc_callback = make_rpc_func(coin_settings['rpcport'], coin_settings['rpcauth'], host=coin_settings['rpchost']) @@ -409,7 +413,7 @@ class BTCInterface(CoinInterface): witness_bytes = len(script_lock) witness_bytes += 33 # sv, size - witness_bytes += 73 * 2 # 2 signatures (72 + 1 byts size) + witness_bytes += 73 * 2 # 2 signatures (72 + 1 byte size) witness_bytes += 4 # 1 empty, 1 true witness stack values witness_bytes += getCompactSizeLen(witness_bytes) vsize = self.getTxVSize(tx, add_witness_bytes=witness_bytes) diff --git a/basicswap/interface_part.py b/basicswap/interface_part.py index 69c42d6..cce82c1 100644 --- a/basicswap/interface_part.py +++ b/basicswap/interface_part.py @@ -31,6 +31,10 @@ class PARTInterface(BTCInterface): def txVersion(): return 0xa0 + @staticmethod + def xmr_swap_alock_spend_tx_vsize(): + return 213 + def __init__(self, coin_settings, network): self.rpc_callback = make_rpc_func(coin_settings['rpcport'], coin_settings['rpcauth'], host=coin_settings['rpchost']) self.txoType = CTxOutPart diff --git a/basicswap/templates/offer.html b/basicswap/templates/offer.html index a24ec3c..9efbe74 100644 --- a/basicswap/templates/offer.html +++ b/basicswap/templates/offer.html @@ -42,7 +42,7 @@