Skip to content

Commit c8177fa

Browse files
committed
Update tests
1 parent 1e7b14b commit c8177fa

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

tests/test_misc.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -561,12 +561,12 @@ def test_htlc_in_timeout(node_factory, bitcoind, executor):
561561

562562

563563
@unittest.skipIf(TEST_NETWORK == 'liquid-regtest', 'must be on bitcoin network')
564-
def test_bech32_funding(node_factory, chainparams):
564+
def test_p2tr_funding(node_factory, chainparams):
565565
# Don't get any funds from previous runs.
566566
l1, l2 = node_factory.line_graph(2, opts={'random_hsm': True}, fundchannel=False)
567567

568-
# fund a bech32 address and then open a channel with it
569-
res = l1.openchannel(l2, 25000, 'bech32')
568+
# fund a p2tr address and then open a channel with it
569+
res = l1.openchannel(l2, 25000, 'p2tr')
570570
address = res['address']
571571
assert address.startswith(chainparams['bip173_prefix'])
572572

@@ -576,11 +576,11 @@ def test_bech32_funding(node_factory, chainparams):
576576
wallettx = l1.bitcoin.rpc.getrawtransaction(wallettxid, True)
577577
fundingtx = l1.bitcoin.rpc.decoderawtransaction(res['fundingtx'])
578578

579-
def is_p2wpkh(output):
580-
return output['type'] == 'witness_v0_keyhash' and \
579+
def is_p2tr(output):
580+
return output['type'] == 'witness_v1_taproot' and \
581581
address == scriptpubkey_addr(output)
582582

583-
assert any(is_p2wpkh(output['scriptPubKey']) for output in wallettx['vout'])
583+
assert any(is_p2tr(output['scriptPubKey']) for output in wallettx['vout'])
584584
assert only_one(fundingtx['vin'])['txid'] == res['wallettxid']
585585

586586

@@ -643,7 +643,7 @@ def dont_spend_outputs(n, txid):
643643
dont_spend_outputs(l1, out['txid'])
644644

645645
# Now send some money to l2.
646-
waddr = l2.rpc.newaddr('bech32')['bech32']
646+
waddr = l2.rpc.newaddr('p2tr')['p2tr']
647647
out = l1.rpc.withdraw(waddr, amount)
648648
bitcoind.generate_block(1)
649649

@@ -731,7 +731,7 @@ def dont_spend_outputs(n, txid):
731731
l1.rpc.unreserveinputs(bitcoind.rpc.createpsbt(inputs, []))
732732

733733
# Test withdrawal to self.
734-
l1.rpc.withdraw(l1.rpc.newaddr('bech32')['bech32'], 'all', minconf=0)
734+
l1.rpc.withdraw(l1.rpc.newaddr('p2tr')['p2tr'], 'all', minconf=0)
735735
bitcoind.generate_block(1)
736736
assert l1.db_query('SELECT COUNT(*) as c FROM outputs WHERE status=0')[0]['c'] == 1
737737

@@ -746,12 +746,13 @@ def dont_spend_outputs(n, txid):
746746
sync_blockheight(bitcoind, [l1])
747747
assert account_balance(l1, 'wallet') == 0
748748

749+
# randomHsm now uses p2tr addresses and have a different transaction weight than non-p2tr addresses
749750
external_moves = [
750751
{'type': 'chain_mvt', 'credit_msat': 2000000000, 'debit_msat': 0, 'tags': ['deposit']},
751752
{'type': 'chain_mvt', 'credit_msat': 2000000000, 'debit_msat': 0, 'tags': ['deposit']},
752753
{'type': 'chain_mvt', 'credit_msat': 2000000000, 'debit_msat': 0, 'tags': ['deposit']},
753754
{'type': 'chain_mvt', 'credit_msat': 2000000000, 'debit_msat': 0, 'tags': ['deposit']},
754-
{'type': 'chain_mvt', 'credit_msat': 11957393000, 'debit_msat': 0, 'tags': ['deposit']},
755+
{'type': 'chain_mvt', 'credit_msat': 11960055000, 'debit_msat': 0, 'tags': ['deposit']},
755756
]
756757

757758
check_coin_moves(l1, 'external', external_moves, chainparams)
@@ -1338,7 +1339,7 @@ def test_blockchaintrack(node_factory, bitcoind):
13381339
"""Check that we track the blockchain correctly across reorgs
13391340
"""
13401341
l1 = node_factory.get_node(random_hsm=True)
1341-
addr = l1.rpc.newaddr(addresstype='all')['bech32']
1342+
addr = l1.rpc.newaddr(addresstype='all')['p2tr']
13421343

13431344
######################################################################
13441345
# First failure scenario: rollback on startup doesn't work,

0 commit comments

Comments
 (0)