mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
test: test_bech32_funding
1. Test wallet funding to a bech32 p2wpkh address 2. Test channel opening with this address Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
Rusty Russell
parent
0e59e091e7
commit
3d27bbb47d
@@ -2521,6 +2521,32 @@ class LightningDTests(BaseLightningDTests):
|
||||
l2.daemon.wait_for_logs(['sendrawtx exit 0', ' to CLOSINGD_COMPLETE'])
|
||||
assert l1.bitcoin.rpc.getmempoolinfo()['size'] == 1
|
||||
|
||||
def test_bech32_funding(self):
|
||||
# Don't get any funds from previous runs.
|
||||
l1 = self.node_factory.get_node(random_hsm=True)
|
||||
l2 = self.node_factory.get_node(random_hsm=True)
|
||||
|
||||
# connect
|
||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.info['port'])
|
||||
|
||||
# fund a bech32 address and then open a channel with it
|
||||
res = l1.openchannel(l2, 20000, addrtype='bech32')
|
||||
address = res['address']
|
||||
assert address[0:4] == "bcrt"
|
||||
|
||||
# probably overly paranoid checking
|
||||
wallettxid = res['wallettxid']
|
||||
|
||||
wallettx = l1.bitcoin.rpc.getrawtransaction(wallettxid, True)
|
||||
fundingtx = l1.bitcoin.rpc.decoderawtransaction(res['fundingtx']['tx'])
|
||||
|
||||
def is_p2wpkh(output):
|
||||
return output['type'] == 'witness_v0_keyhash' and \
|
||||
address == output['addresses'][0]
|
||||
|
||||
assert any(is_p2wpkh(output['scriptPubKey']) for output in wallettx['vout'])
|
||||
assert fundingtx['vin'][0]['txid'] == res['wallettxid']
|
||||
|
||||
def test_withdraw(self):
|
||||
amount = 1000000
|
||||
# Don't get any funds from previous runs.
|
||||
|
||||
Reference in New Issue
Block a user