Skip to content

Commit 09e745e

Browse files
committed
common: update bolts to include hash value in bolt11 test vectors.
Signed-off-by: Rusty Russell <[email protected]>
1 parent 727e068 commit 09e745e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Makefile

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

2727
# Where we keep the BOLT RFCs
2828
BOLTDIR := ../bolts/
29-
DEFAULT_BOLTVERSION := fd83d7cee0369eb1d9068eb9864bff8b1f940938
29+
DEFAULT_BOLTVERSION := e0b1200ffa4220f3db6d518aa322f97e0a30cc1f
3030
# Can be overridden on cmdline.
3131
BOLTVERSION := $(DEFAULT_BOLTVERSION)
3232

common/test/run-bolt11.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ static void test_b11(const char *b11str,
6767
assert(!expect_b11->description);
6868
else
6969
assert(streq(b11->description, expect_b11->description));
70+
if (b11->description_hash)
71+
assert(sha256_eq(b11->description_hash, expect_b11->description_hash));
7072

7173
if (!b11->payment_secret)
7274
assert(!expect_b11->payment_secret);
@@ -252,7 +254,7 @@ int main(int argc, char *argv[])
252254
* * `p`: payment hash...
253255
* * `h`: tagged field: hash of description
254256
* * `p5`: `data_length` (`p` = 1, `5` = 20; 1 * 32 + 20 == 52)
255-
* * `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'
257+
* * `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`)
256258
* * `9`: features
257259
* * `qr`: `data_length` (`q` = 0, `r` = 3; 0 * 32 + 3 == 3)
258260
* * `sgq`: b100000100000000
@@ -271,6 +273,10 @@ int main(int argc, char *argv[])
271273
abort();
272274
b11->receiver_id = node;
273275
b11->description_hash = tal(b11, struct sha256);
276+
if (!hex_decode("3925b6f67e2c340036ed12093dd44e0368df1b6ea26c53dbe4811f58fd5db8c1",
277+
strlen("3925b6f67e2c340036ed12093dd44e0368df1b6ea26c53dbe4811f58fd5db8c1"),
278+
b11->description_hash, sizeof(*b11->description_hash)))
279+
abort();
274280
set_feature_bit(&b11->features, 8);
275281
set_feature_bit(&b11->features, 14);
276282

0 commit comments

Comments
 (0)