global: add the "easy" missing quotes.
What changed, and why it matters
This commit only adds missing BOLT (Bitcoin Lightning specification) quote references inside code comments across 12 files. There are no code behavior changes, no bug fixes, and no security fixes. It is a documentation-only cleanup.
No security action required. Treat as normal documentation-only maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff consists entirely of comment additions that quote BOLT specification sections (e.g., BOLT #2, BOLT #4, BOLT #7) near existing code. No executable logic, function signatures, control flow, or data handling is modified. The commit title and message confirm this is a follow-up to add ‘easy’ missing quotes after an earlier attempt placed them incorrectly.
Changed components
channeld/channeld.ccommon/blindedpath.ccommon/gossip_constants.hcommon/htlc_trim.ccommon/onion_message_parse.cconnectd/queries.clightningd/channel_gossip.clightningd/htlc_set.clightningd/pay.clightningd/peer_htlcs.conchaind/onchaind.cplugins/xpay/xpay.cInspect captured patch +68 / −3
diff --git a/channeld/channeld.c b/channeld/channeld.c
index dfb952bf..ad4b6734 100644
--- a/channeld/channeld.c
+++ b/channeld/channeld.c
@@ -658,6 +658,9 @@ static void handle_peer_add_htlc(struct peer *peer, const u8 *msg)
"Bad peer_add_htlc %s", tal_hex(msg, msg));
}
+ /* BOLT #2:
+ * - MUST allow multiple HTLCs with the same `payment_hash`.
+ */
add_err = channel_add_htlc(peer->channel, REMOTE, id, amount,
cltv_expiry, &payment_hash,
onion_routing_packet,
diff --git a/common/blindedpath.c b/common/blindedpath.c
index 5d26c931..88c1619e 100644
--- a/common/blindedpath.c
+++ b/common/blindedpath.c
@@ -142,6 +142,8 @@ bool unblind_onion(const struct pubkey *path_key,
* - Tweak `public_key` by multiplying by $`HMAC256(\text{"blinded\_node\_id"}, blinding\_ss)`$.
* - or (equivalently):
* - Tweak its own `node_privkey` below by multiplying by $`HMAC256(\text{"blinded\_node\_id"}, blinding\_ss)`$.
+ * - Derive the shared secret `ss` as ECDH(`public_key`, `node_privkey`)
+ * (see [Shared Secret](#shared-secret)).
*/
ecdh(path_key, ss);
subkey_from_hmac("blinded_node_id", ss, &hmac);
diff --git a/common/gossip_constants.h b/common/gossip_constants.h
index d5a76231..b11b4db4 100644
--- a/common/gossip_constants.h
+++ b/common/gossip_constants.h
@@ -78,6 +78,9 @@ enum query_option_flags {
* either direction is older than two weeks (1209600 seconds):
* - MAY prune the channel.
* - MAY ignore the channel.
+ * - Note: this is an individual node policy and MUST NOT be enforced by
+ * forwarding peers, e.g. by closing channels when receiving outdated
+ * gossip messages.
*/
#define GOSSIP_PRUNE_INTERVAL(dev_fast_gossip_prune_flag) \
DEV_FAST_GOSSIP(dev_fast_gossip_prune_flag, 120, 1209600)
diff --git a/common/htlc_trim.c b/common/htlc_trim.c
index 8f8fabfc..65f28a10 100644
--- a/common/htlc_trim.c
+++ b/common/htlc_trim.c
@@ -35,6 +35,7 @@ bool htlc_is_trimmed(enum side htlc_owner,
* - MUST NOT contain that output.
* - otherwise:
* - MUST be generated as specified in
+ * [Received HTLC Outputs](#received-htlc-outputs).
*/
else
htlc_fee = htlc_success_fee(feerate_per_kw,
diff --git a/common/onion_message_parse.c b/common/onion_message_parse.c
index 8668c85d..8f09edbd 100644
--- a/common/onion_message_parse.c
+++ b/common/onion_message_parse.c
@@ -177,6 +177,12 @@ const char *onion_message_parse(const tal_t *ctx,
"onion_message_parse: invalid encrypted_recipient_data %s",
tal_hex(tmpctx, om->encrypted_recipient_data));
}
+ /* BOLT #4:
+ * - if it forwards the message:
+ * - MUST set `path_key` in the forwarded `onion_message`
+ * to the next `path_key` as calculated in
+ * [Route Blinding](#route-blinding).
+ */
*next_onion_msg = towire_onion_message(ctx,
&next_path_key,
serialize_onionpacket(tmpctx, rs->next));
diff --git a/connectd/queries.c b/connectd/queries.c
index 09f78976..460faaf7 100644
--- a/connectd/queries.c
+++ b/connectd/queries.c
@@ -688,6 +688,14 @@ static void queue_channel_ranges(struct peer *peer,
/* Last one must end with correct total */
this_num_blocks = number_of_blocks;
+ /* BOLT #7:
+ * If the incoming message includes `query_option`, the receiver
+ * MAY append additional information to its reply:
+ * - if bit 0 in `query_option_flags` is set, the receiver MAY
+ * append a `timestamps_tlv`...
+ * - if bit 1 in `query_option_flags` is set, the receiver MAY
+ * append a `checksums_tlv`...
+ */
send_reply_channel_range(peer, first_blocknum, this_num_blocks,
scids + off,
query_option_flags & QUERY_ADD_TIMESTAMPS
diff --git a/lightningd/channel_gossip.c b/lightningd/channel_gossip.c
index 5daa79b6..63088b17 100644
--- a/lightningd/channel_gossip.c
+++ b/lightningd/channel_gossip.c
@@ -420,6 +420,10 @@ static void broadcast_new_gossip(struct lightningd *ld,
if (ld->dev_suppress_gossip)
return;
+ /* BOLT #7:
+ * - SHOULD send gossip messages as it generates them regardless
+ * of `timestamp`.
+ */
/* Tell all our peers about it, too! */
for (peer = peer_node_id_map_first(ld->peers, &it);
peer;
@@ -659,6 +663,11 @@ static void stash_remote_announce_sigs(struct channel *channel,
fmt_short_channel_id(tmpctx, scid),
channel->scid ? fmt_short_channel_id(tmpctx, *channel->scid) : "none");
+ /* BOLT #7:
+ * - If it has not sent `channel_ready`:
+ * - SHOULD defer handling the `announcement_signatures` until
+ * after it has sent `channel_ready`.
+ */
/* Save to db if we like these signatures */
if (!channel->scid)
return;
diff --git a/lightningd/htlc_set.c b/lightningd/htlc_set.c
index 4c3d3408..216135a5 100644
--- a/lightningd/htlc_set.c
+++ b/lightningd/htlc_set.c
@@ -89,6 +89,10 @@ void htlc_set_fail_(struct htlc_set *set, const u8 *failmsg TAKES,
void htlc_set_fulfill(struct htlc_set *set, const struct preimage *preimage)
{
+ /* BOLT #4:
+ * - if it fulfills any HTLCs in the HTLC set:
+ * - MUST fulfill the entire HTLC set.
+ */
for (size_t i = 0; i < tal_count(set->inpays); i++) {
/* Don't remove from set */
tal_del_destructor2(set->inpays[i],
diff --git a/lightningd/pay.c b/lightningd/pay.c
index 156ecf30..1669f2f9 100644
--- a/lightningd/pay.c
+++ b/lightningd/pay.c
@@ -493,7 +493,10 @@ remote_routing_failure(const tal_t *ctx,
* - if the _final node_ is returning the error:
* - if the PERM bit is set:
* - SHOULD fail the payment.
- * */
+ * - otherwise:
+ * - if the error code is understood and valid:
+ * - MAY retry the payment.
+ */
if (failcode & BADONION)
*pay_errcode = PAY_UNPARSEABLE_ONION;
else if (failcode & PERM)
diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c
index 50580398..8a0c819f 100644
--- a/lightningd/peer_htlcs.c
+++ b/lightningd/peer_htlcs.c
@@ -491,8 +491,20 @@ static void handle_localpay(struct htlc_in *hin,
}
/* BOLT #4:
- *
- * incoming `cltv_expiry` < `current_block_height` + `min_final_cltv_expiry_delta`. */
+ * - If it is the final node:
+ *...
+ * - MUST return an error if:
+ *...
+ * - incoming `cltv_expiry` < `current_block_height` + `min_final_cltv_expiry_delta`.
+ */
+ /* Or, for inside a blinded path: */
+ /* BOLT #4:
+ * - If `encrypted_recipient_data` is present:
+ *...
+ * - If it is the final node:
+ *...
+ * - MUST return an error if incoming `cltv_expiry` < `current_block_height` + `min_final_cltv_expiry_delta`.
+ */
if (get_block_height(ld->topology) + ld->config.cltv_final
> hin->cltv_expiry) {
log_debug(hin->key.channel->log,
@@ -2667,6 +2679,9 @@ void peer_got_revoke(struct channel *channel, const u8 *msg)
/* FIXME: Check per_commitment_secret -> per_commit_point */
update_per_commit_point(channel, &next_per_commitment_point);
+ /* BOLT #2:
+ * - MUST respond with a `revoke_and_ack` message.
+ */
/* Tell it we've committed, and to go ahead with revoke. */
msg = towire_channeld_got_revoke_reply(msg);
subd_send_msg(channel->owner, take(msg));
diff --git a/onchaind/onchaind.c b/onchaind/onchaind.c
index 63e8146e..e326afca 100644
--- a/onchaind/onchaind.c
+++ b/onchaind/onchaind.c
@@ -1613,6 +1613,9 @@ static void handle_onchaind_known_preimage(struct tracked_output ***outs,
* - until all outputs are *irrevocably resolved*:
* - MUST monitor the blockchain for transactions that spend any output that
* is NOT *irrevocably resolved*.
+ * - MUST *resolve* all outputs, as specified below.
+ * - MUST be prepared to resolve outputs multiple times, in case of blockchain
+ * reorganizations.
*/
static void wait_for_resolved(struct tracked_output **outs)
{
diff --git a/plugins/xpay/xpay.c b/plugins/xpay/xpay.c
index 9a8d740f..f3a518c1 100644
--- a/plugins/xpay/xpay.c
+++ b/plugins/xpay/xpay.c
@@ -744,6 +744,14 @@ static void update_knowledge_from_error(struct command *aux_cmd,
attempt_debug(attempt, "%s", description);
/* Final node sent an error */
+ /* BOLT #4:
+ * - if the _final node_ is returning the error:
+ * - if the PERM bit is set:
+ * - SHOULD fail the payment.
+ * - otherwise:
+ * - if the error code is understood and valid:
+ * - MAY retry the payment.
+ */
if (from_final) {
switch (failcode) {
/* These two are deprecated */
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.