Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -566,19 +566,19 @@ else
CHECK_BOLT_COMMIT=--include-commit=$(BOLTVERSION)
endif

CHECK_QUOTES := devtools/check_quotes.py
CHECK_QUOTES := greatspectate check --config devtools/specquotes.toml -k

BOLT_COVERAGE_FLAGS=$(if $(COVERAGE_FILE),--coverage=$(COVERAGE_FILE),)

# Any mention of BOLT# must be followed by an exact quote, modulo whitespace.
bolt-check/%: % bolt-precheck
@if [ -d .tmp.lightningrfc ]; then uv run $(CHECK_QUOTES) -k $(CHECK_BOLT_COMMIT) --comment-start "/* " --comment-continue "*" --comment-end "*/" --boltdir .tmp.lightningrfc $(BOLT_COVERAGE_FLAGS) $<; else echo "Not checking BOLTs: BOLTDIR $(BOLTDIR) does not exist" >&2; fi
@if [ -d .tmp.lightningrfc ]; then uv run $(CHECK_QUOTES) -k $(CHECK_BOLT_COMMIT) --comment-start "/* " --comment-continue "*" --comment-end "*/" $(BOLT_COVERAGE_FLAGS) $<; else echo "Not checking BOLTs: BOLTDIR $(BOLTDIR) does not exist" >&2; fi

bolt-check-py/%: % bolt-precheck
@if [ -d .tmp.lightningrfc ]; then uv run $(CHECK_QUOTES) -k $(CHECK_BOLT_COMMIT) --boltdir .tmp.lightningrfc $(BOLT_COVERAGE_FLAGS) $<; else echo "Not checking BOLTs: BOLTDIR $(BOLTDIR) does not exist" >&2; fi
@if [ -d .tmp.lightningrfc ]; then uv run $(CHECK_QUOTES) -k $(CHECK_BOLT_COMMIT) $(BOLT_COVERAGE_FLAGS) $<; else echo "Not checking BOLTs: BOLTDIR $(BOLTDIR) does not exist" >&2; fi

bolt-check-rs/%: % bolt-precheck
@if [ -d .tmp.lightningrfc ]; then uv run $(CHECK_QUOTES) -k $(CHECK_BOLT_COMMIT) --comment-start "// " --comment-continue "//" --boltdir .tmp.lightningrfc $(BOLT_COVERAGE_FLAGS) $<; else echo "Not checking BOLTs: BOLTDIR $(BOLTDIR) does not exist" >&2; fi
@if [ -d .tmp.lightningrfc ]; then uv run $(CHECK_QUOTES) -k $(CHECK_BOLT_COMMIT) --comment-start "// " --comment-continue "//" $(BOLT_COVERAGE_FLAGS) $<; else echo "Not checking BOLTs: BOLTDIR $(BOLTDIR) does not exist" >&2; fi

LOCAL_BOLTDIR=.tmp.lightningrfc

Expand All @@ -595,7 +595,7 @@ check-requirements-coverage: bolt-precheck
@f=/tmp/cln-bolt-coverage.$$$$; \
rm -f $$f; \
$(MAKE) check-source-bolt COVERAGE_FILE=$$f && \
uv run devtools/bolt-coverage.py --coverage $$f --boltdir .tmp.lightningrfc; \
uv run greatspectate coverage --config devtools/specquotes.toml --coverage $$f; \
rc=$$?; rm -f $$f; exit $$rc

