lightningd/opening_control.c: fundchannel_cancel no longer requires a channel_id argument.

Fixes: #3785

Changelog-Changed: `fundchannel_cancel` no longer requires its undocumented `channel_id` argument after `fundchannel_complete`.
This commit is contained in:
ZmnSCPxj jxPCSnmZ
2020-06-24 12:34:26 +08:00
committed by ZmnSCPxj, ZmnSCPxj jxPCSmnZ
parent 2ab41af8e2
commit deabab8934
7 changed files with 56 additions and 73 deletions

View File

@@ -1162,8 +1162,8 @@ def test_funding_close_upfront(node_factory, bitcoind):
@unittest.skipIf(TEST_NETWORK != 'regtest', "External wallet support doesn't work with elements yet.")
def test_funding_external_wallet(node_factory, bitcoind):
l1 = node_factory.get_node()
l2 = node_factory.get_node()
l1 = node_factory.get_node(options={'funding-confirms': 2})
l2 = node_factory.get_node(options={'funding-confirms': 2})
l3 = node_factory.get_node()
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
@@ -1197,20 +1197,23 @@ def test_funding_external_wallet(node_factory, bitcoind):
assert l1.rpc.fundchannel_complete(l2.info['id'], txid, txout)['commitments_secured']
# Broadcast the transaction manually and confirm that channel locks in
# Broadcast the transaction manually
signed_tx = bitcoind.rpc.signrawtransactionwithwallet(raw_funded_tx)['hex']
assert txid == bitcoind.rpc.decoderawtransaction(signed_tx)['txid']
bitcoind.rpc.sendrawtransaction(signed_tx)
bitcoind.generate_block(1)
l1.daemon.wait_for_log(r'Funding tx {} depth 1 of 1'.format(txid))
l1.daemon.wait_for_log(r'Funding tx {} depth 1 of 2'.format(txid))
# Check that tx is broadcast by a third party can be catched.
# Only when the transaction (broadcast by a third pary) is onchain, we can catch it.
with pytest.raises(RpcError, match=r'.* been broadcast.*'):
l1.rpc.fundchannel_cancel(l2.info['id'])
# Confirm that channel locks in
bitcoind.generate_block(1)
for node in [l1, l2]:
node.daemon.wait_for_log(r'State changed from CHANNELD_AWAITING_LOCKIN to CHANNELD_NORMAL')
channel = node.rpc.listpeers()['peers'][0]['channels'][0]