Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecations and spec updates post-0.12 #5490

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2003a1b
test: fix tlvs test in funding_locked tlv.
rustyrussell Sep 10, 2022
1657202
wire/test: neaten and complete tlv checks.
rustyrussell Sep 10, 2022
0bb9cc3
common: remove unused parameter "allow_deprecated" from parse_wireadd…
rustyrussell Sep 10, 2022
e241348
lightningd: remove double-wrapped rpc_command hook.
rustyrussell Sep 10, 2022
986a0c2
lightningd: always require "jsonrpc": "2.0" in request.
rustyrussell Sep 10, 2022
560b7ef
lightningd: don't allow old listforwards arg order.
rustyrussell Sep 10, 2022
13738d1
lightningd: do inline parsing for listforwards status parameter
rustyrussell Sep 10, 2022
c6b2832
plugins: require usage for plugin APIs.
rustyrussell Sep 10, 2022
ffd6b70
lightningd: remove `use_proxy_always` parameter to plugin init.
rustyrussell Sep 10, 2022
185be8d
listchannels: don't show "htlc_maximum_msat" if channel_update didn't…
rustyrussell Sep 10, 2022
b90ba77
offers: update to remove "vendor" and "timestamp" fields.
rustyrussell Sep 10, 2022
258cdf8
offers: remove backwards-compatiblity invoice_request signatures.
rustyrussell Sep 10, 2022
d3a573d
hsmtool: remove hsm_secret passwords on cmdline support in `dumponcha…
rustyrussell Sep 10, 2022
a0eeb0b
devtools/bolt-catchup.sh: a tool to update the specs, one commit at a…
rustyrussell Sep 10, 2022
00bce5e
doc: increase BOLT level to 03468e17563650fb9bfe58b2da4d1e5d28e92009
rustyrussell Sep 10, 2022
4543a7d
doc: update BOLTs to bc86304b4b0af5fd5ce9d24f74e2ebbceb7e2730
rustyrussell Sep 10, 2022
cbb569e
channeld/dualopend/lightningd: use channel_ready everywhere.
rustyrussell Sep 10, 2022
7580973
doc: upgrade to BOLTs 2ecc091f3484f7a3450e7f5543ae851edd1e0761
rustyrussell Sep 10, 2022
4d6efb4
doc: upgrade to BOLTs 341ec844f13c0c0abc4fe849059fbb98173f9766
rustyrussell Sep 10, 2022
380ee93
doc: include recent BOLT recommendation on grace period.
rustyrussell Sep 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ CCANDIR := ccan

# Where we keep the BOLT RFCs
BOLTDIR := ../bolts/
DEFAULT_BOLTVERSION := 105c2e5e9f17c68e8c19dc4ca548600a0b8f66f0
DEFAULT_BOLTVERSION := 341ec844f13c0c0abc4fe849059fbb98173f9766
# Can be overridden on cmdline.
BOLTVERSION := $(DEFAULT_BOLTVERSION)

Expand Down
97 changes: 50 additions & 47 deletions channeld/channeld.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Main channel operation daemon: runs from funding_locked to shutdown_complete.
/* Main channel operation daemon: runs from channel_ready to shutdown_complete.
*
* We're fairly synchronous: our main loop looks for master or
* peer requests and services them synchronously.
Expand Down Expand Up @@ -52,7 +52,7 @@

struct peer {
struct per_peer_state *pps;
bool funding_locked[NUM_SIDES];
bool channel_ready[NUM_SIDES];
u64 next_index[NUM_SIDES];

/* Features peer supports. */
Expand Down Expand Up @@ -182,7 +182,7 @@ struct peer {
/* Penalty bases for this channel / peer. */
struct penalty_base **pbases;

/* We allow a 'tx-sigs' message between reconnect + funding_locked */
/* We allow a 'tx-sigs' message between reconnect + channel_ready */
bool tx_sigs_allowed;

/* Have we announced the real scid with a
Expand All @@ -204,7 +204,7 @@ static void start_commit_timer(struct peer *peer);

static void billboard_update(const struct peer *peer)
{
const char *update = billboard_message(tmpctx, peer->funding_locked,
const char *update = billboard_message(tmpctx, peer->channel_ready,
peer->have_sigs,
peer->shutdown_sent,
peer->depth_togo,
Expand Down Expand Up @@ -539,7 +539,7 @@ static void channel_announcement_negotiate(struct peer *peer)
return;

/* Can't do anything until funding is locked. */
if (!peer->funding_locked[LOCAL] || !peer->funding_locked[REMOTE])
if (!peer->channel_ready[LOCAL] || !peer->channel_ready[REMOTE])
return;

if (!peer->channel_local_active) {
Expand All @@ -560,7 +560,7 @@ static void channel_announcement_negotiate(struct peer *peer)
* A node:
* - if the `open_channel` message has the `announce_channel` bit set AND a `shutdown` message has not been sent:
* - MUST send the `announcement_signatures` message.
* - MUST NOT send `announcement_signatures` messages until `funding_locked`
* - MUST NOT send `announcement_signatures` messages until `channel_ready`
* has been sent and received AND the funding transaction has at least six confirmations.
* - otherwise:
* - MUST NOT send the `announcement_signatures` message.
Expand All @@ -570,7 +570,7 @@ static void channel_announcement_negotiate(struct peer *peer)

/* BOLT #7:
*
* - MUST NOT send `announcement_signatures` messages until `funding_locked`
* - MUST NOT send `announcement_signatures` messages until `channel_ready`
* has been sent and received AND the funding transaction has at least six confirmations.
*/
if (peer->announce_depth_reached && !peer->have_sigs[LOCAL]) {
Expand Down Expand Up @@ -602,29 +602,29 @@ static void channel_announcement_negotiate(struct peer *peer)
}
}

static void handle_peer_funding_locked(struct peer *peer, const u8 *msg)
static void handle_peer_channel_ready(struct peer *peer, const u8 *msg)
{
struct channel_id chanid;
struct tlv_funding_locked_tlvs *tlvs;
struct tlv_channel_ready_tlvs *tlvs;
/* BOLT #2:
*
* A node:
*...
* - upon reconnection:
* - MUST ignore any redundant `funding_locked` it receives.
* - MUST ignore any redundant `channel_ready` it receives.
*/
if (peer->funding_locked[REMOTE])
if (peer->channel_ready[REMOTE])
return;

/* Too late, we're shutting down! */
if (peer->shutdown_sent[LOCAL])
return;

peer->old_remote_per_commit = peer->remote_per_commit;
if (!fromwire_funding_locked(msg, msg, &chanid,
if (!fromwire_channel_ready(msg, msg, &chanid,
&peer->remote_per_commit, &tlvs))
peer_failed_warn(peer->pps, &peer->channel_id,
"Bad funding_locked %s", tal_hex(msg, msg));
"Bad channel_ready %s", tal_hex(msg, msg));

if (!channel_id_eq(&chanid, &peer->channel_id))
peer_failed_err(peer->pps, &chanid,
Expand All @@ -634,17 +634,17 @@ static void handle_peer_funding_locked(struct peer *peer, const u8 *msg)
&peer->channel_id));

peer->tx_sigs_allowed = false;
peer->funding_locked[REMOTE] = true;
if (tlvs->alias != NULL) {
peer->channel_ready[REMOTE] = true;
if (tlvs->short_channel_id != NULL) {
status_debug(
"Peer told us that they'll use alias=%s for this channel",
type_to_string(tmpctx, struct short_channel_id,
tlvs->alias));
peer->short_channel_ids[REMOTE] = *tlvs->alias;
tlvs->short_channel_id));
peer->short_channel_ids[REMOTE] = *tlvs->short_channel_id;
}
wire_sync_write(MASTER_FD,
take(towire_channeld_got_funding_locked(
NULL, &peer->remote_per_commit, tlvs->alias)));
take(towire_channeld_got_channel_ready(
NULL, &peer->remote_per_commit, tlvs->short_channel_id)));

channel_announcement_negotiate(peer);
billboard_update(peer);
Expand Down Expand Up @@ -1254,8 +1254,9 @@ static void send_commit(struct peer *peer)

/* BOLT #2:
*
* - if no HTLCs remain in either commitment transaction:
* - MUST NOT send any `update` message after a `shutdown`.
* - if no HTLCs remain in either commitment transaction (including dust HTLCs)
* and neither side has a pending `revoke_and_ack` to send:
* - MUST NOT send any `update` message after that point.
*/
if (peer->shutdown_sent[LOCAL] && !num_channel_htlcs(peer->channel)) {
status_debug("Can't send commit: final shutdown phase");
Expand Down Expand Up @@ -2119,8 +2120,8 @@ static void handle_unexpected_tx_sigs(struct peer *peer, const u8 *msg)
struct bitcoin_txid txid;

/* In a rare case, a v2 peer may re-send a tx_sigs message.
* This happens when they've/we've exchanged funding_locked,
* but they did not receive our funding_locked. */
* This happens when they've/we've exchanged channel_ready,
* but they did not receive our channel_ready. */
if (!fromwire_tx_signatures(tmpctx, msg, &cid, &txid,
cast_const3(struct witness_stack ***, &ws)))
peer_failed_warn(peer->pps, &peer->channel_id,
Expand Down Expand Up @@ -2212,9 +2213,9 @@ static void peer_in(struct peer *peer, const u8 *msg)
if (handle_peer_error(peer->pps, &peer->channel_id, msg))
return;

/* Must get funding_locked before almost anything. */
if (!peer->funding_locked[REMOTE]) {
if (type != WIRE_FUNDING_LOCKED
/* Must get channel_ready before almost anything. */
if (!peer->channel_ready[REMOTE]) {
if (type != WIRE_CHANNEL_READY
&& type != WIRE_SHUTDOWN
/* We expect these for v2 !! */
&& type != WIRE_TX_SIGNATURES
Expand All @@ -2228,8 +2229,8 @@ static void peer_in(struct peer *peer, const u8 *msg)
}

switch (type) {
case WIRE_FUNDING_LOCKED:
handle_peer_funding_locked(peer, msg);
case WIRE_CHANNEL_READY:
handle_peer_channel_ready(peer, msg);
return;
case WIRE_ANNOUNCEMENT_SIGNATURES:
handle_peer_announcement_signatures(peer, msg);
Expand Down Expand Up @@ -2664,7 +2665,7 @@ static void check_current_dataloss_fields(struct peer *peer,
status_debug("option_data_loss_protect: fields are correct");
}

/* Older LND sometimes sends funding_locked before reestablish! */
/* Older LND sometimes sends channel_ready before reestablish! */
/* ... or announcement_signatures. Sigh, let's handle whatever they send. */
static bool capture_premature_msg(const u8 ***shit_lnd_says, const u8 *msg)
{
Expand Down Expand Up @@ -2941,19 +2942,21 @@ static void peer_reconnect(struct peer *peer,
*
* - if `next_commitment_number` is 1 in both the
* `channel_reestablish` it sent and received:
* - MUST retransmit `funding_locked`.
* - MUST retransmit `channel_ready`.
* - otherwise:
* - MUST NOT retransmit `funding_locked`.
* - MUST NOT retransmit `channel_ready`, but MAY send
* `channel_ready` with a different `short_channel_id`
* `alias` field.
*/
if (peer->funding_locked[LOCAL]
if (peer->channel_ready[LOCAL]
&& peer->next_index[LOCAL] == 1
&& next_commitment_number == 1) {
struct tlv_funding_locked_tlvs *tlvs = tlv_funding_locked_tlvs_new(tmpctx);
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_funding_locked(NULL,
msg = towire_channel_ready(NULL,
&peer->channel_id,
&peer->next_local_per_commit, tlvs);
peer_write(peer->pps, take(msg));
Expand Down Expand Up @@ -3229,7 +3232,7 @@ static void handle_funding_depth(struct peer *peer, const u8 *msg)
{
u32 depth;
struct short_channel_id *scid, *alias_local;
struct tlv_funding_locked_tlvs *tlvs;
struct tlv_channel_ready_tlvs *tlvs;
struct pubkey point;

if (!fromwire_channeld_funding_depth(tmpctx,
Expand Down Expand Up @@ -3258,25 +3261,25 @@ static void handle_funding_depth(struct peer *peer, const u8 *msg)
else if (alias_local)
peer->short_channel_ids[LOCAL] = *alias_local;

if (!peer->funding_locked[LOCAL]) {
status_debug("funding_locked: sending commit index"
if (!peer->channel_ready[LOCAL]) {
status_debug("channel_ready: sending commit index"
" %"PRIu64": %s",
peer->next_index[LOCAL],
type_to_string(tmpctx, struct pubkey,
&peer->next_local_per_commit));
tlvs = tlv_funding_locked_tlvs_new(tmpctx);
tlvs->alias = alias_local;
tlvs = tlv_channel_ready_tlvs_new(tmpctx);
tlvs->short_channel_id = alias_local;

/* Need to retrieve the first point again, even if we
* moved on, as funding_locked explicitly includes the
* moved on, as channel_ready explicitly includes the
* first one. */
get_per_commitment_point(1, &point, NULL);

msg = towire_funding_locked(NULL, &peer->channel_id,
msg = towire_channel_ready(NULL, &peer->channel_id,
&point, tlvs);
peer_write(peer->pps, take(msg));

peer->funding_locked[LOCAL] = true;
peer->channel_ready[LOCAL] = true;
}

peer->announce_depth_reached = (depth >= ANNOUNCE_MIN_DEPTH);
Expand Down Expand Up @@ -3310,7 +3313,7 @@ static void handle_offer_htlc(struct peer *peer, const u8 *inmsg)
struct amount_sat htlc_fee;
struct pubkey *blinding;

if (!peer->funding_locked[LOCAL] || !peer->funding_locked[REMOTE])
if (!peer->channel_ready[LOCAL] || !peer->channel_ready[REMOTE])
status_failed(STATUS_FAIL_MASTER_IO,
"funding not locked for offer_htlc");

Expand Down Expand Up @@ -3745,7 +3748,7 @@ static void req_in(struct peer *peer, const u8 *msg)
case WIRE_CHANNELD_SENDING_COMMITSIG_REPLY:
case WIRE_CHANNELD_GOT_COMMITSIG_REPLY:
case WIRE_CHANNELD_GOT_REVOKE_REPLY:
case WIRE_CHANNELD_GOT_FUNDING_LOCKED:
case WIRE_CHANNELD_GOT_CHANNEL_READY:
case WIRE_CHANNELD_GOT_ANNOUNCEMENT:
case WIRE_CHANNELD_GOT_SHUTDOWN:
case WIRE_CHANNELD_SHUTDOWN_COMPLETE:
Expand Down Expand Up @@ -3837,8 +3840,8 @@ static void init_channel(struct peer *peer)
&peer->revocations_received,
&peer->htlc_id,
&htlcs,
&peer->funding_locked[LOCAL],
&peer->funding_locked[REMOTE],
&peer->channel_ready[LOCAL],
&peer->channel_ready[REMOTE],
&peer->short_channel_ids[LOCAL],
&reconnected,
&peer->send_shutdown,
Expand Down
12 changes: 6 additions & 6 deletions channeld/channeld_wire.csv
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ msgdata,channeld_init,revocations_received,u64,
msgdata,channeld_init,next_htlc_id,u64,
msgdata,channeld_init,num_existing_htlcs,u16,
msgdata,channeld_init,htlcs,existing_htlc,num_existing_htlcs
msgdata,channeld_init,local_funding_locked,bool,
msgdata,channeld_init,remote_funding_locked,bool,
msgdata,channeld_init,local_channel_ready,bool,
msgdata,channeld_init,remote_channel_ready,bool,
msgdata,channeld_init,funding_short_id,short_channel_id,
msgdata,channeld_init,reestablish,bool,
msgdata,channeld_init,send_shutdown,bool,
Expand Down Expand Up @@ -117,10 +117,10 @@ msgdata,channeld_fulfill_htlc,fulfilled_htlc,fulfilled_htlc,
msgtype,channeld_fail_htlc,1006
msgdata,channeld_fail_htlc,failed_htlc,failed_htlc,

# When we receive funding_locked.
msgtype,channeld_got_funding_locked,1019
msgdata,channeld_got_funding_locked,next_per_commit_point,pubkey,
msgdata,channeld_got_funding_locked,alias,?short_channel_id,
# When we receive channel_ready.
msgtype,channeld_got_channel_ready,1019
msgdata,channeld_got_channel_ready,next_per_commit_point,pubkey,
msgdata,channeld_got_channel_ready,alias,?short_channel_id,

#include <common/penalty_base.h>

Expand Down
4 changes: 2 additions & 2 deletions closingd/closingd.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,11 @@ receive_offer(struct per_peer_state *pps,
/* BOLT #2:
*
* - upon reconnection:
* - MUST ignore any redundant `funding_locked` it receives.
* - MUST ignore any redundant `channel_ready` it receives.
*/
/* This should only happen if we've made no commitments, but
* we don't have to check that: it's their problem. */
if (fromwire_peektype(msg) == WIRE_FUNDING_LOCKED)
if (fromwire_peektype(msg) == WIRE_CHANNEL_READY)
msg = tal_free(msg);
/* BOLT #2:
* - if it has sent a previous `shutdown`:
Expand Down
18 changes: 9 additions & 9 deletions common/billboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion common/billboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 6 additions & 3 deletions common/channel_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* arbitrary combination (they represent the persistent features which
* affect the channel operation).
*
* The currently defined types are:
* The currently defined basic types are:
* - no features (no bits set)
* - `option_static_remotekey` (bit 12)
* - `option_anchor_outputs` and `option_static_remotekey` (bits 20 and 12)
Expand Down Expand Up @@ -118,8 +118,11 @@ struct channel_type *channel_type_accept(const tal_t *ctx,
OPT_ZEROCONF,
};

/* The basic channel_types can have any number of the
* following optional bits. */
/* BOLT #2:
* Each basic type has the following variations allowed:
* - `option_scid_alias` (bit 46)
* - `option_zeroconf` (bit 50)
*/
static const size_t variants[] = {
OPT_ZEROCONF,
};
Expand Down
Loading