common: update bolts to include hash value in bolt11 test vectors.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2025-02-11 08:39:36 +10:30
committed by Alex Myers
parent b879cb475f
commit fa188c80ca
2 changed files with 8 additions and 2 deletions

View File

@@ -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);