lnwire: embed ChannelID within the announcement structs rather than pointer

This commit is contained in:
Olaoluwa Osuntokun committed 2016-12-27 16:43:21 -08:00
1 parent 597b4ee3d3
commit 5ee201e712
4 files changed
+10 -8

No files matched your search

+3 -3
View File
@@ -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[:]),