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

Function test_closing_cpfp

tests/test_closing.py:4625–4651  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

4623
4624
4625def test_closing_cpfp(node_factory, bitcoind):
4626 l1, l2 = node_factory.line_graph(2, opts={'min-emergency-msat': '2500sat'})
4627
4628 # We want to ignore l1's change output
4629 change = only_one(l1.rpc.listfunds()['outputs'])
4630
4631 # Make sure both sides have some output
4632 l1.rpc.xpay(l2.rpc.invoice(10000000, 'test', 'test')['bolt11'])
4633
4634 # Mutual close
4635 close_txid = only_one(l1.rpc.close(l2.info['id'])['txids'])
4636
4637 l1out = only_one([o for o in l1.rpc.listfunds()['outputs'] if o != change])
4638 assert l1out['txid'] == close_txid
4639 l1.rpc.withdraw(l1.rpc.newaddr('bech32')['bech32'], 'all', '20000perkb', minconf=0, utxos=["{}:{}".format(l1out['txid'], l1out['output'])])
4640
4641 # l2 should be able to do this too!
4642 l2out = only_one(l2.rpc.listfunds()['outputs'])
4643 assert l2out['txid'] == close_txid
4644 l2.rpc.withdraw(l2.rpc.newaddr('bech32')['bech32'], 'all', '20000perkb', minconf=0, utxos=["{}:{}".format(l2out['txid'], l2out['output'])])
4645
4646 # There should be *three* transactions in mempool now!
4647 bitcoind.generate_block(1, wait_for_mempool=3)
4648
4649 # They should now see a single additional output each
4650 sync_blockheight(bitcoind, [l1, l2])
4651 assert len(l1.rpc.listfunds()['outputs']) == 2
4652
4653
4654@pytest.mark.skip("Solely to generate the blockchain and test dbs, before we fixed output p2pkh watching")

Callers

nothing calls this directly

Calls 10

only_oneFunction · 0.90
sync_blockheightFunction · 0.90
line_graphMethod · 0.80
generate_blockMethod · 0.80
listfundsMethod · 0.45
xpayMethod · 0.45
invoiceMethod · 0.45
closeMethod · 0.45
withdrawMethod · 0.45
newaddrMethod · 0.45

Tested by

no test coverage detected