lnwire: update onion error encoding/decoding to match BOLT-0004

This commit updates the encoding/decoding for the onion errors to
properly match BOLT-0004. This commit does to major things: we increase
the max message size to 256 bytes to account for recent modifications
to the ChannelUpdate message, and also fold in the error code into the
failure message encapsulation itself.
This commit is contained in:
Olaoluwa Osuntokun
2017-08-21 22:38:48 -07:00
parent b174ae80bf
commit 1d1f9f1724
2 changed files with 49 additions and 27 deletions

View File

@@ -12,8 +12,8 @@ type OpaqueReason []byte
// next commitment transaction, with the UpdateFailHTLC propagated backwards in
// the route to fully undo the HTLC.
type UpdateFailHTLC struct {
// ChanIDPoint is the particular active channel that this UpdateFailHTLC
// is bound to.
// ChanIDPoint is the particular active channel that this
// UpdateFailHTLC is bound to.
ChanID ChannelID
// ID references which HTLC on the remote node's commitment transaction
@@ -79,7 +79,7 @@ func (c *UpdateFailHTLC) MaxPayloadLength(uint32) uint32 {
length += 2
// Length of the Reason
length += 166
length += 292
return length
}