mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +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
@@ -327,15 +327,20 @@ class LightningNode(object):
|
||||
else:
|
||||
return wait_connected()
|
||||
|
||||
def openchannel(self, remote_node, capacity):
|
||||
addr = self.rpc.newaddr()['address']
|
||||
txid = self.bitcoin.rpc.sendtoaddress(addr, capacity / 10**6)
|
||||
self.bitcoin.generate_block(1)
|
||||
self.daemon.wait_for_log('Owning output .* txid {}'.format(txid))
|
||||
self.rpc.fundchannel(remote_node.info['id'], capacity)
|
||||
def openchannel(self, remote_node, capacity, addrtype="p2sh-segwit"):
|
||||
addr, wallettxid = self.fundwallet(capacity, addrtype)
|
||||
fundingtx = self.rpc.fundchannel(remote_node.info['id'], capacity)
|
||||
self.daemon.wait_for_log('sendrawtx exit 0, gave')
|
||||
self.bitcoin.generate_block(6)
|
||||
self.daemon.wait_for_log('to CHANNELD_NORMAL|STATE_NORMAL')
|
||||
return {'address': addr, 'wallettxid': wallettxid, 'fundingtx': fundingtx}
|
||||
|
||||
def fundwallet(self, sats, addrtype="p2sh-segwit"):
|
||||
addr = self.rpc.newaddr(addrtype)['address']
|
||||
txid = self.bitcoin.rpc.sendtoaddress(addr, sats / 10**6)
|
||||
self.bitcoin.generate_block(1)
|
||||
self.daemon.wait_for_log('Owning output .* txid {}'.format(txid))
|
||||
return addr, txid
|
||||
|
||||
def getactivechannels(self):
|
||||
return [c for c in self.rpc.listchannels()['channels'] if c['active']]
|
||||
|
||||
Reference in New Issue
Block a user