lnwire: rename Expiry to TimeLockDelta within ChannelUpdateAnnouncement

This commit modifies the ChannelUpdateAnnouncement to rename the Expiry
variable instead of TimeLockDelta as that is more descriptive of the
purpose of the attribute itself.
This commit is contained in:
Olaoluwa Osuntokun 2017-03-05 22:43:34 -06:00
parent dc5eb8de37
commit 743de45c92
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
3 changed files with 32 additions and 23 deletions

View File

@ -26,14 +26,16 @@ type ChannelUpdateAnnouncement struct {
Timestamp uint32
// Flags least-significant bit must be set to 0 if the creating node
// corresponds to the first node in previously sent channel
// corresponds to the first node in the previously sent channel
// announcement and 1 otherwise.
Flags uint16
// Expiry is the minimum number of blocks this node requires to be
// added to the expiry of HTLCs. This is a security parameter determined
// by the node operator.
Expiry uint16
// TimeLockDelta is the minimum number of blocks this node requires to
// be added to the expiry of HTLCs. This is a security parameter
// determined by the node operator. This value represents the required
// gap between the time locks of the incoming and outgoing HTLC's set
// to this node.
TimeLockDelta uint16
// HtlcMinimumMstat is the minimum HTLC value which will be accepted.
HtlcMinimumMstat uint32
@ -58,7 +60,7 @@ func (a *ChannelUpdateAnnouncement) Validate() error {
// message, we can't validate the signature on this stage, it should
// be validated latter - in discovery service handler.
if a.Expiry == 0 {
if a.TimeLockDelta == 0 {
return errors.New("expiry should be greater then zero")
}
@ -75,7 +77,7 @@ func (c *ChannelUpdateAnnouncement) Decode(r io.Reader, pver uint32) error {
&c.ChannelID,
&c.Timestamp,
&c.Flags,
&c.Expiry,
&c.TimeLockDelta,
&c.HtlcMinimumMstat,
&c.FeeBaseMstat,
&c.FeeProportionalMillionths,
@ -97,7 +99,7 @@ func (c *ChannelUpdateAnnouncement) Encode(w io.Writer, pver uint32) error {
c.ChannelID,
c.Timestamp,
c.Flags,
c.Expiry,
c.TimeLockDelta,
c.HtlcMinimumMstat,
c.FeeBaseMstat,
c.FeeProportionalMillionths,
@ -161,7 +163,7 @@ func (c *ChannelUpdateAnnouncement) DataToSign() ([]byte, error) {
c.ChannelID,
c.Timestamp,
c.Flags,
c.Expiry,
c.TimeLockDelta,
c.HtlcMinimumMstat,
c.FeeBaseMstat,
c.FeeProportionalMillionths,

View File

@ -12,7 +12,7 @@ func TestChannelUpdateAnnouncementEncodeDecode(t *testing.T) {
ChannelID: someChannelID,
Timestamp: maxUint32,
Flags: maxUint16,
Expiry: maxUint16,
TimeLockDelta: maxUint16,
HtlcMinimumMstat: maxUint32,
FeeBaseMstat: maxUint32,
FeeProportionalMillionths: maxUint32,

View File

@ -70,29 +70,36 @@ func (a *Alias) Validate() error {
return nil
}
// NodeAnnouncement message is used to announce the presence of a lightning node
// and signal that the node is accepting incoming connections.
// NodeAnnouncement message is used to announce the presence of a Lightning
// node and also to signal that the node is accepting incoming connections.
// Each NodeAnnouncement authenticating the advertised information within the
// announcement via a signature using the advertised node pubkey.
type NodeAnnouncement struct {
// Signature is used to prove the ownership of node id.
Signature *btcec.Signature
// Timestamp allows ordering in the case of multiple announcements.
// Timestamp allows ordering in the case of multiple
// announcements.
Timestamp uint32
// Address includes two specification fields: 'ipv6' and 'port' on which
// the node is accepting incoming connections.
// Address includes two specification fields: 'ipv6' and
// 'port' on which the node is accepting incoming connections.
Address *net.TCPAddr
// NodeID is a public key which is used as node identification.
// NodeID is a public key which is used as node
// identification.
NodeID *btcec.PublicKey
// RGBColor is used to customize their node's appearance in maps and graphs
// RGBColor is used to customize their node's appearance in
// maps and graphs
RGBColor RGB
// pad is used to reserve to additional bytes for future usage.
// pad is used to reserve to additional bytes for future
// usage.
pad uint16
// Alias is used to customize their node's appearance in maps and graphs
// Alias is used to customize their node's appearance in maps
// and graphs
Alias Alias
}
@ -109,8 +116,8 @@ func (a *NodeAnnouncement) Validate() error {
return nil
}
// Decode deserializes a serialized NodeAnnouncement stored in the
// passed io.Reader observing the specified protocol version.
// Decode deserializes a serialized NodeAnnouncement stored in the passed
// io.Reader observing the specified protocol version.
//
// This is part of the lnwire.Message interface.
func (c *NodeAnnouncement) Decode(r io.Reader, pver uint32) error {
@ -130,8 +137,8 @@ func (c *NodeAnnouncement) Decode(r io.Reader, pver uint32) error {
return nil
}
// Encode serializes the target NodeAnnouncement into the passed
// io.Writer observing the protocol version specified.
// Encode serializes the target NodeAnnouncement into the passed io.Writer
// observing the protocol version specified.
//
// This is part of the lnwire.Message interface.
func (c *NodeAnnouncement) Encode(w io.Writer, pver uint32) error {