diff --git a/channeld/channeld.c b/channeld/channeld.c index 0e4e849e64b0..d98f762bc5bd 100644 --- a/channeld/channeld.c +++ b/channeld/channeld.c @@ -2612,7 +2612,7 @@ static void handle_unexpected_reestablish(struct peer *peer, const u8 *msg) static bool is_initiators_serial(const struct wally_map *unknowns) { - /* BOLT-f15b6b0feeffc2acd1a8466537810bbb3f824f9f #2: + /* BOLT #2: * The sending node: ... * - if is the *initiator*: * - MUST send even `serial_id`s @@ -2850,18 +2850,24 @@ static size_t calc_weight(enum tx_role role, const struct wally_psbt *psbt) { size_t weight = 0; - /* BOLT-0d8b701614b09c6ee4172b04da2203e73deec7e2 #2: - * The initiator: - * ... - * - MUST pay for the common fields. + /* BOLT #2: + * The *initiator* is responsible for paying the fees for the following fields, + * to be referred to as the `common fields`. + * + * - version + * - segwit marker + flag + * - input count + * - output count + * - locktime */ if (role == TX_INITIATOR) weight += bitcoin_tx_core_weight(psbt->num_inputs, psbt->num_outputs); - /* BOLT-0d8b701614b09c6ee4172b04da2203e73deec7e2 #2: - * Each node: - * - MUST pay for their own added inputs and outputs. + /* BOLT #2: + * The rest of the transaction bytes' fees are the responsibility of + * the peer who contributed that input or output via `tx_add_input` or + * `tx_add_output`, at the agreed upon `feerate`. */ for (size_t i = 0; i < psbt->num_inputs; i++) if (is_initiators_serial(&psbt->inputs[i].unknowns)) { diff --git a/common/channel_id.c b/common/channel_id.c index c2f4ce6e04dc..194a3dcdcba8 100644 --- a/common/channel_id.c +++ b/common/channel_id.c @@ -19,15 +19,14 @@ void derive_channel_id_v2(struct channel_id *channel_id, const struct pubkey *basepoint_1, const struct pubkey *basepoint_2) { - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * `channel_id`, v2 * For channels established using the v2 protocol, the * `channel_id` is the - * SHA256(lesser-revocation-basepoint || - * greater-revocation-basepoint), + * `SHA256(lesser-revocation-basepoint || + * greater-revocation-basepoint)`, * where the lesser and greater is based off the order of - * the basepoint. The basepoints are compact - * DER-encoded public keys. + * the basepoint. */ u8 der_keys[PUBKEY_CMPR_LEN * 2]; struct sha256 sha; @@ -53,10 +52,10 @@ void derive_tmp_channel_id(struct channel_id *channel_id, { struct sha256 sha; - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: - * If the peer's revocation basepoint is unknown - * (e.g. `open_channel2`), a temporary `channel_id` should be - * found by using a zeroed out basepoint for the unknown peer. + /* BOLT #2: + * When sending `open_channel2`, the peer's revocation basepoint is unknown. + * A `temporary_channel_id` must be computed by using a zeroed out basepoint + * for the non-initiator. */ u8 der_keys[PUBKEY_CMPR_LEN * 2]; memset(der_keys, 0, PUBKEY_CMPR_LEN); diff --git a/common/features.h b/common/features.h index 640fce1248e1..2798f5527dee 100644 --- a/common/features.h +++ b/common/features.h @@ -99,7 +99,7 @@ struct feature_set *feature_set_dup(const tal_t *ctx, #define COMPULSORY_FEATURE(x) ((x) & 0xFFFFFFFE) #define OPTIONAL_FEATURE(x) ((x) | 1) -/* BOLT-a526652801a541ed33b34d000a3b686a857c811f #9: +/* BOLT #9: * * | Bits | Name |... * | 0/1 | `option_data_loss_protect` |... IN ... @@ -116,9 +116,12 @@ struct feature_set *feature_set_dup(const tal_t *ctx, * | 22/23 | `option_anchors_zero_fee_htlc_tx` |... IN ... * | 24/25 | `option_route_blinding` |...IN9 ... * | 26/27 | `option_shutdown_anysegwit` |... IN ... + * | 28/29 | `option_dual_fund` |... IN ... + * | 38/39 | `option_onion_messages` |... IN ... * | 44/45 | `option_channel_type` |... IN ... + * | 46/47 | `option_scid_alias` | ... IN ... * | 48/49 | `option_payment_metadata` |... 9 ... - * | 62/63 | `option_splice` |... IN ... + * | 50/51 | `option_zeroconf` | ... IN ... */ #define OPT_DATA_LOSS_PROTECT 0 #define OPT_INITIAL_ROUTING_SYNC 2 @@ -134,8 +137,12 @@ struct feature_set *feature_set_dup(const tal_t *ctx, #define OPT_ANCHORS_ZERO_FEE_HTLC_TX 22 #define OPT_ROUTE_BLINDING 24 #define OPT_SHUTDOWN_ANYSEGWIT 26 +#define OPT_DUAL_FUND 28 +#define OPT_ONION_MESSAGES 38 #define OPT_CHANNEL_TYPE 44 +#define OPT_SCID_ALIAS 46 #define OPT_PAYMENT_METADATA 48 +#define OPT_ZEROCONF 50 /* BOLT-splice #9: * | 62/63 | `option_splice` | ... IN ... @@ -143,29 +150,11 @@ struct feature_set *feature_set_dup(const tal_t *ctx, #define OPT_SPLICE 62 #define OPT_EXPERIMENTAL_SPLICE 162 -/* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #9: - * | 28/29 | `option_dual_fund` | ... IN9 ... - */ -#define OPT_DUAL_FUND 28 - -/* BOLT-519be05f61e2c35ddf95b731203f89b4ee0946c3 #9: - * | 46/47 | `option_scid_alias` | ... IN ... - * | 50/51 | `option_eroconf` | ... IN ... - */ -#define OPT_SCID_ALIAS 46 -#define OPT_ZEROCONF 50 - /* BOLT-quiescent #9: * | 34/35 | `option_quiesce` | ... IN ... */ #define OPT_QUIESCE 34 -/* BOLT-offers #9: - * - * | 38/39 | `option_onion_messages` |... IN ... - */ -#define OPT_ONION_MESSAGES 38 - #define OPT_SHUTDOWN_WRONG_FUNDING 104 /* BOLT-peer-storage #9: diff --git a/common/interactivetx.c b/common/interactivetx.c index 8bb8b12e39f8..3088c3b508c7 100644 --- a/common/interactivetx.c +++ b/common/interactivetx.c @@ -25,14 +25,14 @@ #include /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - if has received 4096 `tx_add_input` messages during this negotiation */ #define MAX_TX_ADD_INPUT_MSG_RCVD 4096 /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - it has received 4096 `tx_add_output` messages during this negotiation @@ -40,7 +40,7 @@ #define MAX_TX_ADD_OUTPUT_MSG_RCVD 4096 /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - there are more than 252 inputs @@ -427,7 +427,7 @@ char *process_interactivetx_updates(const tal_t *ctx, tal_hex(ctx, msg)); /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - if has received 4096 `tx_add_input` @@ -438,7 +438,7 @@ char *process_interactivetx_updates(const tal_t *ctx, " received %d", MAX_TX_ADD_INPUT_MSG_RCVD); /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - the `serial_id` has the wrong parity @@ -448,7 +448,7 @@ char *process_interactivetx_updates(const tal_t *ctx, "Invalid serial_id rcvd. %"PRIu64, serial_id); /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - the `serial_id` is already included in @@ -487,9 +487,9 @@ char *process_interactivetx_updates(const tal_t *ctx, tx)); /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... - * - MUST fail the negotiation if: + * - MUST fail the negotiation if:... * - the `prevtx` and `prevtx_vout` are * identical to a previously added (and not * removed) input's @@ -504,7 +504,7 @@ char *process_interactivetx_updates(const tal_t *ctx, &outpoint)); /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - there are more than 252 inputs @@ -516,7 +516,7 @@ char *process_interactivetx_updates(const tal_t *ctx, MAX_FUNDING_INPUTS); /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: * - MUST add all received inputs to the transaction */ @@ -547,7 +547,7 @@ char *process_interactivetx_updates(const tal_t *ctx, "Parsing tx_remove_input %s", tal_hex(ctx, msg)); - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - the input or output identified by the @@ -560,7 +560,7 @@ char *process_interactivetx_updates(const tal_t *ctx, "serial_id: %"PRIu64, serial_id); - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - the `serial_id` does not correspond @@ -590,7 +590,7 @@ char *process_interactivetx_updates(const tal_t *ctx, tal_hex(ctx, msg)); /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - it has received 4096 `tx_add_output` @@ -602,7 +602,7 @@ char *process_interactivetx_updates(const tal_t *ctx, " received (%d)", MAX_TX_ADD_OUTPUT_MSG_RCVD); - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - the `serial_id` has the wrong parity @@ -612,7 +612,7 @@ char *process_interactivetx_updates(const tal_t *ctx, "Invalid serial_id rcvd. %"PRIu64, serial_id); - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - the `serial_id` is already included @@ -623,7 +623,7 @@ char *process_interactivetx_updates(const tal_t *ctx, " %"PRIu64, serial_id); amt = amount_sat(value); - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MAY fail the negotiation if `script` * is non-standard */ @@ -631,7 +631,7 @@ char *process_interactivetx_updates(const tal_t *ctx, return tal_fmt(ctx, "Script is not standard"); /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - there are more than 252 outputs @@ -659,7 +659,7 @@ char *process_interactivetx_updates(const tal_t *ctx, "Parsing tx_remove_output %s", tal_hex(ctx, msg)); - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - the input or output identified by the @@ -672,7 +672,7 @@ char *process_interactivetx_updates(const tal_t *ctx, "serial_id: %"PRIu64, serial_id); - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - the `serial_id` does not correspond to a diff --git a/common/psbt_internal.c b/common/psbt_internal.c index a2b55fb87cb8..4243c9a02cc1 100644 --- a/common/psbt_internal.c +++ b/common/psbt_internal.c @@ -134,20 +134,18 @@ psbt_to_witnesses(const tal_t *ctx, if (input_index_to_ignore == i) continue; - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * - if is the *initiator*: * - MUST send even `serial_id`s */ if (wtx_s && serial_id % 2 == side_to_stack) { - /* BOLT-e299850cb5ebd8bd9c55763bbc498fcdf94a9567 #2: + /* BOLT #2: * * The `witness_data` is encoded as per bitcoin's * wire protocol (a CompactSize number of elements, * with each element a CompactSize length and that - * many bytes following. Each `witness_data` field - * contains all of the witness elements for a single input, - * including the leading counter of elements. + * many bytes following). */ struct witness *wit = tal(witnesses, struct witness); wit->witness_data = tal_arr(wit, u8, 0); diff --git a/connectd/multiplex.c b/connectd/multiplex.c index 72b160353059..a2825627c1cf 100644 --- a/connectd/multiplex.c +++ b/connectd/multiplex.c @@ -806,11 +806,11 @@ static struct pubkey *extract_revocation_basepoint(const tal_t *ctx, switch (t) { case WIRE_OPEN_CHANNEL2: - /* BOLT-dualfund #2: + /* BOLT #2: * 1. type: 64 (`open_channel2`) * 2. data: * * [`chain_hash`:`chain_hash`] - * * [`channel_id`:`zerod_channel_id`] + * * [`channel_id`:`temporary_channel_id`] * * [`u32`:`funding_feerate_perkw`] * * [`u32`:`commitment_feerate_perkw`] * * [`u64`:`funding_satoshis`] @@ -838,10 +838,10 @@ static struct pubkey *extract_revocation_basepoint(const tal_t *ctx, + PUBKEY_CMPR_LEN); break; case WIRE_ACCEPT_CHANNEL2: - /* BOLT-dualfund #2: + /* BOLT #2: * 1. type: 65 (`accept_channel2`) * 2. data: - * * [`channel_id`:`zerod_channel_id`] + * * [`channel_id`:`temporary_channel_id`] * * [`u64`:`funding_satoshis`] * * [`u64`:`dust_limit_satoshis`] * * [`u64`:`max_htlc_value_in_flight_msat`] diff --git a/lightningd/channel.c b/lightningd/channel.c index 6b025a4e052a..a595a94930d1 100644 --- a/lightningd/channel.c +++ b/lightningd/channel.c @@ -302,10 +302,6 @@ struct channel *new_unsaved_channel(struct peer *peer, ld->our_features, peer->their_features); - /* BOLT-7b04b1461739c5036add61782d58ac490842d98b #9 - * | 222/223 | `option_dual_fund` - * | Use v2 of channel open, enables dual funding - * | IN9 */ channel->static_remotekey_start[LOCAL] = channel->static_remotekey_start[REMOTE] = 0; diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index 962cb004988d..35bc02b21f0a 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -1194,7 +1194,7 @@ static struct amount_sat calculate_reserve(struct channel_config *their_config, { struct amount_sat reserve, dust_limit; - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2 + /* BOLT #2 * * The channel reserve is fixed at 1% of the total channel balance * rounded down (sum of `funding_satoshis` from `open_channel2` @@ -1853,7 +1853,7 @@ static void handle_peer_tx_sigs_sent(struct subd *dualopend, &channel->funding.txid, channel->remote_channel_ready); - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2 + /* BOLT #2 * The receiving node: ... * - MUST fail the channel if: * - the `witness_stack` weight lowers the @@ -2201,7 +2201,7 @@ static void handle_peer_tx_sigs_msg(struct subd *dualopend, &channel->funding.txid, channel->remote_channel_ready); - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2 + /* BOLT #2 * The receiving node: ... * - MUST fail the channel if: * - the `witness_stack` weight lowers the @@ -2317,11 +2317,11 @@ static void handle_validate_rbf(struct subd *dualopend, inputs_present = tal_arr(tmpctx, bool, candidate_psbt->num_inputs); memset(inputs_present, true, tal_bytelen(inputs_present)); - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... - * - the transaction does not share a common input with - * all previous funding transactions + * - the transaction does not share at least one input with + * each previous funding transaction */ list_for_each(&channel->inflights, inflight, list) { /* Remove every non-matching input from set */ @@ -2367,9 +2367,9 @@ static void handle_validate_rbf(struct subd *dualopend, assert(inflight); last_fee = psbt_compute_fee(inflight->funding_psbt); - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... - * - if is an RBF attempt: + * - if this is an RBF attempt: * - MUST fail the negotiation if: * - the transaction's total fees is less than the last * successfully negotiated transaction's fees diff --git a/openingd/dualopend.c b/openingd/dualopend.c index b8d2b1bf889d..453ceaccc6d9 100644 --- a/openingd/dualopend.c +++ b/openingd/dualopend.c @@ -58,14 +58,14 @@ enum tx_msgs { }; /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The maximum inputs and outputs are capped at 252. This effectively fixes * the byte size of the input and output counts on the transaction to one (1). */ #define MAX_TX_MSG_RCVD (1 << 12) /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - there are more than 252 inputs @@ -585,11 +585,11 @@ static char *validate_inputs(struct state *state, struct tx_state *tx_state, enum tx_role role_to_validate) { - /* BOLT-18195c86294f503ffd2f11563250c854a50bfa51 #2: + /* BOLT #2: * Upon receipt of consecutive `tx_complete`s, the receiving node: * ... - * - if it has sent `require_confirmed_inputs` in `open_channel2` - * or `accept_channel2`: + * - if it has sent `require_confirmed_inputs` in `open_channel2`, + * `accept_channel2`, `tx_init_rbf` or `tx_ack_rbf`: * - MUST fail the negotiation if: * - one of the inputs added by the other peer is unconfirmed */ @@ -616,7 +616,7 @@ static void set_reserve(struct tx_state *tx_state, { struct amount_sat reserve, dust_limit; - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * * Instead, the channel reserve is fixed at 1% of the total * channel balance (`open_channel2`.`funding_satoshis` + @@ -640,7 +640,7 @@ static void set_reserve(struct tx_state *tx_state, static bool is_openers(const struct wally_map *unknowns) { - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The sending node: ... * - if is the *initiator*: * - MUST send even `serial_id`s @@ -692,7 +692,7 @@ static char *check_balances(const tal_t *ctx, size_t accepter_weight = 0; - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * * The *initiator* is responsible for paying the fees for the * following fields, to be referred to as the `common fields`. @@ -712,7 +712,7 @@ static char *check_balances(const tal_t *ctx, &state->their_funding_pubkey); /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - there are more than 252 inputs @@ -724,7 +724,7 @@ static char *check_balances(const tal_t *ctx, tx_state->psbt->num_inputs, MAX_FUNDING_INPUTS); /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - there are more than 252 outputs @@ -751,7 +751,7 @@ static char *check_balances(const tal_t *ctx, tx_state->psbt); } - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * * Upon receipt of consecutive `tx_complete`s, the receiving * node: @@ -773,7 +773,7 @@ static char *check_balances(const tal_t *ctx, &output_val)), tx_state->psbt); - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * * Upon receipt of consecutive `tx_complete`s, the receiving * node: @@ -786,7 +786,7 @@ static char *check_balances(const tal_t *ctx, return insufficient_err_msg(ctx, "funding output is dust", tx_state->psbt); } else { - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * * Upon receipt of consecutive `tx_complete`s, the receiving * node: @@ -863,13 +863,12 @@ static char *check_balances(const tal_t *ctx, tx_state->psbt); } - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: * ... * - MUST fail the negotiation if: * ... - * - the `sats` amount is less than or equal to - * the `dust_limit` + * - the `sats` amount is less than the `dust_limit` */ if (is_dust(tx_state, amt)) return insufficient_err_msg(ctx, "output is dust", @@ -898,7 +897,7 @@ static char *check_balances(const tal_t *ctx, } } - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: * ... * - MUST fail the negotiation if: @@ -925,12 +924,12 @@ static char *check_balances(const tal_t *ctx, } - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: * ... * - the peer's paid feerate does not meet or exceed the - * agreed `feerate`, (based on the `minimum fee`). + * agreed `feerate` (based on the `minimum fee`). * - if is the *non-initiator*: * - the *initiator*'s fees do not cover the `common` fields */ @@ -959,12 +958,12 @@ static char *check_balances(const tal_t *ctx, tx_state->psbt); } - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: * ... * - the peer's paid feerate does not meet or exceed the - * agreed `feerate`, (based on the `minimum fee`). + * agreed `feerate` (based on the `minimum fee`). */ accepter_fee = amount_tx_fee(feerate_per_kw_funding, accepter_weight); @@ -1549,7 +1548,7 @@ static void handle_tx_abort(struct state *state, u8 *msg) const char *desc; /* - * BOLT-07cc0edc791aff78398a48fc31ee23b45374d8d9 #2: + * BOLT #2: * * Echoing back `tx_abort` allows the peer to ack * that they've seen the abort message, permitting @@ -1778,7 +1777,7 @@ static bool run_tx_interactive(struct state *state, check_channel_id(state, &cid, &state->channel_id); /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - if has received 4096 `tx_add_input` @@ -1791,7 +1790,7 @@ static bool run_tx_interactive(struct state *state, } /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - the `serial_id` has the wrong parity @@ -1803,7 +1802,7 @@ static bool run_tx_interactive(struct state *state, return false; } /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - the `serial_id` is already included in @@ -1849,9 +1848,9 @@ static bool run_tx_interactive(struct state *state, } /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... - * - MUST fail the negotiation if: + * - MUST fail the negotiation if:... * - the `prevtx` and `prevtx_vout` are * identical to a previously added (and not * removed) input's @@ -1868,7 +1867,7 @@ static bool run_tx_interactive(struct state *state, } /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: * - MUST add all received inputs to the transaction */ @@ -1917,7 +1916,7 @@ static bool run_tx_interactive(struct state *state, check_channel_id(state, &cid, &state->channel_id); - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - the input or output identified by the @@ -1931,7 +1930,7 @@ static bool run_tx_interactive(struct state *state, } - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - the `serial_id` does not correspond @@ -1963,7 +1962,7 @@ static bool run_tx_interactive(struct state *state, check_channel_id(state, &cid, &state->channel_id); /* - * BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + * BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - it has received 4096 `tx_add_output` @@ -1977,7 +1976,7 @@ static bool run_tx_interactive(struct state *state, return false; } - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - the `serial_id` has the wrong parity @@ -1989,7 +1988,7 @@ static bool run_tx_interactive(struct state *state, return false; } - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - the `serial_id` is already included @@ -2002,7 +2001,7 @@ static bool run_tx_interactive(struct state *state, } amt = amount_sat(value); - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MAY fail the negotiation if `script` * is non-standard */ @@ -2025,7 +2024,7 @@ static bool run_tx_interactive(struct state *state, check_channel_id(state, &cid, &state->channel_id); - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - the input or output identified by the @@ -2037,7 +2036,7 @@ static bool run_tx_interactive(struct state *state, return false; } - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The receiving node: ... * - MUST fail the negotiation if: ... * - the `serial_id` does not correspond to a @@ -2431,10 +2430,10 @@ static void accepter_start(struct state *state, const u8 *oc2_msg) else state->upfront_shutdown_script[REMOTE] = NULL; - /* BOLT-* #2 - * If the peer's revocation basepoint is unknown (e.g. - * `open_channel2`), a temporary `channel_id` should be found - * by using a zeroed out basepoint for the unknown peer. + /* BOLT #2: + * When sending `open_channel2`, the peer's revocation basepoint is unknown. + * A `temporary_channel_id` must be computed by using a zeroed out basepoint + * for the non-initiator. */ derive_tmp_channel_id(&state->channel_id, /* Temporary! */ &state->their_points.revocation); @@ -2728,7 +2727,7 @@ static void accepter_start(struct state *state, const u8 *oc2_msg) state->our_funding_pubkey, tx_state->blockheight); - /* BOLT-18195c86294f503ffd2f11563250c854a50bfa51 #2: + /* BOLT #2: * * The sending node may require the other participant to * only use confirmed inputs. This ensures that the sending @@ -3044,10 +3043,10 @@ static void opener_start(struct state *state, u8 *msg) if (requested_lease) state->requested_lease = tal_steal(state, requested_lease); - /* BOLT-* #2 - * If the peer's revocation basepoint is unknown (e.g. - * `open_channel2`), a temporary `channel_id` should be found - * by using a zeroed out basepoint for the unknown peer. + /* BOLT #2: + * When sending `open_channel2`, the peer's revocation basepoint is unknown. + * A `temporary_channel_id` must be computed by using a zeroed out basepoint + * for the non-initiator. */ derive_tmp_channel_id(&state->channel_id, &state->our_points.revocation); @@ -3073,7 +3072,7 @@ static void opener_start(struct state *state, u8 *msg) open_tlv->request_funds->blockheight = tx_state->blockheight; } - /* BOLT-18195c86294f503ffd2f11563250c854a50bfa51 #2: + /* BOLT #2: * * The sending node may require the other participant to * only use confirmed inputs. This ensures that the sending @@ -3355,7 +3354,7 @@ static void opener_start(struct state *state, u8 *msg) } } - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The sending node: * - if is the *opener*: * - MUST send at least one `tx_add_output`, which @@ -3456,7 +3455,7 @@ static void rbf_wrap_up(struct state *state, bool aborted; u8 *msg; - /* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2: + /* BOLT #2: * The sending node: * - if is the *opener*: * - MUST send at least one `tx_add_output`, which contains the @@ -4049,7 +4048,7 @@ static void do_reconnect_dance(struct state *state) /* We always send reconnect/reestablish */ - /* BOLT-e299850cb5ebd8bd9c55763bbc498fcdf94a9567 #2: + /* BOLT #2: * * - if it has sent `commitment_signed` for an * interactive transaction construction but it has @@ -4117,7 +4116,7 @@ static void do_reconnect_dance(struct state *state) open_err_fatal(state, "Bad reestablish commitment_number:" "%"PRIu64" vs %d", next_commitment_number, 1); - /* BOLT-e299850cb5ebd8bd9c55763bbc498fcdf94a9567 #2: + /* BOLT #2: * A receiving node: * - if `next_funding_txid` is set: * - if `next_funding_txid` matches the latest interactive funding transaction: diff --git a/wire/peer_wire.c b/wire/peer_wire.c index cec5b0e0730b..4d1cdb5ed90b 100644 --- a/wire/peer_wire.c +++ b/wire/peer_wire.c @@ -198,11 +198,11 @@ bool extract_channel_id(const u8 *in_pkt, struct channel_id *channel_id) * * [`32*byte`:`temporary_channel_id`] */ case WIRE_OPEN_CHANNEL2: - /* BOLT-dualfund #2: + /* BOLT #2: * 1. type: 64 (`open_channel2`) * 2. data: * * [`chain_hash`:`chain_hash`] - * * [`channel_id`:`zerod_channel_id`] + * * [`channel_id`:`temporary_channel_id`] */ /* Skip over chain_hash */ @@ -210,43 +210,43 @@ bool extract_channel_id(const u8 *in_pkt, struct channel_id *channel_id) /* These have them at the start */ case WIRE_TX_ADD_INPUT: - /* BOLT-dualfund #2: + /* BOLT #2: * 1. type: 66 (`tx_add_input`) * 2. data: * * [`channel_id`:`channel_id`] */ case WIRE_TX_ADD_OUTPUT: - /* BOLT-dualfund #2: + /* BOLT #2: * 1. type: 67 (`tx_add_output`) * 2. data: * * [`channel_id`:`channel_id`] */ case WIRE_TX_REMOVE_INPUT: - /* BOLT-dualfund #2: + /* BOLT #2: * 1. type: 68 (`tx_remove_input`) * 2. data: * * [`channel_id`:`channel_id`] */ case WIRE_TX_REMOVE_OUTPUT: - /* BOLT-dualfund #2: + /* BOLT #2: * 1. type: 69 (`tx_remove_output`) * 2. data: * * [`channel_id`:`channel_id`] */ case WIRE_TX_COMPLETE: - /* BOLT-dualfund #2: + /* BOLT #2: * 1. type: 70 (`tx_complete`) * 2. data: * * [`channel_id`:`channel_id`] */ case WIRE_TX_SIGNATURES: - /* BOLT-dualfund #2: + /* BOLT #2: * 1. type: 71 (`tx_signatures`) * 2. data: * * [`channel_id`:`channel_id`] */ case WIRE_TX_ABORT: - /* BOLT-dualfund #2: + /* BOLT #2: * 1. type: 74 (`tx_abort`) * 2. data: * * [`channel_id`:`channel_id`] @@ -276,19 +276,19 @@ bool extract_channel_id(const u8 *in_pkt, struct channel_id *channel_id) * * [`channel_id`:`channel_id`] */ case WIRE_ACCEPT_CHANNEL2: - /* BOLT-dualfund #2: + /* BOLT #2: * 1. type: 65 (`accept_channel2`) * 2. data: - * * [`channel_id`:`channel_id`] + * * [`channel_id`:`temporary_channel_id`] */ case WIRE_TX_INIT_RBF: - /* BOLT-dualfund #2: + /* BOLT #2: * 1. type: 72 (`tx_init_rbf`) * 2. data: * * [`channel_id`:`channel_id`] */ case WIRE_TX_ACK_RBF: - /* BOLT-dualfund #2: + /* BOLT #2: * 1. type: 73 (`tx_ack_rbf`) * 2. data: * * [`channel_id`:`channel_id`]