From 68a6084babb157def92975da95c3e8cb25d92f5c Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 12 Sep 2023 13:53:19 +0930 Subject: [PATCH] lightningd: update to BOLT 7d3ef5a6b20eb84982ea2bfc029497082adf20d8 "Allow unset `onion_hash` in `invalid_onion_blinding` (#1093)" Explicitly allow all-zero in the onion_hash: we didn't do anything except log if it was unexpected anyway. Signed-off-by: Rusty Russell --- Makefile | 2 +- lightningd/peer_htlcs.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c32f1f91e..0d7c608e8 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ CCANDIR := ccan # Where we keep the BOLT RFCs BOLTDIR := ../bolts/ -DEFAULT_BOLTVERSION := 7f53a3e46ed59f19463447d5fa63b3e484c708a5 +DEFAULT_BOLTVERSION := 7d3ef5a6b20eb84982ea2bfc029497082adf20d8 # Can be overridden on cmdline. BOLTVERSION := $(DEFAULT_BOLTVERSION) diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index a4a316084..38598b910 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -1,5 +1,6 @@ #include "config.h" #include +#include #include #include #include @@ -1571,16 +1572,19 @@ static bool peer_failed_our_htlc(struct channel *channel, /* BOLT #2: * * - if the `sha256_of_onion` in `update_fail_malformed_htlc` - * doesn't match the onion it sent: + * doesn't match the onion it sent and is not all zero: * - MAY retry or choose an alternate error response. */ sha256(&our_sha256_of_onion, hout->onion_routing_packet, sizeof(hout->onion_routing_packet)); - if (!sha256_eq(failed->sha256_of_onion, &our_sha256_of_onion)) + if (!sha256_eq(failed->sha256_of_onion, &our_sha256_of_onion) + && !memeqzero(failed->sha256_of_onion, + sizeof(failed->sha256_of_onion))) { log_unusual(channel->log, "update_fail_malformed_htlc for bad onion" " for htlc with id %"PRIu64".", hout->key.id); + } /* BOLT #2: *