Browse Source

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
master
SomberNight 3 years ago
parent
commit
72e1be6f5e
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 6
      electrum/submarine_swaps.py
  2. 2
      electrum/tests/test_sswaps.py

6
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.witness_script = witness_script
txout = PartialTxOutput.from_address_and_value(address, amount_sat)
tx = PartialTransaction.from_io([txin], [txout], version=2, locktime=locktime)

2
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,

Loading…
Cancel
Save