check-whitespace/%: %
Expand Down
4 changes: 2 additions & 2 deletions bitcoin/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ u8 *scriptpubkey_p2tr_derkey(const tal_t *ctx, const u8 inner_der[33])
* block csv lock.
* <remotepubkey> OP_CHECKSIGVERIFY 1 OP_CHECKSEQUENCEVERIFY
*/
/* BOLT- #3
/* BOLT-liquidity-ads #3:
Comment thread
Lagrang3 marked this conversation as resolved.
* ##### Leased channel (`option_will_fund`)
*
* If a `lease` applies to the channel, the `to_remote` output
Expand Down Expand Up @@ -597,7 +597,7 @@ u8 **bitcoin_witness_sig_and_element(const tal_t *ctx,
* OP_ENDIF
* OP_CHECKSIG
*/
/* BOLT- #3
/* BOLT-liquidity-ads #3:
* ##### Leased channel (`option_will_fund`)
* If a `lease` applies to the channel, the `to_local` output of the `accepter`
* ensures the `leasor` funds are not spendable until the lease expires.
Expand Down
58 changes: 30 additions & 28 deletions channeld/channeld.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ static void handle_peer_blockheight_change(struct peer *peer, const u8 *msg)
"Bad update_blockheight %s",
tal_hex(msg, msg));

/* BOLT- #2:
/* BOLT-liquidity-ads #2:
* A receiving node:
* ...
* - if the sender is not the initiator:
Expand All @@ -790,7 +790,7 @@ static void handle_peer_blockheight_change(struct peer *peer, const u8 *msg)
" our current height %u",
blockheight, current, peer->our_blockheight);

/* BOLT- #2:
/* BOLT-liquidity-ads #2:
* A receiving node:
* - if the `update_blockheight` is less than the last
* received `blockheight`:
Expand All @@ -814,7 +814,7 @@ static void handle_peer_blockheight_change(struct peer *peer, const u8 *msg)
"update_blockheight %u older than previous %u",
blockheight, current);

/* BOLT- #2:
/* BOLT-liquidity-ads #2:
* A receiving node:
* ...
* - if `blockheight` is more than 1008 blocks behind
Expand Down Expand Up @@ -2043,13 +2043,13 @@ static struct commitsig_info *handle_peer_commit_sig(struct peer *peer,
peer_failed_warn(peer->pps, &peer->channel_id,
"Bad commit_sig %s", tal_hex(msg, msg));

/* BOLT-f9fd539db6cc6f3e532fdc8cc1ebe8eb1a8fd717
/* BOLT #2:
* - If the sending node sent `start_batch` and we are processing a batch of
* `commitment_signed` messages:
*/
if (msg_batch && tal_count(msg_batch) > 1) {

/* BOLT-f9fd539db6cc6f3e532fdc8cc1ebe8eb1a8fd717
/* BOLT #2:
* - If `funding_txid` is missing in one of the `commitment_signed` messages:
* - MUST send an `error` and fail the channel.
*/
Expand All @@ -2058,7 +2058,7 @@ static struct commitsig_info *handle_peer_commit_sig(struct peer *peer,
"Must send funding_txid when sending"
" a commitment batch.");

/* BOLT-f9fd539db6cc6f3e532fdc8cc1ebe8eb1a8fd717
/* BOLT #2:
* - Otherwise (no pending splice transactions):
*...
* - If `commitment_signed` is missing for the current funding transaction:
Expand All @@ -2073,7 +2073,7 @@ static struct commitsig_info *handle_peer_commit_sig(struct peer *peer,
fmt_bitcoin_txid(tmpctx, &peer->channel->funding.txid));
}

/* BOLT-f9fd539db6cc6f3e532fdc8cc1ebe8eb1a8fd717
/* BOLT #2:
* - If `funding_txid` is missing in one of the `commitment_signed` messages:
* - MUST send an `error` and fail the channel.
*/
Expand Down Expand Up @@ -2288,7 +2288,7 @@ static struct commitsig_info *handle_peer_commit_sig(struct peer *peer,
tal_count(peer->splice_state->inflights));

commitsigs = tal_arr(NULL, const struct commitsig*, 0);
/* BOLT-f9fd539db6cc6f3e532fdc8cc1ebe8eb1a8fd717
/* BOLT #2:
* - If there are pending splice transactions:
* - MUST validate each `commitment_signed` based on `funding_txid`.
* - If `commitment_signed` is missing for a funding transaction:
Expand Down Expand Up @@ -2415,7 +2415,7 @@ static struct commitsig_info *handle_peer_commit_sig_batch(struct peer *peer,
peer_failed_warn(peer->pps, &peer->channel_id,
"Bad commit_sig %s", tal_hex(msg, msg));

/* BOLT-f9fd539db6cc6f3e532fdc8cc1ebe8eb1a8fd717
/* BOLT #2:
* - If there are pending splice transactions and the sending node did not
* send `start_batch` followed by a batch of `commitment_signed` messages:
* - MUST send an `error` and fail the channel.
Expand Down Expand Up @@ -2461,7 +2461,7 @@ static struct commitsig_info *handle_peer_commit_sig_batch(struct peer *peer,
msg_batch[i] = sub_msg;
}

/* BOLT-f9fd539db6cc6f3e532fdc8cc1ebe8eb1a8fd717
/* BOLT #2:
* - Otherwise (no pending splice transactions):
* - MUST ignore `commitment_signed` where `funding_txid` does not match
* the current funding transaction.
Expand Down Expand Up @@ -3677,7 +3677,7 @@ static struct amount_sat check_balances(struct peer *peer,
fmt_amount_sat(tmpctx, max_accepter_fee));
}

/* BOLT-??? #2:
/* BOLT-FIXME #2:
* - if either side has added an output other than the new channel
* funding output:
* - MUST fail the negotiation if the balance for that side is less
Expand Down Expand Up @@ -3861,9 +3861,10 @@ static void resume_splice_negotiation(struct peer *peer,
* 2) other side sneakily adding other outputs we own
*/

/* BOLT-a8b9f495cac28124c69cc5ee429f9ef2bacb9921 #2:
* Both nodes:
* - MUST sign the transaction using SIGHASH_ALL */
/* BOLT #2:
* The sending node:
*...
* - MUST use the `SIGHASH_ALL` (0x01) flag on each signature
splice_sig.sighash_type = SIGHASH_ALL;

bitcoin_tx = bitcoin_tx_with_psbt(tmpctx, current_psbt);
Expand Down Expand Up @@ -3994,9 +3995,10 @@ static void resume_splice_negotiation(struct peer *peer,

their_sig = tal(tmpctx, struct bitcoin_signature);

/* BOLT-a8b9f495cac28124c69cc5ee429f9ef2bacb9921 #2:
* Both nodes:
* - MUST sign the transaction using SIGHASH_ALL */
/* BOLT #2:
* The sending node:
*...
* - MUST use the `SIGHASH_ALL` (0x01) flag on each signature
their_sig->sighash_type = SIGHASH_ALL;
their_sig->s = *their_txsigs_tlvs->shared_input_signature;

Expand Down Expand Up @@ -5707,7 +5709,7 @@ static void peer_reconnect(struct peer *peer,
send_tlvs->next_funding = talz(send_tlvs, struct tlv_channel_reestablish_tlvs_next_funding);
send_tlvs->next_funding->next_funding_txid = inflight->outpoint.txid;

/* BOLT-??? #2:
/* BOLT #2:
* The `next_funding.retransmit_flags` bitfield is used to let the
* receiving peer know which messages they must retransmit for the
* corresponding `next_funding_txid` after the reconnection:
Expand All @@ -5720,7 +5722,7 @@ static void peer_reconnect(struct peer *peer,
}
}

/* BOLT-??? #2:
/* BOLT #2:
* - if `option_splice` was negotiated:
*/
if (feature_negotiated(peer->our_features, peer->their_features,
Expand All @@ -5740,7 +5742,7 @@ static void peer_reconnect(struct peer *peer,
}
}

/* BOLT-??? #2:
/* BOLT #2:
* - if a splice transaction reached acceptable depth while disconnected:
* - MUST include `my_current_funding_locked` with the txid of the latest such transaction.
* - otherwise, if it has already sent `splice_locked` for any transaction:
Expand All @@ -5755,7 +5757,7 @@ static void peer_reconnect(struct peer *peer,
fmt_bitcoin_txid(tmpctx,
&peer->splice_state->locked_txid));
}
/* BOLT-??? #2:
/* BOLT #2:
* - otherwise, if it has already sent `channel_ready`:
* - MUST include `my_current_funding_locked` with the txid of the channel funding transaction.
*/
Expand All @@ -5768,7 +5770,7 @@ static void peer_reconnect(struct peer *peer,
fmt_bitcoin_txid(tmpctx,
&peer->channel->funding.txid));
}
/* BOLT-??? #2:
/* BOLT #2:
* - otherwise (it has never sent `channel_ready` or `splice_locked`):
* - MUST NOT include `my_current_funding_locked`.
*/
Expand Down Expand Up @@ -6007,7 +6009,7 @@ static void peer_reconnect(struct peer *peer,
peer_write(peer->pps, take(msg));
}

/* BOLT-??? #2
/* BOLT #2:
* A receiving node:
* - if splice transactions are pending and `my_current_funding_locked` matches one of
* those splice transactions, for which it hasn't received `splice_locked` yet:
Expand All @@ -6018,7 +6020,7 @@ static void peer_reconnect(struct peer *peer,
if (!bitcoin_txid_eq(&itr->outpoint.txid,
&recv_tlvs->my_current_funding_locked->my_current_funding_locked_txid))
continue;
/* BOLT-??? #2
/* BOLT #2:
* - MUST process `my_current_funding_locked` as if it was receiving `splice_locked`
* for this `txid`.
*/
Expand Down Expand Up @@ -6160,13 +6162,13 @@ static void peer_reconnect(struct peer *peer,
if (retransmit_revoke_and_ack && peer->last_was_revoke)
resend_revoke(peer);

/* BOLT-splice #2
/* BOLT #2:
* 1. type: 5 (`my_current_funding_locked`)
* 2. data:
* * [`sha256`:`my_current_funding_locked_txid`]
* * [`byte`:`retransmit_flags`]
*
* The `retransmit_flags` bitfield is used to let our peer know which messages
*...
* The `my_current_funding_locked.retransmit_flags` bitfield is used to let our peer know which messages
* we expect them to retransmit after the reconnection:
*
* | Bit Position | Name |
Expand Down Expand Up @@ -6541,7 +6543,7 @@ static void handle_blockheight(struct peer *peer, const u8 *inmsg)
u32 peer_height = get_blockheight(peer->channel->blockheight_states,
peer->channel->opener,
REMOTE);
/* BOLT- #2:
/* BOLT-liquidity-ads #2:
* The node _not responsible_ for initiating the channel:
* ...
* - if last received `blockheight` is > 1008 behind
Expand Down
4 changes: 2 additions & 2 deletions channeld/commit_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
* output](#to_local-output).
*/
if (amount_msat_greater_eq_sat(self_pay, dust_limit)) {
/* BOLT- #3:
/* BOLT-liquidity-ads #3:
* In a leased channel, the `to_local` output that
* pays the `accepter` node is modified so that its
* CSV is equal to the greater of the
Expand Down Expand Up @@ -331,7 +331,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
&keyset->other_payment_key,
(!side) == lessor ?
csv_lock : 1);
/* BOLT- #3:
/* BOLT-liquidity-ads #3:
* ##### Leased channel (`option_will_fund`)
*
* If a `lease` applies to the channel, the
Expand Down
4 changes: 2 additions & 2 deletions common/bolt12.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ struct tlv_offer *offer_decode(const tal_t *ctx,
}
}

/* BOLT-recurrence #12
/* BOLT-recurrence #12:
* - if `offer_recurrence_optional` or `offer_recurrence_compulsory` are set:
* - if `time_unit` is not one of 0, 1, or 2:
* - MUST NOT respond to the offer.
Expand All @@ -297,7 +297,7 @@ struct tlv_offer *offer_decode(const tal_t *ctx,
return tal_free(offer);
}
} else {
/* BOLT-recurrence #12
/* BOLT-recurrence: #12
* - otherwise: (no recurrence):
* - if it `offer_recurrence_paywindow`, `offer_recurrence_limit` or `offer_recurrence_base` are set:
* - MUST NOT respond to the offer.
Expand Down
5 changes: 2 additions & 3 deletions common/channel_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ struct channel_config {
* HTLCs the remote node can offer. */
u16 max_accepted_htlcs;

/* BOLT-TBD #X
*
* maximum dust exposure allowed for this channel
/* BOLT #2:
* ### Bounding exposure to trimmed in-flight HTLCs: `max_dust_htlc_exposure_msat`
*/
struct amount_msat max_dust_htlc_exposure_msat;
};
Expand Down
2 changes: 1 addition & 1 deletion common/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ struct feature_set *feature_set_dup(const tal_t *ctx,
* | 50/51 | `option_zeroconf` |... INT ...
* | 60/61 | `option_simple_close` |... IN ...
*/
/* BOLT-splice #9:
/* BOLT #9:
* | 62/63 | `option_splice` |... IN ...
*/
#define OPT_DATA_LOSS_PROTECT 0
Expand Down
2 changes: 1 addition & 1 deletion common/interactivetx.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ char *process_interactivetx_updates(const tal_t *ctx,
"Invalid tx outnum sent. %u",
outpoint.n);
/*
* BOLT-f53ca2301232db780843e894f55d95d512f297f9 #2:
* BOLT #2:
* The receiving node: ...
* - MUST fail the negotiation if: ...
* - the `prevtx_out` input of `prevtx` is
Expand Down
4 changes: 2 additions & 2 deletions common/lease_rates.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void lease_rates_get_commitment(const struct pubkey *pubkey,
{
struct sha256_ctx sctx = SHA256_INIT;
u8 der[PUBKEY_CMPR_LEN];
/* BOLT- #2:
/* BOLT-liquidity-ads #2:
* - MUST set `signature` to the ECDSA signature of
* SHA256("option_will_fund"
* || `funding_pubkey`
Expand All @@ -47,7 +47,7 @@ bool lease_rates_calc_fee(const struct lease_rates *rates,
struct amount_sat *fee)
{
struct amount_sat lease_fee, basis_sat, tx_fee;
/* BOLT- #2:
/* BOLT-liquidity-ads #2:
* The lease fee is calculated as:
* `lease_fee_base_sat` +
* min(`accept_channel2`.`funding_satoshis`, `open_channel2`.`requested_sats`) * `lease_fee_basis` / 10_000 +
Expand Down
6 changes: 3 additions & 3 deletions common/sciddir_or_pubkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
#include <common/sciddir_or_pubkey.h>
#include <wire/wire.h>

/* BOLT-sciddir_or_pubkey #1:
/* BOLT #1:
* * `sciddir_or_pubkey`: either 9 or 33 bytes referencing or identifying a node, respectively
* * if the first byte is 0 or 1, then an 8-byte `short_channel_id` follows for a total of 9 bytes
* * 0 for the first byte indicates this refers to `node_id_1` in the `channel_announcement` for `short_channel_id` (see [BOLT #7](07-routing-gossip.md#the-channel_announcement-message))
* * 1 for the first byte indicates this refers to `node_id_2` in the `channel_announcement` for `short_channel_id` (see [BOLT #7](07-routing-gossip.md#the-channel_announcement-message))
* * 0 for the first byte indicates this refers to `node_id_1` in the `channel_announcement` for `short_channel_id`
* * 1 for the first byte indicates this refers to `node_id_2` in the `channel_announcement` for `short_channel_id` (see [BOLT #7](07-routing-gossip.md#the-channel_announcement-message)
* * if the first byte is 2 or 3, then the value is a 33-byte `point`
*/
void towire_sciddir_or_pubkey(u8 **pptr,
Expand Down
2 changes: 1 addition & 1 deletion common/test/run-bolt11.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ int main(int argc, char *argv[])
dev_bolt11_old_order = false;
dev_bolt11_omit_c_value = false;

/* BOLT #11
/* BOLT #11:
*
* > ### Same, but including fields which must be ignored.
* > lnbc25m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5vdhkven9v5sxyetpdeessp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9q5sqqqqqqqqqqqqqqqqsgq2qrqqqfppnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqppnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpp4qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqhpnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqhp4qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqspnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsp4qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqnp5qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqnpkqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz599y53s3ujmcfjp5xrdap68qxymkqphwsexhmhr8wdz5usdzkzrse33chw6dlp3jhuhge9ley7j2ayx36kawe7kmgg8sv5ugdyusdcqzn8z9x
Expand Down
2 changes: 1 addition & 1 deletion common/test/run-lease_rates.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static void check_lease_rate_commitment_hash(void)

static void check_lease_rate_fees(void)
{
/* BOLT- #2:
/* BOLT-liquidity-ads #2:
* E.g.
* An node requests 1_000_000sats at a feerate of 2500perkw. They
* are contributing 500_000sats. Their weight contribution to the
Expand Down
4 changes: 4 additions & 0 deletions devtools/specquotes.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[sources.bolt]
format = "markdown"
dir = "../.tmp.lightningrfc"
pattern = "{id:02d}-*.md"
2 changes: 1 addition & 1 deletion gossipd/gossmap_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ const char *gossmap_manage_channel_announcement(const tal_t *ctx,
tal_hex(tmpctx, announce));
}

/* BOLT-gossip-node-check #7:
/* BOLT #7:
* The receiving node:
*...
* - if `node_id_1` is not lexicographically less than `node_id_2`:
Expand Down
Loading
Loading