2424HSM_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" )
2835def 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