From 650ba7e1cae64f9e555483b86e6d20e8b5d73dc0 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sat, 10 Jun 2017 18:15:03 -0700 Subject: [PATCH] lnwire: update OnionPacketSize for new onion payload format This commit updates the OnionPacketSize constant in order to reflect the size of the onion payload as a result of the recent changes to the sphinx packet format in the specification. --- lnwire/update_add_htlc.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lnwire/update_add_htlc.go b/lnwire/update_add_htlc.go index fedbc2f3..e2923d2f 100644 --- a/lnwire/update_add_htlc.go +++ b/lnwire/update_add_htlc.go @@ -7,8 +7,10 @@ import ( ) // OnionPacketSize is the size of the serialized Sphinx onion packet included -// in each UpdateAddHTLC message. -const OnionPacketSize = 1254 +// in each UpdateAddHTLC message. The breakdown of the onion packet is as +// follows: 1-byte version, 33-byte ephemeral public key (for ECDH), 1300-bytes +// of per-hop data, and a 32-byte HMAC over the entire packet. +const OnionPacketSize = 1366 // UpdateAddHTLC is the message sent by Alice to Bob when she wishes to add an // HTLC to his remote commitment transaction. In addition to information @@ -18,8 +20,8 @@ const OnionPacketSize = 1254 // CommitSig message will move the pending HTLC to the newly created commitment // transaction, marking them as "staged". type UpdateAddHTLC struct { - // ChanID is the particular active channel that this - // UpdateAddHTLC is binded to. + // ChanID is the particular active channel that this UpdateAddHTLC is + // bound to. ChanID ChannelID // ID is the identification server for this HTLC. This value is @@ -106,6 +108,6 @@ func (c *UpdateAddHTLC) MsgType() MessageType { // // This is part of the lnwire.Message interface. func (c *UpdateAddHTLC) MaxPayloadLength(uint32) uint32 { - // 1338 - return 32 + 8 + 4 + 8 + 32 + 1254 + // 1450 + return 32 + 8 + 4 + 8 + 32 + 1366 }