From 8248dccaeee911ea04f16fed6442fd82b7f600d8 Mon Sep 17 00:00:00 2001 From: ZmnSCPxj Date: Wed, 31 Jan 2018 17:16:05 +0000 Subject: [PATCH] channeld: Properly pad and HMAC onion replies that our masterd generated. --- channeld/channel.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/channeld/channel.c b/channeld/channel.c index 253cefcff..cb7fbc3c7 100644 --- a/channeld/channel.c +++ b/channeld/channel.c @@ -2332,10 +2332,16 @@ static void handle_fail(struct peer *peer, const u8 *inmsg) failcode); } else { u8 *reply; + u8 *failmsg; + + if (failcode) { + failmsg = make_failmsg(inmsg, peer, h, + failcode, &scid); + errpkt = create_onionreply(inmsg, + h->shared_secret, + failmsg); + } - if (failcode) - errpkt = make_failmsg(inmsg, peer, h, - failcode, &scid); reply = wrap_onionreply(inmsg, h->shared_secret, errpkt); msg = towire_update_fail_htlc(peer, &peer->channel_id,