From 83d9a0005d5fc01049188288c35479afc88d4235 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 29 Jul 2021 15:58:46 +0930 Subject: [PATCH] common/test: Fix test vector generation. We were printing out the final merkle root before calculating it, resulting in the final one being the same as the previous. Reported-by: Aditya Sharma Signed-off-by: Rusty Russell --- common/test/run-bolt12_merkle.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/common/test/run-bolt12_merkle.c b/common/test/run-bolt12_merkle.c index 662ccfab0..db6baae7b 100644 --- a/common/test/run-bolt12_merkle.c +++ b/common/test/run-bolt12_merkle.c @@ -383,16 +383,17 @@ int main(int argc, char *argv[]) ordered(b12, H(LnBranch, ordered(leaf[4], leaf[5])))))); - json_out("],"); - json_out("\"merkle\": \"%s\"", - type_to_string(tmpctx, struct sha256, m)); - json_out("}]"); - m = H(LnBranch, ordered(H(LnBranch, ordered(H(LnBranch, ordered(leaf[0], leaf[1])), H(LnBranch, ordered(leaf[2], leaf[3])))), H(LnBranch, ordered(leaf[4], leaf[5])))); + + json_out("],"); + json_out("\"merkle\": \"%s\"", + type_to_string(tmpctx, struct sha256, m)); + json_out("}]"); + printf("offer = %s, merkle = %s\n", tal_hex(tmpctx, all), type_to_string(tmpctx, struct sha256, m));