Skip to content

Commit 2c358e6

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

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

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: 15 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):
@@ -231,14 +238,15 @@ def test_minconf_withdraw(node_factory, bitcoind):
231238
l1.rpc.withdraw(destination=addr, satoshi=10000, feerate='normal', minconf=9999999)
232239

233240

241+
@unittest.skipIf(TEST_NETWORK == 'liquid-regtest', "BIP86 random_hsm not compatible with liquid-regtest bech32")
234242
def test_addfunds_from_block(node_factory, bitcoind):
235243
"""Send funds to the daemon without telling it explicitly
236244
"""
237245
# Previous runs with same bitcoind can leave funds!
238246
coin_plugin = os.path.join(os.getcwd(), 'tests/plugins/coin_movements.py')
239247
l1 = node_factory.get_node(random_hsm=True, options={'plugin': coin_plugin})
240248

241-
addr = l1.rpc.newaddr('p2tr')['p2tr']
249+
addr = l1.rpc.newaddr(good_addrtype())[good_addrtype()]
242250
bitcoind.rpc.sendtoaddress(addr, 0.1)
243251
bitcoind.generate_block(1)
244252

@@ -275,7 +283,7 @@ def test_txprepare_multi(node_factory, bitcoind):
275283
amount = 10000000
276284
l1 = node_factory.get_node(random_hsm=True)
277285

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

@@ -303,6 +311,7 @@ def feerate_from_psbt(chainparams, bitcoind, node, psbt):
303311
return fee / weight * 1000
304312

305313

314+
@unittest.skipIf(TEST_NETWORK == 'liquid-regtest', "BIP86 random_hsm not compatible with liquid-regtest bech32")
306315
def test_txprepare(node_factory, bitcoind, chainparams):
307316
amount = 1000000
308317
l1 = node_factory.get_node(random_hsm=True, options={'dev-warn-on-overgrind': None},
@@ -311,7 +320,7 @@ def test_txprepare(node_factory, bitcoind, chainparams):
311320

312321
# Add some funds to withdraw later
313322
for i in range(10):
314-
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr('p2tr')['p2tr'],
323+
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr(good_addrtype())[good_addrtype()],
315324
amount / 10**8)
316325

317326
bitcoind.generate_block(1)
@@ -1196,14 +1205,15 @@ def test_sign_and_send_psbt(node_factory, bitcoind, chainparams):
11961205
check_coin_moves(l1, 'wallet', wallet_coin_mvts, chainparams)
11971206

11981207

1208+
@unittest.skipIf(TEST_NETWORK == 'liquid-regtest', "BIP86 random_hsm not compatible with liquid-regtest bech32")
11991209
def test_txsend(node_factory, bitcoind, chainparams):
12001210
amount = 1000000
12011211
l1 = node_factory.get_node(random_hsm=True)
12021212
addr = chainparams['example_addr']
12031213

12041214
# Add some funds to withdraw later
12051215
for i in range(10):
1206-
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr('p2tr')['p2tr'],
1216+
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr(good_addrtype())[good_addrtype()],
12071217
amount / 10**8)
12081218
bitcoind.generate_block(1)
12091219
wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == 10)

0 commit comments

Comments
 (0)