From 9038364c63d560deb734887e3ac1243b69441881 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Tue, 21 Jan 2020 16:21:00 +0100 Subject: [PATCH] sphinx: Actually use the pad stream to generate the packet We flipped two buffers and were not actually using the chacha20 stream. --- common/sphinx.c | 2 +- tests/test_pay.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/sphinx.c b/common/sphinx.c index aea8b6ae8..4ffa61b74 100644 --- a/common/sphinx.c +++ b/common/sphinx.c @@ -425,7 +425,7 @@ struct onionpacket *create_onionpacket( /* Note that this is just hop_payloads: the rest of the packet is * overwritten below or above anyway. */ generate_key(padkey, "pad", 3, sp->session_key); - generate_cipher_stream(stream, padkey, ROUTING_INFO_SIZE); + generate_cipher_stream(packet->routinginfo, padkey, ROUTING_INFO_SIZE); generate_header_padding(filler, sizeof(filler), sp, params); diff --git a/tests/test_pay.py b/tests/test_pay.py index da974239b..420e66560 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -2479,7 +2479,7 @@ def test_createonion_rpc(node_factory): # The trailer is generated using the filler and can be ued as a # checksum. This trailer is from the test-vector in the specs. print(res) - assert(res['onion'].endswith('be89e4701eb870f8ed64fafa446c78df3ea')) + assert(res['onion'].endswith('9400f45a48e6dc8ddbaeb3')) @unittest.skipIf(not DEVELOPER, "gossip propagation is slow without DEVELOPER=1")