discovery: set proper flag within createChanAnnouncement

In this commit, we fix an existing bug within the
createChanAnnouncement function. Before we would set the flag to be 0,
or 1 depending on which edge it was. This was incorrect as since then
additional flags have been defined. We now properly set the entire
flag, rather than taking a shortcut. With this, we’ll properly
advertise all ChannelUpdate announcements.
This commit is contained in:
Olaoluwa Osuntokun 2017-11-30 22:32:53 -08:00
parent a78ff8ba04
commit 3e3de26ac9
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -41,8 +41,8 @@ func createChanAnnouncement(chanProof *channeldb.ChannelAuthProof,
// networkMsgs.
// Since it's up to a node's policy as to whether they advertise the
// edge in dire direction, we don't create an advertisement if the edge
// is nil.
// edge in a direction, we don't create an advertisement if the edge is
// nil.
var edge1Ann, edge2Ann *lnwire.ChannelUpdate
if e1 != nil {
edge1Ann = &lnwire.ChannelUpdate{
@ -50,7 +50,7 @@ func createChanAnnouncement(chanProof *channeldb.ChannelAuthProof,
ChainHash: chanInfo.ChainHash,
ShortChannelID: chanID,
Timestamp: uint32(e1.LastUpdate.Unix()),
Flags: 0,
Flags: e1.Flags,
TimeLockDelta: e1.TimeLockDelta,
HtlcMinimumMsat: e1.MinHTLC,
BaseFee: uint32(e1.FeeBaseMSat),
@ -63,7 +63,7 @@ func createChanAnnouncement(chanProof *channeldb.ChannelAuthProof,
ChainHash: chanInfo.ChainHash,
ShortChannelID: chanID,
Timestamp: uint32(e2.LastUpdate.Unix()),
Flags: 1,
Flags: e2.Flags,
TimeLockDelta: e2.TimeLockDelta,
HtlcMinimumMsat: e2.MinHTLC,
BaseFee: uint32(e2.FeeBaseMSat),