lnwire: Add BOLT#1 'init' message

'init' message is the first message reveals the features supported or required
by this node. Nodes wait for receipt of the other's features to simplify error
diagnosis where features are incompatible. This message will help negotioate the
the features which are supported by both sides.
This commit is contained in:
Andrey Samokhvalov authored and Olaoluwa Osuntokun committed 2017-02-17 13:27:29 +08:00
1 parent 5560f032f6
commit 3dd619fb35
6 files changed
+566

No files matched your search

+12
View File
@@ -282,6 +282,10 @@ func writeElement(w io.Writer, element interface{}) error {
if _, err := w.Write(idx[:]); err != nil {
return err
}
case *FeatureVector:
if err := e.Encode(w); err != nil {
return err
}
case *wire.OutPoint:
// TODO(roasbeef): consolidate with above
// First write out the previous txid.
@@ -455,6 +459,14 @@ func readElement(r io.Reader, element interface{}) error {
return err
}
*e = pubKey
case **FeatureVector:
f, err := NewFeatureVectorFromReader(r)
if err != nil {
return err
}
*e = f
case *[]uint64:
var numItems uint16
if err := readElement(r, &numItems); err != nil {