Skip to content

Commit e1cbfae

Browse files
committed
doc: update BOLT quotes (to include LOW-S-standard rule).
Signed-off-by: Rusty Russell <[email protected]>
1 parent 9bb2b4a commit e1cbfae

File tree

6 files changed

+22
-9
lines changed

6 files changed

+22
-9
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ CCANDIR := ccan
2424

2525
# Where we keep the BOLT RFCs
2626
BOLTDIR := ../lightning-rfc/
27-
BOLTVERSION := 7e8c478aef0d23a445845b7d297b0e804583697c
27+
BOLTVERSION := 01f29bf9feca66476423676365187e2175a3934b
2828

2929
-include config.vars
3030

bitcoin/signature.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,14 @@ bool check_signed_hash(const struct sha256_double *hash,
173173
{
174174
int ret;
175175

176+
/* BOLT #2:
177+
*
178+
* - if `signature` is incorrect OR non-compliant with
179+
* LOW-S-standard rule
180+
*/
181+
/* From the secp256k1_ecdsa_verify documentation: "To avoid
182+
* accepting malleable signatures, only ECDSA signatures in
183+
* lower-S form are accepted." */
176184
ret = secp256k1_ecdsa_verify(secp256k1_ctx,
177185
signature,
178186
hash->sha.u.u8, &key->pubkey);

channeld/channeld.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,8 @@ static void handle_peer_commit_sig(struct peer *peer, const u8 *msg)
13141314
*
13151315
* A receiving node:
13161316
* - once all pending updates are applied:
1317-
* - if `signature` is not valid for its local commitment transaction:
1317+
* - if `signature` is not valid for its local commitment transaction
1318+
* OR non-compliant with LOW-S-standard rule...:
13181319
* - MUST fail the channel.
13191320
*/
13201321
if (!check_tx_sig(txs[0], 0, NULL, funding_wscript,
@@ -1349,7 +1350,7 @@ static void handle_peer_commit_sig(struct peer *peer, const u8 *msg)
13491350
/* BOLT #2:
13501351
*
13511352
* - if any `htlc_signature` is not valid for the corresponding HTLC
1352-
* transaction:
1353+
* transaction OR non-compliant with LOW-S-standard rule...:
13531354
* - MUST fail the channel.
13541355
*/
13551356
for (i = 0; i < tal_count(htlc_sigs); i++) {

closingd/closingd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,8 @@ receive_offer(struct per_peer_state *pps,
368368
*
369369
* The receiving node:
370370
* - if the `signature` is not valid for either variant of closing transaction
371-
* specified in [BOLT #3](03-transactions.md#closing-transaction):
371+
* specified in [BOLT #3](03-transactions.md#closing-transaction)
372+
* OR non-compliant with LOW-S-standard rule...:
372373
* - MUST fail the connection.
373374
*/
374375
tx = close_tx(tmpctx, chainparams, pps, channel_id,

openingd/dualopend.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,8 @@ static void accepter_start(struct state *state, const u8 *oc2_msg)
17161716
/* BOLT #2:
17171717
*
17181718
* The recipient:
1719-
* - if `signature` is incorrect:
1719+
* - if `signature` is incorrect OR non-compliant with LOW-S-standard
1720+
* rule...:
17201721
* - MUST fail the channel.
17211722
*/
17221723
if (!check_tx_sig(local_commit, 0, NULL, wscript,
@@ -2197,7 +2198,8 @@ static void opener_start(struct state *state, u8 *msg)
21972198
/* BOLT #2:
21982199
*
21992200
* The recipient:
2200-
* - if `signature` is incorrect:
2201+
* - if `signature` is incorrect OR non-compliant with LOW-S-standard
2202+
* rule...:
22012203
* - MUST fail the channel.
22022204
*/
22032205
if (!check_tx_sig(local_commit, 0, NULL, wscript, &state->their_funding_pubkey,

openingd/openingd.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,8 +628,8 @@ static bool funder_finalize_channel_setup(struct state *state,
628628
/* BOLT #2:
629629
*
630630
* The recipient:
631-
* - if `signature` is incorrect:
632-
* - MUST fail the channel.
631+
* - if `signature` is incorrect OR non-compliant with LOW-S-standard rule...:
632+
* - MUST fail the channel
633633
*/
634634
/* So we create *our* initial commitment transaction, and check the
635635
* signature they sent against that. */
@@ -1004,7 +1004,8 @@ static u8 *fundee_channel(struct state *state, const u8 *open_channel_msg)
10041004
/* BOLT #2:
10051005
*
10061006
* The recipient:
1007-
* - if `signature` is incorrect:
1007+
* - if `signature` is incorrect OR non-compliant with LOW-S-standard
1008+
* rule...:
10081009
* - MUST fail the channel.
10091010
*/
10101011
local_commit = initial_channel_tx(state, &wscript, state->channel,

0 commit comments

Comments
 (0)