From 85fc46f76cf2f9577d338885b14d838d19d4b330 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 13 Jan 2023 11:04:22 +1030 Subject: [PATCH] pyln-testing: don't default openchannel and fundwallet to p2sh-segwit, use bech32. Signed-off-by: Rusty Russell --- contrib/pyln-testing/pyln/testing/utils.py | 4 ++-- tests/test_bookkeeper.py | 8 ++++---- tests/test_opening.py | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/contrib/pyln-testing/pyln/testing/utils.py b/contrib/pyln-testing/pyln/testing/utils.py index bc257e827..4a964d8a6 100644 --- a/contrib/pyln-testing/pyln/testing/utils.py +++ b/contrib/pyln-testing/pyln/testing/utils.py @@ -842,7 +842,7 @@ class LightningNode(object): def is_connected(self, remote_node): return remote_node.info['id'] in [p['id'] for p in self.rpc.listpeers()['peers']] - def openchannel(self, remote_node, capacity=FUNDAMOUNT, addrtype="p2sh-segwit", confirm=True, wait_for_announce=True, connect=True): + def openchannel(self, remote_node, capacity=FUNDAMOUNT, addrtype="bech32", confirm=True, wait_for_announce=True, connect=True): addr, wallettxid = self.fundwallet(10 * capacity, addrtype) if connect and not self.is_connected(remote_node): @@ -859,7 +859,7 @@ class LightningNode(object): return {'address': addr, 'wallettxid': wallettxid, 'fundingtx': res['tx']} - def fundwallet(self, sats, addrtype="p2sh-segwit", mine_block=True): + def fundwallet(self, sats, addrtype="bech32", mine_block=True): addr = self.rpc.newaddr(addrtype)[addrtype] txid = self.bitcoin.rpc.sendtoaddress(addr, sats / 10**8) if mine_block: diff --git a/tests/test_bookkeeper.py b/tests/test_bookkeeper.py index 9093f58df..1e0f24b73 100644 --- a/tests/test_bookkeeper.py +++ b/tests/test_bookkeeper.py @@ -389,13 +389,13 @@ def test_bookkeeping_missed_chans_leases(node_factory, bitcoind): # l1 events exp_events = [('channel_open', open_amt * 1000 + lease_fee, 0), - ('onchain_fee', 1408000, 0), + ('onchain_fee', 1224000, 0), ('lease_fee', 0, lease_fee), ('journal_entry', 0, invoice_msat)] _check_events(l1, channel_id, exp_events) exp_events = [('channel_open', open_amt * 1000, 0), - ('onchain_fee', 980000, 0), + ('onchain_fee', 796000, 0), ('lease_fee', lease_fee, 0), ('journal_entry', invoice_msat, 0)] _check_events(l2, channel_id, exp_events) @@ -455,7 +455,7 @@ def test_bookkeeping_missed_chans_pushed(node_factory, bitcoind): # l1 events exp_events = [('channel_open', open_amt * 1000, 0), - ('onchain_fee', 5257000, 0), + ('onchain_fee', 4567000, 0), ('pushed', 0, push_amt), ('journal_entry', 0, invoice_msat)] _check_events(l1, channel_id, exp_events) @@ -528,7 +528,7 @@ def test_bookkeeping_missed_chans_pay_after(node_factory, bitcoind): # l1 events exp_events = [('channel_open', open_amt * 1000, 0), - ('onchain_fee', 5257000, 0), + ('onchain_fee', 4567000, 0), ('invoice', 0, invoice_msat)] _check_events(l1, channel_id, exp_events) diff --git a/tests/test_opening.py b/tests/test_opening.py index aa78f0e6f..e25ce60fc 100644 --- a/tests/test_opening.py +++ b/tests/test_opening.py @@ -1145,7 +1145,7 @@ def test_funder_options(node_factory, bitcoind): l3.fundchannel(l1, 10**6) chan_info = only_one(l3.rpc.listpeerchannels(l1.info['id'])['channels']) # l1 contributed all its funds! - assert chan_info['funding']['remote_funds_msat'] == Millisatoshi('9994255000msat') + assert chan_info['funding']['remote_funds_msat'] == Millisatoshi('9994945000msat') assert chan_info['funding']['local_funds_msat'] == Millisatoshi('1000000000msat') @@ -1189,7 +1189,7 @@ def test_funder_contribution_limits(node_factory, bitcoind): 'fuzz_percent': 0, 'leases_only': False}) - # Set our contribution to 50k sat, should only use 7 of 12 available utxos + # Set our contribution to 50k sat, should only use 6 of 12 available utxos l3.rpc.call('funderupdate', {'policy': 'fixed', 'policy_mod': '50000sat', @@ -1202,13 +1202,13 @@ def test_funder_contribution_limits(node_factory, bitcoind): l1.rpc.connect(l2.info['id'], 'localhost', l2.port) l1.fundchannel(l2, 10**7) - assert l2.daemon.is_in_log('Policy .* returned funding amount of 139020sat') + assert l2.daemon.is_in_log('Policy .* returned funding amount of 141780sat') assert l2.daemon.is_in_log(r'calling `signpsbt` .* 6 inputs') l1.rpc.connect(l3.info['id'], 'localhost', l3.port) l1.fundchannel(l3, 10**7) assert l3.daemon.is_in_log('Policy .* returned funding amount of 50000sat') - assert l3.daemon.is_in_log(r'calling `signpsbt` .* 7 inputs') + assert l3.daemon.is_in_log(r'calling `signpsbt` .* 6 inputs') @pytest.mark.openchannel('v2') @@ -1395,7 +1395,7 @@ def test_zeroconf_public(bitcoind, node_factory, chainparams): assert('short_channel_id' not in l2chan) # Channel is "proposed" - chan_val = 993198000 if chainparams['elements'] else 995673000 + chan_val = 993888000 if chainparams['elements'] else 996363000 l1_mvts = [ {'type': 'chain_mvt', 'credit_msat': chan_val, 'debit_msat': 0, 'tags': ['channel_proposed', 'opener']}, {'type': 'channel_mvt', 'credit_msat': 0, 'debit_msat': 20000000, 'tags': ['pushed'], 'fees_msat': '0msat'},