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.
This commit is contained in:
Olaoluwa Osuntokun 2017-06-10 18:15:03 -07:00
parent 3d63a97443
commit 650ba7e1ca
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -7,8 +7,10 @@ import (
) )
// OnionPacketSize is the size of the serialized Sphinx onion packet included // OnionPacketSize is the size of the serialized Sphinx onion packet included
// in each UpdateAddHTLC message. // in each UpdateAddHTLC message. The breakdown of the onion packet is as
const OnionPacketSize = 1254 // 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 // 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 // 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 // CommitSig message will move the pending HTLC to the newly created commitment
// transaction, marking them as "staged". // transaction, marking them as "staged".
type UpdateAddHTLC struct { type UpdateAddHTLC struct {
// ChanID is the particular active channel that this // ChanID is the particular active channel that this UpdateAddHTLC is
// UpdateAddHTLC is binded to. // bound to.
ChanID ChannelID ChanID ChannelID
// ID is the identification server for this HTLC. This value is // 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. // This is part of the lnwire.Message interface.
func (c *UpdateAddHTLC) MaxPayloadLength(uint32) uint32 { func (c *UpdateAddHTLC) MaxPayloadLength(uint32) uint32 {
// 1338 // 1450
return 32 + 8 + 4 + 8 + 32 + 1254 return 32 + 8 + 4 + 8 + 32 + 1366
} }