mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
pytest: use bech32 addresses everywhere.
We used to create some p2sh-segwit addresses just to mix things up. This streamlines back to just bech32. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
85fc46f76c
commit
2f36c03307
@ -15,7 +15,7 @@ def test_invoice(node_factory, chainparams):
|
||||
l1, l2 = node_factory.line_graph(2, fundchannel=False, opts={'log-level': 'io'})
|
||||
|
||||
addr1 = l2.rpc.newaddr('bech32')['bech32']
|
||||
addr2 = l2.rpc.newaddr('p2sh-segwit')['p2sh-segwit']
|
||||
addr2 = '2MxqzNANJNAdMjHQq8ZLkwzooxAFiRzXvEz' if not chainparams['elements'] else 'XGx1E2JSTLZLmqYMAo3CGpsco85aS7so33'
|
||||
before = int(time.time())
|
||||
inv = l1.rpc.invoice(123000, 'label', 'description', 3700, [addr1, addr2])
|
||||
|
||||
|
@ -520,7 +520,6 @@ def test_withdraw_misc(node_factory, bitcoind, chainparams):
|
||||
dont_spend_outputs(l1, out['txid'])
|
||||
|
||||
# Now send some money to l2.
|
||||
# lightningd uses P2SH-P2WPKH
|
||||
waddr = l2.rpc.newaddr('bech32')['bech32']
|
||||
out = l1.rpc.withdraw(waddr, amount)
|
||||
bitcoind.generate_block(1)
|
||||
@ -1199,7 +1198,7 @@ def test_blockchaintrack(node_factory, bitcoind):
|
||||
"""Check that we track the blockchain correctly across reorgs
|
||||
"""
|
||||
l1 = node_factory.get_node(random_hsm=True)
|
||||
addr = l1.rpc.newaddr(addresstype='all')['p2sh-segwit']
|
||||
addr = l1.rpc.newaddr(addresstype='all')['bech32']
|
||||
|
||||
######################################################################
|
||||
# First failure scenario: rollback on startup doesn't work,
|
||||
@ -1214,7 +1213,7 @@ def test_blockchaintrack(node_factory, bitcoind):
|
||||
time.sleep(1) # mempool is still unpredictable
|
||||
bitcoind.generate_block(1)
|
||||
|
||||
l1.daemon.wait_for_log(r'Owning output.* \(P2SH\).* CONFIRMED')
|
||||
l1.daemon.wait_for_log(r'Owning output.* CONFIRMED')
|
||||
outputs = l1.rpc.listfunds()['outputs']
|
||||
assert len(outputs) == 1
|
||||
|
||||
@ -2974,7 +2973,7 @@ def test_field_filter(node_factory, chainparams):
|
||||
l1, l2 = node_factory.get_nodes(2)
|
||||
|
||||
addr1 = l1.rpc.newaddr('bech32')['bech32']
|
||||
addr2 = l1.rpc.newaddr('p2sh-segwit')['p2sh-segwit']
|
||||
addr2 = '2MxqzNANJNAdMjHQq8ZLkwzooxAFiRzXvEz' if not chainparams['elements'] else 'XGx1E2JSTLZLmqYMAo3CGpsco85aS7so33'
|
||||
inv = l1.rpc.invoice(123000, 'label', 'description', 3700, [addr1, addr2])
|
||||
|
||||
# Simple case: single field
|
||||
|
@ -292,12 +292,10 @@ def test_txprepare(node_factory, bitcoind, chainparams):
|
||||
l1 = node_factory.get_node(random_hsm=True)
|
||||
addr = chainparams['example_addr']
|
||||
|
||||
# Add some funds to withdraw later: both bech32 and p2sh
|
||||
for i in range(5):
|
||||
# Add some funds to withdraw later
|
||||
for i in range(10):
|
||||
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr()['bech32'],
|
||||
amount / 10**8)
|
||||
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr('p2sh-segwit')['p2sh-segwit'],
|
||||
amount / 10**8)
|
||||
|
||||
bitcoind.generate_block(1)
|
||||
wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == 10)
|
||||
@ -448,14 +446,11 @@ def test_reserveinputs(node_factory, bitcoind, chainparams):
|
||||
l1 = node_factory.get_node(feerates=(7500, 7500, 7500, 7500))
|
||||
|
||||
outputs = []
|
||||
# Add a medley of funds to withdraw later, bech32 + p2sh-p2wpkh
|
||||
for i in range(total_outs // 2):
|
||||
# Add a medley of funds to withdraw
|
||||
for i in range(total_outs):
|
||||
txid = bitcoind.rpc.sendtoaddress(l1.rpc.newaddr()['bech32'],
|
||||
amount / 10**8)
|
||||
outputs.append((txid, bitcoind.rpc.gettransaction(txid)['details'][0]['vout']))
|
||||
txid = bitcoind.rpc.sendtoaddress(l1.rpc.newaddr('p2sh-segwit')['p2sh-segwit'],
|
||||
amount / 10**8)
|
||||
outputs.append((txid, bitcoind.rpc.gettransaction(txid)['details'][0]['vout']))
|
||||
|
||||
bitcoind.generate_block(1)
|
||||
wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == total_outs)
|
||||
@ -504,14 +499,11 @@ def test_fundpsbt(node_factory, bitcoind, chainparams):
|
||||
l1 = node_factory.get_node()
|
||||
|
||||
outputs = []
|
||||
# Add a medley of funds to withdraw later, bech32 + p2sh-p2wpkh
|
||||
for i in range(total_outs // 2):
|
||||
# Add a medley of funds to withdraw later
|
||||
for i in range(total_outs):
|
||||
txid = bitcoind.rpc.sendtoaddress(l1.rpc.newaddr()['bech32'],
|
||||
amount / 10**8)
|
||||
outputs.append((txid, bitcoind.rpc.gettransaction(txid)['details'][0]['vout']))
|
||||
txid = bitcoind.rpc.sendtoaddress(l1.rpc.newaddr('p2sh-segwit')['p2sh-segwit'],
|
||||
amount / 10**8)
|
||||
outputs.append((txid, bitcoind.rpc.gettransaction(txid)['details'][0]['vout']))
|
||||
|
||||
bitcoind.generate_block(1)
|
||||
wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == total_outs)
|
||||
@ -589,13 +581,11 @@ def test_utxopsbt(node_factory, bitcoind, chainparams):
|
||||
l1 = node_factory.get_node()
|
||||
|
||||
outputs = []
|
||||
# Add a medley of funds to withdraw later, bech32 + p2sh-p2wpkh
|
||||
txid = bitcoind.rpc.sendtoaddress(l1.rpc.newaddr()['bech32'],
|
||||
amount / 10**8)
|
||||
outputs.append((txid, bitcoind.rpc.gettransaction(txid)['details'][0]['vout']))
|
||||
txid = bitcoind.rpc.sendtoaddress(l1.rpc.newaddr('p2sh-segwit')['p2sh-segwit'],
|
||||
amount / 10**8)
|
||||
outputs.append((txid, bitcoind.rpc.gettransaction(txid)['details'][0]['vout']))
|
||||
# Add a funds to withdraw later
|
||||
for _ in range(2):
|
||||
txid = bitcoind.rpc.sendtoaddress(l1.rpc.newaddr()['bech32'],
|
||||
amount / 10**8)
|
||||
outputs.append((txid, bitcoind.rpc.gettransaction(txid)['details'][0]['vout']))
|
||||
|
||||
bitcoind.generate_block(1)
|
||||
wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == len(outputs))
|
||||
@ -709,11 +699,10 @@ def test_sign_external_psbt(node_factory, bitcoind, chainparams):
|
||||
amount = 1000000
|
||||
total_outs = 4
|
||||
|
||||
# Add a medley of funds to withdraw later, bech32 + p2sh-p2wpkh
|
||||
for i in range(total_outs // 2):
|
||||
# Add a medley of funds to withdraw later
|
||||
for i in range(total_outs):
|
||||
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr()['bech32'],
|
||||
amount / 10**8)
|
||||
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr('p2sh-segwit')['p2sh-segwit'], amount / 10**8)
|
||||
|
||||
bitcoind.generate_block(1)
|
||||
wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == total_outs)
|
||||
@ -742,12 +731,10 @@ def test_sign_and_send_psbt(node_factory, bitcoind, chainparams):
|
||||
addr = chainparams['example_addr']
|
||||
out_total = Millisatoshi(amount * 3 * 1000)
|
||||
|
||||
# Add a medley of funds to withdraw later, bech32 + p2sh-p2wpkh
|
||||
for i in range(total_outs // 2):
|
||||
# Add a medley of funds to withdraw later
|
||||
for i in range(total_outs):
|
||||
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr()['bech32'],
|
||||
amount / 10**8)
|
||||
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr('p2sh-segwit')['p2sh-segwit'],
|
||||
amount / 10**8)
|
||||
bitcoind.generate_block(1)
|
||||
wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == total_outs)
|
||||
|
||||
@ -808,11 +795,9 @@ def test_sign_and_send_psbt(node_factory, bitcoind, chainparams):
|
||||
l1.rpc.signpsbt(fullpsbt)
|
||||
|
||||
# Queue up another node, to make some PSBTs for us
|
||||
for i in range(total_outs // 2):
|
||||
for i in range(total_outs):
|
||||
bitcoind.rpc.sendtoaddress(l2.rpc.newaddr()['bech32'],
|
||||
amount / 10**8)
|
||||
bitcoind.rpc.sendtoaddress(l2.rpc.newaddr('p2sh-segwit')['p2sh-segwit'],
|
||||
amount / 10**8)
|
||||
# Create a PSBT using L2
|
||||
bitcoind.generate_block(1)
|
||||
wait_for(lambda: len(l2.rpc.listfunds()['outputs']) == total_outs)
|
||||
@ -928,12 +913,10 @@ def test_txsend(node_factory, bitcoind, chainparams):
|
||||
l1 = node_factory.get_node(random_hsm=True)
|
||||
addr = chainparams['example_addr']
|
||||
|
||||
# Add some funds to withdraw later: both bech32 and p2sh
|
||||
for i in range(5):
|
||||
# Add some funds to withdraw later
|
||||
for i in range(10):
|
||||
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr()['bech32'],
|
||||
amount / 10**8)
|
||||
bitcoind.rpc.sendtoaddress(l1.rpc.newaddr('p2sh-segwit')['p2sh-segwit'],
|
||||
amount / 10**8)
|
||||
bitcoind.generate_block(1)
|
||||
wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == 10)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user