From 72e1be6f5eff75a5311c406dcd3d2f4244c94755 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Fri, 17 Feb 2023 14:10:03 +0000 Subject: [PATCH] swaps: rm support for p2wsh-p2sh lockup scripts - unused - the client was already refusing to fund such lockup addresses (if the server asked) - no existing unit tests for it, and as the choice is up to the server, it is hard to create tests - no clear reason to want to use p2sh-nested scripts here, aside from curiosity --- electrum/submarine_swaps.py | 10 ++-------- electrum/tests/test_sswaps.py | 2 -- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/electrum/submarine_swaps.py b/electrum/submarine_swaps.py index 36746ce5d..cd62f98d8 100644 --- a/electrum/submarine_swaps.py +++ b/electrum/submarine_swaps.py @@ -124,14 +124,8 @@ def create_claim_tx( """Create tx to either claim successful reverse-swap, or to get refunded for timed-out forward-swap. """ - assert txin.address is not None - if is_segwit_address(txin.address): - txin.script_type = 'p2wsh' - txin.script_sig = b'' - else: - txin.script_type = 'p2wsh-p2sh' # TODO rm?? - txin.redeem_script = bytes.fromhex(p2wsh_nested_script(witness_script.hex())) - txin.script_sig = bytes.fromhex(push_script(txin.redeem_script.hex())) + txin.script_type = 'p2wsh' + txin.script_sig = b'' txin.witness_script = witness_script txout = PartialTxOutput.from_address_and_value(address, amount_sat) tx = PartialTransaction.from_io([txin], [txout], version=2, locktime=locktime) diff --git a/electrum/tests/test_sswaps.py b/electrum/tests/test_sswaps.py index 377fa31ec..3011b2eca 100644 --- a/electrum/tests/test_sswaps.py +++ b/electrum/tests/test_sswaps.py @@ -34,7 +34,6 @@ class TestSwapTxs(TestCaseForTestnet): prevout=TxOutpoint(txid=bfh(swap_data.funding_txid), out_idx=0), ) txin._trusted_value_sats = swap_data.onchain_amount - txin._trusted_address = swap_data.lockup_address tx = SwapManager._create_and_sign_claim_tx( txin=txin, swap=swap_data, @@ -65,7 +64,6 @@ class TestSwapTxs(TestCaseForTestnet): prevout=TxOutpoint(txid=bfh(swap_data.funding_txid), out_idx=0), ) txin._trusted_value_sats = swap_data.onchain_amount - txin._trusted_address = swap_data.lockup_address tx = SwapManager._create_and_sign_claim_tx( txin=txin, swap=swap_data,