Skip to content

Commit 631e44e

Browse files
committed
Revert "Bolt quote updates and improvements"
Reverts commits b0e7285 through aa6ecad (11 commits). This PR was accidentally merged without proper review. The `channeld.c` splice-detection logic (`is_splice_active` + txid comparison) was NACKed by @ddustin as deviating from the spec, the correct approach requires a `funding_tx_index` on the inflight rather than a `txid` comparison. A clean replacement PR will be opened for discussion once the approach is agreed upon.
1 parent 9e8f4ff commit 631e44e

12 files changed

Lines changed: 26 additions & 79 deletions

File tree

channeld/channeld.c

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5954,30 +5954,19 @@ static void peer_reconnect(struct peer *peer,
59545954
"next_funding_txid not recognized.");
59555955
}
59565956

5957-
/* "none of those channel_reestablish messages contain
5958-
* my_current_funding_locked or next_funding for a splice transaction" */
5959-
bool is_splice_active = local_next_funding
5960-
|| peer->splice_state->locked_ready[LOCAL]
5961-
|| remote_next_funding
5962-
|| (recv_tlvs
5963-
&& recv_tlvs->my_current_funding_locked
5964-
&& !bitcoin_txid_eq(
5965-
&recv_tlvs->my_current_funding_locked->my_current_funding_locked_txid,
5966-
&peer->channel->funding.txid));
5967-
59685957
/* BOLT #2:
59695958
*
59705959
* - if `next_commitment_number` is 1 in both the
5971-
* `channel_reestablish` it sent and received:
5960+
* `channel_reestablish` it sent and received:
59725961
* - MUST retransmit `channel_ready`.
59735962
* - otherwise:
5974-
* - MUST NOT retransmit `channel_ready`, but MAY send `channel_ready` with
5975-
* a different `short_channel_id` `alias` field.
5963+
* - MUST NOT retransmit `channel_ready`, but MAY send
5964+
* `channel_ready` with a different `short_channel_id`
5965+
* `alias` field.
59765966
*/
59775967
if (peer->channel_ready[LOCAL]
59785968
&& peer->next_index[LOCAL] == 1
5979-
&& next_commitment_number == 1
5980-
&& !is_splice_active) {
5969+
&& next_commitment_number == 1) {
59815970
struct tlv_channel_ready_tlvs *tlvs = tlv_channel_ready_tlvs_new(tmpctx);
59825971

59835972
tlvs->short_channel_id = &peer->local_alias;

common/bech32_util.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ bool from_bech32_charset(const tal_t *ctx,
7979
u5 *u5data;
8080
const char *sep;
8181
bool upper = false, lower = false;
82-
size_t datalen, nbits, trailing;
82+
size_t datalen;
8383

8484
sep = memchr(bech32, '1', bech32_len);
8585
if (!sep)
@@ -105,18 +105,6 @@ bool from_bech32_charset(const tal_t *ctx,
105105
if (upper && lower)
106106
goto fail;
107107

108-
/* Padding: converting N 5-bit groups to bytes leaves (N*5 % 8) trailing
109-
* bits. These must be zero and fewer than 5 (otherwise a full 5-bit
110-
* group is wasted as padding, which is invalid). */
111-
nbits = datalen * 5;
112-
trailing = nbits % 8;
113-
if (trailing >= 5)
114-
goto fail;
115-
for (size_t i = nbits - trailing; i < nbits; i++) {
116-
if (get_u5_bit(u5data, i))
117-
goto fail;
118-
}
119-
120108
*data = tal_arr(ctx, u8, 0);
121109
if (!bech32_pull_bits(data, u5data, tal_bytelen(u5data) * 5)) {
122110
tal_free(*data);

common/bolt11.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ struct bolt11 *bolt11_decode(const tal_t *ctx, const char *str,
10451045
&sig,
10461046
(const u8 *)&hash))
10471047
return decode_fail(b11, fail,
1048-
"public-key recovery failed");
1048+
"signature recovery failed");
10491049
node_id_from_pubkey(&b11->receiver_id, &k);
10501050
} else {
10511051
struct pubkey k;

common/bolt12.c

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
#include <inttypes.h>
1111
#include <time.h>
1212

13-
/* If chains is NULL, max_num_chains is ignored.
14-
* If must_be_chain is NULL, only structural validity is checked. */
13+
/* If chains is NULL, max_num_chains is ignored */
1514
bool bolt12_chains_match(const struct bitcoin_blkid *chains,
1615
size_t max_num_chains,
1716
const struct chainparams *must_be_chain)
@@ -32,13 +31,6 @@ bool bolt12_chains_match(const struct bitcoin_blkid *chains,
3231
* - if the node does not accept invoices for at least one of the `chains`:
3332
* - MUST NOT respond to the offer
3433
*/
35-
if (chains && max_num_chains == 0)
36-
return false;
37-
38-
/* No specific chain required: structurally valid. */
39-
if (!must_be_chain)
40-
return true;
41-
4234
if (!chains) {
4335
max_num_chains = 1;
4436
chains = &chainparams_for_network("bitcoin")->genesis_blockhash;
@@ -197,18 +189,6 @@ struct tlv_offer *offer_decode(const tal_t *ctx,
197189
return NULL;
198190
}
199191

200-
/* BOLT #12:
201-
* - otherwise: (`offer_chains` is set):
202-
* - if the node does not accept invoices for at least one of the `chains`:
203-
* - MUST NOT respond to the offer
204-
*/
205-
for (size_t i = 0; i < tal_count(offer->fields); i++) {
206-
if (offer->fields[i].numtype == 2 && offer->fields[i].length == 0) {
207-
*fail = tal_strdup(ctx, "offer_chains must have at least one entry");
208-
return tal_free(offer);
209-
}
210-
}
211-
212192
*fail = check_features_and_chain(ctx,
213193
our_features, must_be_chain,
214194
offer->offer_features,

common/features.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ struct feature_set *feature_set_dup(const tal_t *ctx,
113113
* | 16/17 | `basic_mpp` |... IN9 ...
114114
* | 18/19 | `option_support_large_channel` |... IN ...
115115
* | 22/23 | `option_anchors` |... INT ...
116-
* | 24/25 | `option_route_blinding` |... IN9 ...
116+
* | 24/25 | `option_route_blinding` |...IN9 ...
117117
* | 26/27 | `option_shutdown_anysegwit` |... IN ...
118118
* | 28/29 | `option_dual_fund` |... IN ...
119119
* | 34/35 | `option_quiesce` |... IN ...

common/test/run-bolt11.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ int main(int argc, char *argv[])
874874
* > lnbc2500u1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpusp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9qrsgqwgt7mcn5yqw3yx0w94pswkpq6j9uh6xfqqqtsk4tnarugeektd4hg5975x9am52rz4qskukxdmjemg92vvqz8nvmsye63r5ykel43pgz7zq0g2
875875
*/
876876
assert(!bolt11_decode(tmpctx, "lnbc2500u1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpusp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9qrsgqwgt7mcn5yqw3yx0w94pswkpq6j9uh6xfqqqtsk4tnarugeektd4hg5975x9am52rz4qskukxdmjemg92vvqz8nvmsye63r5ykel43pgz7zq0g2", NULL, NULL, NULL, &fail));
877-
assert(streq(fail, "public-key recovery failed"));
877+
assert(streq(fail, "signature recovery failed"));
878878

879879
/* BOLT #11:
880880
* > ### String is too short.

common/test/run-bolt12-encode-test.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,18 +429,15 @@ int main(int argc, char *argv[])
429429
/* BOLT #12:
430430
* - if `offer_amount` is set and `offer_description` is not set:
431431
* - MUST NOT respond to the offer.
432-
* - if `offer_amount` is set and is not greater than zero:
432+
* - if `offer_amount` is set and is not greater than zero:
433433
* - MUST NOT respond to the offer.
434434
* - if `offer_currency` is set and `offer_amount` is not set:
435435
* - MUST NOT respond to the offer.
436436
* - if neither `offer_issuer_id` nor `offer_paths` are set:
437437
* - MUST NOT respond to the offer.
438438
*/
439-
offer->offer_amount = tal(offer, u64);
440-
*offer->offer_amount = 10000;
441-
442439
offer->offer_description = NULL;
443-
print_invalid_offer(offer, "Missing offer_description");
440+
print_invalid_offer(offer, "Missing offer_description and offer_amount");
444441
offer->offer_description = tal_utf8(tmpctx, "Test vectors");
445442

446443
offer->offer_amount = tal(offer, u64);

common/test/run-bolt12-format-string-test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
128128
* - SHOULD omit `offer_chains`, implying that bitcoin is only chain.
129129
* - if a specific minimum `offer_amount` is required for successful payment:
130130
* - MUST set `offer_amount` to the amount expected (per item).
131-
* - MUST set `offer_amount` greater than zero.
131+
* - MUST set `offer_amount` greater than zero.
132132
* - if the currency for `offer_amount` is that of all entries in `chains`:
133133
* - MUST specify `offer_amount` in multiples of the minimum lightning-payable unit
134134
* (e.g. milli-satoshis for bitcoin).

lightningd/channel_gossip.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -687,10 +687,10 @@ static void stash_remote_announce_sigs(struct channel *channel,
687687
* A node:
688688
* - If the `open_channel` message has the `announce_channel` bit set AND a
689689
* `shutdown` message has not been sent:
690-
* - After `channel_ready` has been sent and received AND the funding
691-
* transaction has enough confirmations to ensure that it won't be
692-
* reorganized:
693-
* - MUST send `announcement_signatures` for the funding transaction....
690+
* - After `channel_ready` has been sent and received AND the funding
691+
* transaction has enough confirmations to ensure that it won't be
692+
* reorganized:
693+
* - MUST send `announcement_signatures` for the funding transaction.
694694
* - Otherwise:
695695
* - MUST NOT send the `announcement_signatures` message.
696696
*/

openingd/openingd.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,12 @@ static u8 *funder_channel_start(struct state *state, u8 channel_flags,
332332
= state->upfront_shutdown_script[LOCAL];
333333

334334
/* BOLT #2:
335-
* - MUST set `channel_type`:
336-
* - MUST set it to a defined type representing the type it wants.
337-
* - MUST use the smallest bitmap possible to represent the channel
338-
* type.
339-
* - SHOULD NOT set it to a type containing a feature which was not
340-
* negotiated.
335+
* - MUST set `channel_type`:
336+
* - MUST set it to a defined type representing the type it wants.
337+
* - MUST use the smallest bitmap possible to represent the channel
338+
* type.
339+
* - SHOULD NOT set it to a type containing a feature which was not
340+
* negotiated.
341341
*/
342342
open_tlvs->channel_type = state->channel_type->features;
343343

0 commit comments

Comments
 (0)