channeld/dualopend/lightningd: use channel_ready everywhere.

This alters the billboard, but that's a human-readable thing so not
noted in CHANGELOG.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: JSON-RPC: `listpeers` `status` now refers to "channel ready" rather than "funding locked" (BOLT language change for zeroconf channels)
Changelog-Added: JSON-RPC: `channel_opened` notification `channel_ready` flag.
Changelog-Deprecated: JSON-RPC: `channel_opened` notification `funding_locked` flag (use `channel_ready`: BOLTs namechange).
This commit is contained in:
Rusty Russell 2022-09-10 11:41:31 +09:30
parent 1b30ea4b82
commit 5b7f14a7cb
13 changed files with 37 additions and 35 deletions

View File

@ -2952,7 +2952,7 @@ skip_tlvs:
&& next_commitment_number == 1) {
struct tlv_channel_ready_tlvs *tlvs = tlv_channel_ready_tlvs_new(tmpctx);
status_debug("Retransmitting funding_locked for channel %s",
status_debug("Retransmitting channel_ready for channel %s",
type_to_string(tmpctx, struct channel_id, &peer->channel_id));
/* Contains per commit point #1, for first post-opening commit */
msg = towire_channel_ready(NULL,

View File

@ -4,7 +4,7 @@
#include <common/utils.h>
char *billboard_message(const tal_t *ctx,
const bool funding_locked[NUM_SIDES],
const bool channel_ready[NUM_SIDES],
const bool have_sigs[NUM_SIDES],
const bool shutdown_sent[NUM_SIDES],
u32 depth_togo,
@ -13,17 +13,17 @@ char *billboard_message(const tal_t *ctx,
const char *funding_status, *announce_status,
*shutdown_status COMPILER_WANTS_INIT("gcc 8.3.0");
if (funding_locked[LOCAL] && funding_locked[REMOTE])
funding_status = "Funding transaction locked.";
else if (!funding_locked[LOCAL] && !funding_locked[REMOTE])
if (channel_ready[LOCAL] && channel_ready[REMOTE])
funding_status = "Channel ready for use.";
else if (!channel_ready[LOCAL] && !channel_ready[REMOTE])
funding_status = tal_fmt(ctx,
"Funding needs %d more"
" confirmations for lockin.",
" confirmations to be ready.",
depth_togo);
else if (funding_locked[LOCAL] && !funding_locked[REMOTE])
funding_status = "We've confirmed funding, they haven't yet.";
else if (!funding_locked[LOCAL] && funding_locked[REMOTE])
funding_status = "They've confirmed funding, we haven't yet.";
else if (channel_ready[LOCAL] && !channel_ready[REMOTE])
funding_status = "We've confirmed channel ready, they haven't yet.";
else if (!channel_ready[LOCAL] && channel_ready[REMOTE])
funding_status = "They've confirmed channel ready, we haven't yet.";
if (have_sigs) {
if (have_sigs[LOCAL] && have_sigs[REMOTE])

View File

@ -5,7 +5,7 @@
#include <common/htlc.h>
char *billboard_message(const tal_t *ctx,
const bool funding_locked[NUM_SIDES],
const bool channel_ready[NUM_SIDES],
const bool have_sigs[NUM_SIDES],
const bool shutdown_sent[NUM_SIDES],
u32 depth_togo,

View File

@ -441,7 +441,7 @@ if the funding transaction has been included into a block.
"id": "03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f",
"funding_msat": 100000000,
"funding_txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
"funding_locked": false
"channel_ready": false
}
}
```

View File

@ -1790,7 +1790,7 @@ void dualopen_tell_depth(struct subd *dualopend,
} else
channel_set_billboard(channel, false,
tal_fmt(tmpctx, "Funding needs %d more"
" confirmations for lockin.",
" confirmations to be ready.",
to_go));
}

View File

@ -201,13 +201,15 @@ static void channel_opened_notification_serialize(struct json_stream *stream,
struct node_id *node_id,
struct amount_sat *funding_sat,
struct bitcoin_txid *funding_txid,
bool funding_locked)
bool channel_ready)
{
json_object_start(stream, "channel_opened");
json_add_node_id(stream, "id", node_id);
json_add_amount_sats_deprecated(stream, "amount", "funding_msat", *funding_sat);
json_add_txid(stream, "funding_txid", funding_txid);
json_add_bool(stream, "funding_locked", funding_locked);
if (deprecated_apis)
json_add_bool(stream, "funding_locked", channel_ready);
json_add_bool(stream, "channel_ready", channel_ready);
json_object_end(stream);
}
@ -216,7 +218,7 @@ REGISTER_NOTIFICATION(channel_opened,
void notify_channel_opened(struct lightningd *ld, struct node_id *node_id,
struct amount_sat *funding_sat, struct bitcoin_txid *funding_txid,
bool funding_locked)
bool channel_ready)
{
void (*serialize)(struct json_stream *,
struct node_id *,
@ -226,7 +228,7 @@ void notify_channel_opened(struct lightningd *ld, struct node_id *node_id,
struct jsonrpc_notification *n
= jsonrpc_notification_start(NULL, channel_opened_notification_gen.topic);
serialize(n->stream, node_id, funding_sat, funding_txid, funding_locked);
serialize(n->stream, node_id, funding_sat, funding_txid, channel_ready);
jsonrpc_notification_end(n);
plugins_notify(ld->plugins, take(n));
}

View File

@ -47,7 +47,7 @@ void notify_invoice_creation(struct lightningd *ld, struct amount_msat *amount,
void notify_channel_opened(struct lightningd *ld, struct node_id *node_id,
struct amount_sat *funding_sat, struct bitcoin_txid *funding_txid,
bool funding_locked);
bool channel_ready);
void notify_channel_state_changed(struct lightningd *ld,
struct node_id *peer_id,

View File

@ -3620,7 +3620,7 @@ static void do_reconnect_dance(struct state *state)
}
if (state->channel_ready[LOCAL]) {
status_debug("Retransmitting funding_locked for channel %s",
status_debug("Retransmitting channel_ready for channel %s",
type_to_string(tmpctx,
struct channel_id,
&state->channel_id));

View File

@ -50,8 +50,8 @@ msgdata,dualopend_reinit,their_basepoints,basepoints,
msgdata,dualopend_reinit,remote_per_commit,pubkey,
msgdata,dualopend_reinit,funding_psbt,wally_psbt,
msgdata,dualopend_reinit,opener,enum side,
msgdata,dualopend_reinit,local_funding_locked,bool,
msgdata,dualopend_reinit,remote_funding_locked,bool,
msgdata,dualopend_reinit,local_channel_ready,bool,
msgdata,dualopend_reinit,remote_channel_ready,bool,
msgdata,dualopend_reinit,send_shutdown,bool,
msgdata,dualopend_reinit,remote_shutdown_received,bool,
msgdata,dualopend_reinit,local_shutdown_len,u16,

Can't render this file because it has a wrong number of fields in line 14.

View File

@ -33,9 +33,9 @@ def test_closing_simple(node_factory, bitcoind, chainparams):
assert bitcoind.rpc.getmempoolinfo()['size'] == 0
billboard = only_one(l1.rpc.listpeers(l2.info['id'])['peers'][0]['channels'])['status']
assert billboard == ['CHANNELD_NORMAL:Funding transaction locked.']
assert billboard == ['CHANNELD_NORMAL:Channel ready for use.']
billboard = only_one(l2.rpc.listpeers(l1.info['id'])['peers'][0]['channels'])['status']
assert billboard == ['CHANNELD_NORMAL:Funding transaction locked.']
assert billboard == ['CHANNELD_NORMAL:Channel ready for use.']
bitcoind.generate_block(5)
@ -44,7 +44,7 @@ def test_closing_simple(node_factory, bitcoind, chainparams):
billboard = only_one(l1.rpc.listpeers(l2.info['id'])['peers'][0]['channels'])['status']
# This may either be from a local_update or an announce, so just
# check for the substring
assert 'CHANNELD_NORMAL:Funding transaction locked.' in billboard[0]
assert 'CHANNELD_NORMAL:Channel ready for use.' in billboard[0]
l1.rpc.close(chan)

View File

@ -669,9 +669,9 @@ def test_reconnect_gossiping(node_factory):
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_reconnect_no_update(node_factory, executor, bitcoind):
"""Test that funding_locked is retransmitted on reconnect if new channel
"""Test that channel_ready is retransmitted on reconnect if new channel
This tests if the `funding_locked` is sent if we receive a
This tests if the `channel_ready` is sent if we receive a
`channel_reestablish` message with `next_commitment_number` == 1
and our `next_commitment_number` == 1.
@ -689,14 +689,14 @@ def test_reconnect_no_update(node_factory, executor, bitcoind):
l1.rpc.connect(l2.info["id"], "localhost", l2.port)
# LightningNode.fundchannel will fund the channel and generate a
# block. The block triggers the funding_locked message, which
# block. The block triggers the channel_ready message, which
# causes a disconnect. The retransmission is then caused by the
# automatic retry.
fundchannel_exec = executor.submit(l1.fundchannel, l2, 10**6, False)
if l1.config('experimental-dual-fund'):
l1.daemon.wait_for_log(r"dualopend.* Retransmitting funding_locked for channel")
l1.daemon.wait_for_log(r"dualopend.* Retransmitting channel_ready for channel")
else:
l1.daemon.wait_for_log(r"channeld.* Retransmitting funding_locked for channel")
l1.daemon.wait_for_log(r"channeld.* Retransmitting channel_ready for channel")
sync_blockheight(bitcoind, [l1, l2])
fundchannel_exec.result()
l1.stop()
@ -706,7 +706,7 @@ def test_reconnect_no_update(node_factory, executor, bitcoind):
# Close will trigger the -WIRE_SHUTDOWN and we then wait for the
# automatic reconnection to trigger the retransmission.
l1.rpc.close(l2.info['id'], 0)
l2.daemon.wait_for_log(r"channeld.* Retransmitting funding_locked for channel")
l2.daemon.wait_for_log(r"channeld.* Retransmitting channel_ready for channel")
l1.daemon.wait_for_log(r"CLOSINGD_COMPLETE")
@ -913,7 +913,7 @@ def test_reconnect_remote_sends_no_sigs(node_factory):
# l2 will now uses (REMOTE's) announcement_signatures it has stored
wait_for(lambda: only_one(l2.rpc.listpeers()['peers'][0]['channels'])['status'] == [
'CHANNELD_NORMAL:Reconnected, and reestablished.',
'CHANNELD_NORMAL:Funding transaction locked. Channel announced.'])
'CHANNELD_NORMAL:Channel ready for use. Channel announced.'])
# But l2 still sends its own sigs on reconnect
l2.daemon.wait_for_logs([r'peer_out WIRE_ANNOUNCEMENT_SIGNATURES',

View File

@ -1108,7 +1108,7 @@ def test_funding_reorg_private(node_factory, bitcoind):
daemon = 'DUALOPEND' if l1.config('experimental-dual-fund') else 'CHANNELD'
wait_for(lambda: only_one(l1.rpc.listpeers()['peers'][0]['channels'])['status']
== ['{}_AWAITING_LOCKIN:Funding needs 1 more confirmations for lockin.'.format(daemon)])
== ['{}_AWAITING_LOCKIN:Funding needs 1 more confirmations to be ready.'.format(daemon)])
bitcoind.generate_block(1) # height 107
l1.wait_channel_active('106x1x0')
l2.wait_channel_active('106x1x0')
@ -1166,7 +1166,7 @@ def test_funding_reorg_remote_lags(node_factory, bitcoind):
wait_for(lambda: only_one(l2.rpc.listpeers()['peers'][0]['channels'])['status'] == [
'CHANNELD_NORMAL:Reconnected, and reestablished.',
'CHANNELD_NORMAL:Funding transaction locked. They need our announcement signatures.'])
'CHANNELD_NORMAL:Channel ready for use. They need our announcement signatures.'])
# Unblinding l2 brings it back in sync, restarts channeld and sends its announce sig
l2.daemon.rpcproxy.mock_rpc('getblockhash', None)
@ -1176,7 +1176,7 @@ def test_funding_reorg_remote_lags(node_factory, bitcoind):
wait_for(lambda: only_one(l2.rpc.listpeers()['peers'][0]['channels'])['status'] == [
'CHANNELD_NORMAL:Reconnected, and reestablished.',
'CHANNELD_NORMAL:Funding transaction locked. Channel announced.'])
'CHANNELD_NORMAL:Channel ready for use. Channel announced.'])
l1.rpc.close(l2.info['id'])
bitcoind.generate_block(1, True)

View File

@ -1275,7 +1275,7 @@ def test_zeroconf_mindepth(bitcoind, node_factory):
bitcoind.generate_block(2, wait_for_mempool=1) # Confirm on the l2 side.
l2.daemon.wait_for_log(r'peer_out WIRE_CHANNEL_READY')
# l1 should not be sending funding_locked/channel_ready yet, it is
# l1 should not be sending channel_ready yet, it is
# configured to wait for 6 confirmations.
assert not l1.daemon.is_in_log(r'peer_out WIRE_CHANNEL_READY')