diff --git a/lnwire/channel_announcement.go b/lnwire/channel_announcement.go index 2a8ec3be..1854dc7c 100644 --- a/lnwire/channel_announcement.go +++ b/lnwire/channel_announcement.go @@ -44,7 +44,7 @@ type ChannelAnnouncement struct { SecondNodeSig *btcec.Signature // ChannelID is the unique description of the funding transaction. - ChannelID *ChannelID + ChannelID ChannelID // This signatures are used by nodes in order to create cross // references between node's channel and node. Requiring the bitcoin diff --git a/lnwire/channel_update_announcement.go b/lnwire/channel_update_announcement.go index 803e945d..363d6570 100644 --- a/lnwire/channel_update_announcement.go +++ b/lnwire/channel_update_announcement.go @@ -4,8 +4,9 @@ import ( "bytes" "errors" "fmt" - "github.com/roasbeef/btcd/btcec" "io" + + "github.com/roasbeef/btcd/btcec" ) // ChannelUpdateAnnouncement message is used after channel has been initially @@ -18,7 +19,7 @@ type ChannelUpdateAnnouncement struct { Signature *btcec.Signature // ChannelID is the unique description of the funding transaction. - ChannelID *ChannelID + ChannelID ChannelID // Timestamp allows ordering in the case of multiple announcements. // We should ignore the message if timestamp is not greater than diff --git a/lnwire/lnwire.go b/lnwire/lnwire.go index bd102386..f824d5e2 100644 --- a/lnwire/lnwire.go +++ b/lnwire/lnwire.go @@ -326,7 +326,7 @@ func writeElement(w io.Writer, element interface{}) error { if err != nil { return err } - case *ChannelID: + case ChannelID: // Check that field fit in 3 bytes and write the blockHeight if e.BlockHeight > ((1 << 24) - 1) { return errors.New("block height should fit in 3 bytes") @@ -669,7 +669,7 @@ func readElement(r io.Reader, element interface{}) error { if err != nil { return err } - case **ChannelID: + case *ChannelID: var blockHeight [4]byte if _, err = io.ReadFull(r, blockHeight[1:]); err != nil { return err @@ -685,7 +685,7 @@ func readElement(r io.Reader, element interface{}) error { return err } - *e = &ChannelID{ + *e = ChannelID{ BlockHeight: binary.BigEndian.Uint32(blockHeight[:]), TxIndex: binary.BigEndian.Uint32(txIndex[:]), TxPosition: binary.BigEndian.Uint16(txPosition[:]), diff --git a/lnwire/lnwire_test.go b/lnwire/lnwire_test.go index facc7c21..715e721f 100644 --- a/lnwire/lnwire_test.go +++ b/lnwire/lnwire_test.go @@ -7,10 +7,11 @@ import ( "reflect" "testing" + "net" + "github.com/roasbeef/btcd/btcec" "github.com/roasbeef/btcd/txscript" "github.com/roasbeef/btcd/wire" - "net" ) // Common variables and functions for the message tests @@ -103,7 +104,7 @@ var ( someAddress = &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 8333} - someChannelID = &ChannelID{ + someChannelID = ChannelID{ BlockHeight: maxUint24, TxIndex: maxUint24, TxPosition: maxUint16,