peer+lnwire: add LinkUpdater iface and impl on relevant msgs
Removes longstanding TODO to simplify parsing of target chanid.
This commit is contained in:
8 files changed
+84
-30
No files matched your search
+11
-1
@@ -1,6 +1,8 @@
|
||||
package lnwire
|
||||
|
||||
import "io"
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
// CommitSig is sent by either side to stage any pending HTLC's in the
|
||||
// receiver's pending set into a new commitment state. Implicitly, the new
|
||||
@@ -83,3 +85,11 @@ func (c *CommitSig) MaxPayloadLength(uint32) uint32 {
|
||||
// 32 + 64 + 2 + max_allowed_htlcs
|
||||
return MaxMessagePayload
|
||||
}
|
||||
|
||||
// TargetChanID returns the channel id of the link for which this message is
|
||||
// intended.
|
||||
//
|
||||
// NOTE: Part of lnd.LinkUpdater interface.
|
||||
func (c *CommitSig) TargetChanID() ChannelID {
|
||||
return c.ChanID
|
||||
}
|
||||
@@ -81,3 +81,11 @@ func (c *RevokeAndAck) MaxPayloadLength(uint32) uint32 {
|
||||
// 32 + 32 + 33
|
||||
return 97
|
||||
}
|
||||
|
||||
// TargetChanID returns the channel id of the link for which this message is
|
||||
// intended.
|
||||
//
|
||||
// NOTE: Part of lnd.LinkUpdater interface.
|
||||
func (c *RevokeAndAck) TargetChanID() ChannelID {
|
||||
return c.ChanID
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package lnwire
|
||||
|
||||
import "io"
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
// OnionPacketSize is the size of the serialized Sphinx onion packet included
|
||||
// in each UpdateAddHTLC message. The breakdown of the onion packet is as
|
||||
@@ -107,3 +109,11 @@ func (c *UpdateAddHTLC) MaxPayloadLength(uint32) uint32 {
|
||||
// 1450
|
||||
return 32 + 8 + 4 + 8 + 32 + 1366
|
||||
}
|
||||
|
||||
// TargetChanID returns the channel id of the link for which this message is
|
||||
// intended.
|
||||
//
|
||||
// NOTE: Part of lnd.LinkUpdater interface.
|
||||
func (c *UpdateAddHTLC) TargetChanID() ChannelID {
|
||||
return c.ChanID
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package lnwire
|
||||
|
||||
import "io"
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
// OpaqueReason is an opaque encrypted byte slice that encodes the exact
|
||||
// failure reason and additional some supplemental data. The contents of this
|
||||
@@ -83,3 +85,11 @@ func (c *UpdateFailHTLC) MaxPayloadLength(uint32) uint32 {
|
||||
|
||||
return length
|
||||
}
|
||||
|
||||
// TargetChanID returns the channel id of the link for which this message is
|
||||
// intended.
|
||||
//
|
||||
// NOTE: Part of lnd.LinkUpdater interface.
|
||||
func (c *UpdateFailHTLC) TargetChanID() ChannelID {
|
||||
return c.ChanID
|
||||
}
|
||||
@@ -73,3 +73,11 @@ func (c *UpdateFailMalformedHTLC) MaxPayloadLength(uint32) uint32 {
|
||||
// 32 + 8 + 32 + 2
|
||||
return 74
|
||||
}
|
||||
|
||||
// TargetChanID returns the channel id of the link for which this message is
|
||||
// intended.
|
||||
//
|
||||
// NOTE: Part of lnd.LinkUpdater interface.
|
||||
func (c *UpdateFailMalformedHTLC) TargetChanID() ChannelID {
|
||||
return c.ChanID
|
||||
}
|
||||
@@ -68,3 +68,11 @@ func (c *UpdateFee) MaxPayloadLength(uint32) uint32 {
|
||||
// 32 + 4
|
||||
return 36
|
||||
}
|
||||
|
||||
// TargetChanID returns the channel id of the link for which this message is
|
||||
// intended.
|
||||
//
|
||||
// NOTE: Part of lnd.LinkUpdater interface.
|
||||
func (c *UpdateFee) TargetChanID() ChannelID {
|
||||
return c.ChanID
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package lnwire
|
||||
|
||||
import "io"
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
// UpdateFulfillHTLC is sent by Alice to Bob when she wishes to settle a
|
||||
// particular HTLC referenced by its HTLCKey within a specific active channel
|
||||
@@ -76,3 +78,11 @@ func (c *UpdateFulfillHTLC) MaxPayloadLength(uint32) uint32 {
|
||||
// 32 + 8 + 32
|
||||
return 72
|
||||
}
|
||||
|
||||
// TargetChanID returns the channel id of the link for which this message is
|
||||
// intended.
|
||||
//
|
||||
// NOTE: Part of lnd.LinkUpdater interface.
|
||||
func (c *UpdateFulfillHTLC) TargetChanID() ChannelID {
|
||||
return c.ChanID
|
||||
}
|
||||
Reference in new issue
Block a user