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

Function test_p2tr_funding

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

Source from the content-addressed store, hash-verified

568
569@unittest.skipIf(TEST_NETWORK == 'liquid-regtest', 'must be on bitcoin network')
570def test_p2tr_funding(node_factory, chainparams):
571 # Don't get any funds from previous runs.
572 l1, l2 = node_factory.line_graph(2, opts={'random_hsm': True}, fundchannel=False)
573
574 # fund a p2tr address and then open a channel with it
575 res = l1.openchannel(l2, 25000, 'p2tr')
576 address = res['address']
577 assert address.startswith(chainparams['bip173_prefix'])
578
579 # probably overly paranoid checking
580 wallettxid = res['wallettxid']
581
582 wallettx = l1.bitcoin.rpc.getrawtransaction(wallettxid, True)
583 fundingtx = l1.bitcoin.rpc.decoderawtransaction(res['fundingtx'])
584
585 def is_p2tr(output):
586 return output['type'] == 'witness_v1_taproot' and \
587 address == scriptpubkey_addr(output)
588
589 assert any(is_p2tr(output['scriptPubKey']) for output in wallettx['vout'])
590 assert only_one(fundingtx['vin'])['txid'] == res['wallettxid']
591
592
593@unittest.skipIf(TEST_NETWORK == 'liquid-regtest', "P2TR not yet supported on Elements")

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected