discovery: ensure we populate ExtraOpaqueData when writing/reading from disk

This commit is contained in:
Olaoluwa Osuntokun 2018-08-31 20:13:54 -07:00
parent 0fc20cee64
commit 841e24399c
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -275,13 +275,14 @@ func (d *AuthenticatedGossiper) SynchronizeNode(syncPeer lnpeer.Peer) error {
return nil, err return nil, err
} }
return &lnwire.NodeAnnouncement{ return &lnwire.NodeAnnouncement{
Signature: wireSig, Signature: wireSig,
Timestamp: uint32(n.LastUpdate.Unix()), Timestamp: uint32(n.LastUpdate.Unix()),
Addresses: n.Addresses, Addresses: n.Addresses,
NodeID: n.PubKeyBytes, NodeID: n.PubKeyBytes,
Features: n.Features.RawFeatureVector, Features: n.Features.RawFeatureVector,
RGBColor: n.Color, RGBColor: n.Color,
Alias: alias, Alias: alias,
ExtraOpaqueData: n.ExtraOpaqueData,
}, nil }, nil
} }
@ -1645,6 +1646,7 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(
AuthSigBytes: msg.Signature.ToSignatureBytes(), AuthSigBytes: msg.Signature.ToSignatureBytes(),
Features: features, Features: features,
Color: msg.RGBColor, Color: msg.RGBColor,
ExtraOpaqueData: msg.ExtraOpaqueData,
} }
if err := d.cfg.Router.AddNode(node); err != nil { if err := d.cfg.Router.AddNode(node); err != nil {
@ -1767,6 +1769,7 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(
BitcoinKey2Bytes: msg.BitcoinKey2, BitcoinKey2Bytes: msg.BitcoinKey2,
AuthProof: proof, AuthProof: proof,
Features: featureBuf.Bytes(), Features: featureBuf.Bytes(),
ExtraOpaqueData: msg.ExtraOpaqueData,
} }
// We will add the edge to the channel router. If the nodes // We will add the edge to the channel router. If the nodes
@ -2036,6 +2039,7 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(
MinHTLC: msg.HtlcMinimumMsat, MinHTLC: msg.HtlcMinimumMsat,
FeeBaseMSat: lnwire.MilliSatoshi(msg.BaseFee), FeeBaseMSat: lnwire.MilliSatoshi(msg.BaseFee),
FeeProportionalMillionths: lnwire.MilliSatoshi(msg.FeeRate), FeeProportionalMillionths: lnwire.MilliSatoshi(msg.FeeRate),
ExtraOpaqueData: msg.ExtraOpaqueData,
} }
if err := d.cfg.Router.UpdateEdge(update); err != nil { if err := d.cfg.Router.UpdateEdge(update); err != nil {
@ -2504,6 +2508,7 @@ func (d *AuthenticatedGossiper) updateChannel(info *channeldb.ChannelEdgeInfo,
HtlcMinimumMsat: edge.MinHTLC, HtlcMinimumMsat: edge.MinHTLC,
BaseFee: uint32(edge.FeeBaseMSat), BaseFee: uint32(edge.FeeBaseMSat),
FeeRate: uint32(edge.FeeProportionalMillionths), FeeRate: uint32(edge.FeeProportionalMillionths),
ExtraOpaqueData: edge.ExtraOpaqueData,
} }
chanUpdate.Signature, err = lnwire.NewSigFromRawSignature(edge.SigBytes) chanUpdate.Signature, err = lnwire.NewSigFromRawSignature(edge.SigBytes)
if err != nil { if err != nil {
@ -2545,13 +2550,14 @@ func (d *AuthenticatedGossiper) updateChannel(info *channeldb.ChannelEdgeInfo,
if info.AuthProof != nil { if info.AuthProof != nil {
chanID := lnwire.NewShortChanIDFromInt(info.ChannelID) chanID := lnwire.NewShortChanIDFromInt(info.ChannelID)
chanAnn = &lnwire.ChannelAnnouncement{ chanAnn = &lnwire.ChannelAnnouncement{
ShortChannelID: chanID, ShortChannelID: chanID,
NodeID1: info.NodeKey1Bytes, NodeID1: info.NodeKey1Bytes,
NodeID2: info.NodeKey2Bytes, NodeID2: info.NodeKey2Bytes,
ChainHash: info.ChainHash, ChainHash: info.ChainHash,
BitcoinKey1: info.BitcoinKey1Bytes, BitcoinKey1: info.BitcoinKey1Bytes,
Features: lnwire.NewRawFeatureVector(), Features: lnwire.NewRawFeatureVector(),
BitcoinKey2: info.BitcoinKey2Bytes, BitcoinKey2: info.BitcoinKey2Bytes,
ExtraOpaqueData: edge.ExtraOpaqueData,
} }
chanAnn.NodeSig1, err = lnwire.NewSigFromRawSignature( chanAnn.NodeSig1, err = lnwire.NewSigFromRawSignature(
info.AuthProof.NodeSig1Bytes, info.AuthProof.NodeSig1Bytes,