BOLT quotes: split cross-section quotes; prepare for new `...` semantics.
What changed, and why it matters
This commit is a documentation and code-comment cleanup. It splits BOLT (Bitcoin Lightning specification) quote comments so a new internal tool can check them more accurately, and removes a few stray leading ellipses from comments. There is no change to actual program logic, network behavior, or security-sensitive code.
No security action required. Treat as a normal maintenance/documentation commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch adjusts C source comments that quote BOLT specification text and updates devtools/check_quotes.py to handle a new ‘…’ matching convention. It splits cross-section quotes, adds ‘*…’ markers between test-vector sections, and removes leading ‘…’ from two nonce-related comments where the quoted BOLT text begins a new sentence. No executable code, wire protocol handling, cryptography, or state machine logic is modified.
Changed components
devtools/check_quotes.pysource code comments referencing BOLT specificationsInspect captured patch +35 / −19
diff --git a/bitcoin/short_channel_id.h b/bitcoin/short_channel_id.h
index 0a49a73..98d5950 100644
--- a/bitcoin/short_channel_id.h
+++ b/bitcoin/short_channel_id.h
@@ -28,7 +28,9 @@ static inline size_t hash_scid(struct short_channel_id scid)
* - MUST set `node_id_1` and `node_id_2` to the public keys of the two nodes
* operating the channel, such that `node_id_1` is the lexicographically-lesser of the
* two compressed keys sorted in ascending lexicographic order.
- *...
+ */
+/* BOLT #7:
+ *
* - if the origin node is `node_id_1` in the message:
* - MUST set the `direction` bit of `channel_flags` to 0.
* - otherwise:
diff --git a/channeld/test/run-commit_tx.c b/channeld/test/run-commit_tx.c
index cc0a8cb..5b793c5 100644
--- a/channeld/test/run-commit_tx.c
+++ b/channeld/test/run-commit_tx.c
@@ -584,12 +584,15 @@ int main(int argc, const char *argv[])
* INTERNAL: local_delayed_payment_basepoint_secret: 333333333333333333333333333333333333333333333333333333333333333301
* INTERNAL: remote_payment_basepoint_secret: 444444444444444444444444444444444444444444444444444444444444444401
* x_local_per_commitment_secret: 1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a0908070605040302010001
+ *...
* # From remote_revocation_basepoint_secret
* INTERNAL: remote_revocation_basepoint: 02466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27
+ *...
* # From local_delayed_payment_basepoint_secret
* INTERNAL: local_delayed_payment_basepoint: 023c72addb4fdf09af94f0c94d7fe92a386a7e70cf8a1d85916386bb2535c7b1b1
* INTERNAL: local_per_commitment_point: 025f7117a78150fe2ef97db7cfc83bd57b2e2c0d0dd25eaf467a4a1c2a45ce1486
* INTERNAL: remote_privkey: 8deba327a7cc6d638ab0eb025770400a6184afcba6713c210d8d10e199ff2fda01
+ *...
* # From local_delayed_payment_basepoint_secret, local_per_commitment_point and local_delayed_payment_basepoint
* INTERNAL: local_delayed_privkey: adf3464ce9c2f230fd2582fda4c6965e4993ca5524e8c9580e3df0cf226981ad01
* -->
diff --git a/channeld/test/run-full_channel.c b/channeld/test/run-full_channel.c
index 1bb406a..1f8b10b 100644
--- a/channeld/test/run-full_channel.c
+++ b/channeld/test/run-full_channel.c
@@ -439,6 +439,7 @@ int main(int argc, const char *argv[])
*
* # From remote_revocation_basepoint_secret
* INTERNAL: remote_revocation_basepoint: 02466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27
+ *...
* # From local_delayed_payment_basepoint_secret
* INTERNAL: local_delayed_payment_basepoint: 023c72addb4fdf09af94f0c94d7fe92a386a7e70cf8a1d85916386bb2535c7b1b1
*/
diff --git a/common/bolt11.c b/common/bolt11.c
index 7698f49..d159968 100644
--- a/common/bolt11.c
+++ b/common/bolt11.c
@@ -1028,10 +1028,15 @@ struct bolt11 *bolt11_decode(const tal_t *ctx, const char *str,
/* BOLT #11:
*
- * A reader... MUST check that the `signature` is valid (see
- * the `n` tagged field specified below). ... A reader...
- * MUST use the `n` field to validate the signature instead of
- * performing signature recovery.
+ * A reader:
+ * - MUST check that the `signature` is valid (see the `n` tagged field specified below).
+ */
+ /* BOLT #11:
+ *
+ * A reader:
+ * ...
+ * - if a valid `n` field is provided:
+ * - MUST use the `n` field to validate the signature instead of performing signature recovery.
*/
if (!have_n) {
struct pubkey k;
diff --git a/common/channel_config.h b/common/channel_config.h
index bb830b8..b796dc1 100644
--- a/common/channel_config.h
+++ b/common/channel_config.h
@@ -18,7 +18,9 @@
* * [`u32`:`feerate_per_kw`]
* * [`u16`:`to_self_delay`]
* * [`u16`:`max_accepted_htlcs`]
- *...
+ */
+/* BOLT #2:
+ *
* 1. type: 33 (`accept_channel`)
* 2. data:
* * [`32*byte`:`temporary_channel_id`]
diff --git a/common/cryptomsg.c b/common/cryptomsg.c
index 8fb8d34..d06f9d9 100644
--- a/common/cryptomsg.c
+++ b/common/cryptomsg.c
@@ -72,9 +72,9 @@ static void le64_nonce(unsigned char *npub, u64 nonce)
{
/* BOLT #8:
*
- * ...with nonce `n` encoded as 32 zero bits, followed by a
- * *little-endian* 64-bit value. Note: this follows the Noise Protocol
- * convention, rather than our normal endian
+ * with nonce `n` encoded as 32 zero bits, followed by a
+ * *little-endian* 64-bit value. Note: this follows the Noise
+ * Protocol convention, rather than our normal endian.
*/
le64 le_nonce = cpu_to_le64(nonce);
const size_t zerolen = crypto_aead_chacha20poly1305_ietf_NPUBBYTES - sizeof(le_nonce);
diff --git a/common/key_derive.c b/common/key_derive.c
index cc2a913..321a655 100644
--- a/common/key_derive.c
+++ b/common/key_derive.c
@@ -17,7 +17,9 @@
* - The `remote_htlcpubkey` uses the remote node's `htlc_basepoint`;
* - The `local_delayedpubkey` uses the local node's `delayed_payment_basepoint`;
* - The `remote_delayedpubkey` uses the remote node's `delayed_payment_basepoint`.
- *...
+ */
+/* BOLT #3:
+ *
* The `remotepubkey` is simply the remote node's `payment_basepoint`.
*/
diff --git a/connectd/handshake.c b/connectd/handshake.c
index 3382b50..5d7ba73 100644
--- a/connectd/handshake.c
+++ b/connectd/handshake.c
@@ -258,9 +258,9 @@ static void le64_nonce(unsigned char *npub, u64 nonce)
{
/* BOLT #8:
*
- * ...with nonce `n` encoded as 32 zero bits, followed by a
+ * with nonce `n` encoded as 32 zero bits, followed by a
* *little-endian* 64-bit value. Note: this follows the Noise
- * Protocol convention, rather than our normal endian
+ * Protocol convention, rather than our normal endian.
*/
le64 le_nonce = cpu_to_le64(nonce);
const size_t zerolen = crypto_aead_chacha20poly1305_ietf_NPUBBYTES - sizeof(le_nonce);
diff --git a/devtools/check_quotes.py b/devtools/check_quotes.py
index 37fcebc..c644a21 100755
--- a/devtools/check_quotes.py
+++ b/devtools/check_quotes.py
@@ -201,10 +201,12 @@ def find_quote_immediate(
"""
textparts = text.split("...")
off = start
- # Allow for exactly one whitespace separator (already collapsed)
+ # Allow for exactly one whitespace separator (already collapsed).
+ # The quote text itself may also have a leading space (from the comment
+ # continuation line joining), so strip both together.
if off < len(section) and section[off] == " ":
off += 1
- first_part = textparts[0]
+ first_part = textparts[0].lstrip(" ")
if not section[off:].startswith(first_part):
return None, None
off += len(first_part)
diff --git a/lightningd/opening_control.c b/lightningd/opening_control.c
index d799819..0d482c2 100644
--- a/lightningd/opening_control.c
+++ b/lightningd/opening_control.c
@@ -156,7 +156,7 @@ wallet_commit_channel(struct lightningd *ld,
* 2. data:
* * [`channel_id`:`channel_id`]
* * [`signature`:`signature`]
- *
+ *...
* #### Requirements
*
* Both peers:
diff --git a/wire/peer_wire.c b/wire/peer_wire.c
index 12c019b..3200fe7 100644
--- a/wire/peer_wire.c
+++ b/wire/peer_wire.c
@@ -179,9 +179,6 @@ bool extract_channel_id(const u8 *in_pkt, struct channel_id *channel_id)
* 1. type: 17 (`error`)
* 2. data:
* * [`channel_id`:`channel_id`]
- *...
- * The channel is referred to by `channel_id`, unless
- * `channel_id` is 0
*/
/* fall thru */
case WIRE_WARNING:
@@ -189,7 +186,9 @@ bool extract_channel_id(const u8 *in_pkt, struct channel_id *channel_id)
* 1. type: 1 (`warning`)
* 2. data:
* * [`channel_id`:`channel_id`]
- *...
+ */
+ /* BOLT #1:
+ *
* The channel is referred to by `channel_id`, unless
* `channel_id` is 0
*/
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.