From fa188c80ca207fd27c09ffdc3ca88db02fc62235 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 11 Feb 2025 08:39:36 +1030 Subject: [PATCH] common: update bolts to include hash value in bolt11 test vectors. Signed-off-by: Rusty Russell --- Makefile | 2 +- common/test/run-bolt11.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index cedd88fcf..0d96b0eb8 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ CCANDIR := ccan # Where we keep the BOLT RFCs BOLTDIR := ../bolts/ -DEFAULT_BOLTVERSION := fd83d7cee0369eb1d9068eb9864bff8b1f940938 +DEFAULT_BOLTVERSION := e0b1200ffa4220f3db6d518aa322f97e0a30cc1f # Can be overridden on cmdline. BOLTVERSION := $(DEFAULT_BOLTVERSION) diff --git a/common/test/run-bolt11.c b/common/test/run-bolt11.c index 553def5a5..21af91890 100644 --- a/common/test/run-bolt11.c +++ b/common/test/run-bolt11.c @@ -67,6 +67,8 @@ static void test_b11(const char *b11str, assert(!expect_b11->description); else assert(streq(b11->description, expect_b11->description)); + if (b11->description_hash) + assert(sha256_eq(b11->description_hash, expect_b11->description_hash)); if (!b11->payment_secret) assert(!expect_b11->payment_secret); @@ -252,7 +254,7 @@ int main(int argc, char *argv[]) * * `p`: payment hash... * * `h`: tagged field: hash of description * * `p5`: `data_length` (`p` = 1, `5` = 20; 1 * 32 + 20 == 52) - * * `8yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqs`: SHA256 of 'One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon' + * * `8yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqs`: SHA256 of 'One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon' (SHA256 hex: `3925b6f67e2c340036ed12093dd44e0368df1b6ea26c53dbe4811f58fd5db8c1`) * * `9`: features * * `qr`: `data_length` (`q` = 0, `r` = 3; 0 * 32 + 3 == 3) * * `sgq`: b100000100000000 @@ -271,6 +273,10 @@ int main(int argc, char *argv[]) abort(); b11->receiver_id = node; b11->description_hash = tal(b11, struct sha256); + if (!hex_decode("3925b6f67e2c340036ed12093dd44e0368df1b6ea26c53dbe4811f58fd5db8c1", + strlen("3925b6f67e2c340036ed12093dd44e0368df1b6ea26c53dbe4811f58fd5db8c1"), + b11->description_hash, sizeof(*b11->description_hash))) + abort(); set_feature_bit(&b11->features, 8); set_feature_bit(&b11->features, 14);