MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_bech32_funding

Function test_bech32_funding

tests/test_misc.py:441–461  ·  view source on GitHub ↗
(node_factory, chainparams)

Source from the content-addressed store, hash-verified

439@unittest.skipIf(not TEST_NETWORK == 'regtest', 'must be on bitcoin network')
440@pytest.mark.developer("needs DEVELOPER=1")
441def test_bech32_funding(node_factory, chainparams):
442 # Don't get any funds from previous runs.
443 l1, l2 = node_factory.line_graph(2, opts={'random_hsm': True}, fundchannel=False)
444
445 # fund a bech32 address and then open a channel with it
446 res = l1.openchannel(l2, 25000, 'bech32')
447 address = res['address']
448 assert address.startswith(chainparams['bip173_prefix'])
449
450 # probably overly paranoid checking
451 wallettxid = res['wallettxid']
452
453 wallettx = l1.bitcoin.rpc.getrawtransaction(wallettxid, True)
454 fundingtx = l1.bitcoin.rpc.decoderawtransaction(res['fundingtx'])
455
456 def is_p2wpkh(output):
457 return output['type'] == 'witness_v0_keyhash' and \
458 address == scriptpubkey_addr(output)
459
460 assert any(is_p2wpkh(output['scriptPubKey']) for output in wallettx['vout'])
461 assert only_one(fundingtx['vin'])['txid'] == res['wallettxid']
462
463
464def test_withdraw_misc(node_factory, bitcoind, chainparams):

Callers

nothing calls this directly

Calls 5

only_oneFunction · 0.90
line_graphMethod · 0.80
openchannelMethod · 0.80
is_p2wpkhFunction · 0.70
anyClass · 0.50

Tested by

no test coverage detected