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 ):
@@ -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" )
234242def 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" )
306315def 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" )
11991209def 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