2016-07-15 14:02:59 +03:00
|
|
|
// Copyright (c) 2016 Bitfury Group Limited
|
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file LICENSE or http://www.opensource.org/licenses/mit-license.php
|
|
|
|
|
|
|
|
package lnwire
|
2016-08-11 21:54:44 +03:00
|
|
|
|
2016-07-15 14:02:59 +03:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io"
|
2016-08-21 17:46:54 +03:00
|
|
|
"bytes"
|
2016-07-15 14:02:59 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
type NeighborAckMessage struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (msg *NeighborAckMessage) String() string {
|
2016-08-23 22:41:41 +03:00
|
|
|
return fmt.Sprintf("NeighborAckMessage{}",)
|
2016-07-15 14:02:59 +03:00
|
|
|
}
|
|
|
|
|
2016-08-11 21:54:44 +03:00
|
|
|
func (msg *NeighborAckMessage) Command() uint32 {
|
2016-07-15 14:02:59 +03:00
|
|
|
return CmdNeighborAckMessage
|
|
|
|
}
|
|
|
|
|
2016-08-11 21:54:44 +03:00
|
|
|
func (msg *NeighborAckMessage) Encode(w io.Writer, pver uint32) error {
|
2016-08-23 22:41:41 +03:00
|
|
|
// Transmission function work incorrect with empty messages so write some random string to make message not empty
|
|
|
|
w.Write([]byte("NeighborAckMessage"))
|
2016-07-15 14:02:59 +03:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2016-08-11 21:54:44 +03:00
|
|
|
func (msg *NeighborAckMessage) Decode(r io.Reader, pver uint32) error {
|
2016-08-21 17:46:54 +03:00
|
|
|
buff := make([]byte, 18)
|
|
|
|
_, err := r.Read(buff)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if !bytes.Equal(buff, []byte("NeighborAckMessage")) {
|
|
|
|
fmt.Errorf("Can't decode NeighborAckMessage message")
|
|
|
|
}
|
2016-07-15 14:02:59 +03:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2016-08-11 21:54:44 +03:00
|
|
|
func (msg *NeighborAckMessage) MaxPayloadLength(uint32) uint32 {
|
2016-08-21 17:46:54 +03:00
|
|
|
// Length of the string "NeighborAckMessage" used in Encode
|
|
|
|
// Transmission functions work bad if it is 0
|
|
|
|
return 18
|
2016-08-23 22:41:41 +03:00
|
|
|
|
2016-07-15 14:02:59 +03:00
|
|
|
}
|
|
|
|
|
2016-08-11 21:54:44 +03:00
|
|
|
func (msg *NeighborAckMessage) Validate() error {
|
2016-07-15 14:02:59 +03:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2016-08-11 21:54:44 +03:00
|
|
|
var _ Message = (*NeighborAckMessage)(nil)
|