Skip to content

Commit eb22077

Browse files
committed
pytest: don't ask for p2tr addresses on liquid.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent d1bde4d commit eb22077

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

tests/test_misc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ def is_p2tr(output):
585585
assert only_one(fundingtx['vin'])['txid'] == res['wallettxid']
586586

587587

588+
@unittest.skipIf(TEST_NETWORK == 'liquid-regtest', "P2TR not yet supported on Elements")
588589
def test_withdraw_misc(node_factory, bitcoind, chainparams):
589590
def dont_spend_outputs(n, txid):
590591
"""Reserve both outputs (we assume there are two!) in case any our ours, so we don't spend change: wrecks accounting checks"""

tests/test_wallet.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
HSM_BAD_PASSWORD = 22
2525

2626

27+
def good_addrtype():
28+
"""Elements doesn't support p2tr"""
29+
if TEST_NETWORK == 'regtest':
30+
return "p2tr"
31+
return "bech32"
32+
33+
2734
@unittest.skipIf(TEST_NETWORK != 'regtest', "Test relies on a number of example addresses valid only in regtest")
2835
def test_withdraw(node_factory, bitcoind):
2936
amount = 1000000
@@ -215,7 +222,7 @@ def test_minconf_withdraw(node_factory, bitcoind):
215222
amount = 1000000
216223
# Don't get any funds from previous runs.
217224
l1 = node_factory.get_node(random_hsm=True)
218-
addr = l1.rpc.newaddr('p2tr')['p2tr']
225+
addr = l1.rpc.newaddr(good_addrtype())[good_addrtype()]
219226

220227
# Add some funds to withdraw later
221228
for i in range(10):
@@ -238,7 +245,7 @@ def test_addfunds_from_block(node_factory, bitcoind):
238245
coin_plugin = os.path.join(os.getcwd(), 'tests/plugins/coin_movements.py')
239246
l1 = node_factory.get_node(random_hsm=True, options={'plugin': coin_plugin})
240247

241-
addr = l1.rpc.newaddr('p2tr')['p2tr']
248+
addr = l1.rpc.newaddr(good_addrtype())[good_addrtype()]
242249
bitcoind.rpc.sendtoaddress(addr, 0.1)
243250
bitcoind.generate_block(1)
244251

@@ -275,7 +282,7 @@ def test_txprepare_multi(node_factory, bitcoind):
275282
amount = 10000000
276283
l1 = node_factory.get_node(random_hsm=True)
277284

278-
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr('p2tr')['p2tr'], amount / 10**8)
285+
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr('all')[good_addrtype()], amount / 10**8)
279286
bitcoind.generate_block(1)
280287
wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == 1)
281288

@@ -311,7 +318,7 @@ def test_txprepare(node_factory, bitcoind, chainparams):
311318

312319
# Add some funds to withdraw later
313320
for i in range(10):
314-
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr('p2tr')['p2tr'],
321+
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr(good_addrtype())[good_addrtype()],
315322
amount / 10**8)
316323

317324
bitcoind.generate_block(1)
@@ -1203,7 +1210,7 @@ def test_txsend(node_factory, bitcoind, chainparams):
12031210

12041211
# Add some funds to withdraw later
12051212
for i in range(10):
1206-
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr('p2tr')['p2tr'],
1213+
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr(good_addrtype())[good_addrtype()],
12071214
amount / 10**8)
12081215
bitcoind.generate_block(1)
12091216
wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == 10)

0 commit comments

Comments
 (0)