discovery: skip non-maxHTLC updates in gossip sync
We skip syncing channel updates that don't conform to the spec.
This commit is contained in:
1 file changed
+15
@@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/lightningnetwork/lnd/netann"
|
"github.com/lightningnetwork/lnd/netann"
|
||||||
|
"github.com/lightningnetwork/lnd/routing"
|
||||||
"github.com/lightningnetwork/lnd/routing/route"
|
"github.com/lightningnetwork/lnd/routing/route"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -131,12 +132,26 @@ func (c *ChanSeries) UpdatesInHorizon(chain chainhash.Hash,
|
|||||||
|
|
||||||
updates = append(updates, chanAnn)
|
updates = append(updates, chanAnn)
|
||||||
if edge1 != nil {
|
if edge1 != nil {
|
||||||
|
// We don't want to send channel updates that don't
|
||||||
|
// conform to the spec (anymore).
|
||||||
|
err := routing.ValidateChannelUpdateFields(0, edge1)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("not sending invalid channel "+
|
||||||
|
"update %v: %v", edge1, err)
|
||||||
|
} else {
|
||||||
updates = append(updates, edge1)
|
updates = append(updates, edge1)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if edge2 != nil {
|
if edge2 != nil {
|
||||||
|
err := routing.ValidateChannelUpdateFields(0, edge2)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("not sending invalid channel "+
|
||||||
|
"update %v: %v", edge2, err)
|
||||||
|
} else {
|
||||||
updates = append(updates, edge2)
|
updates = append(updates, edge2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Next, we'll send out all the node announcements that have an update
|
// Next, we'll send out all the node announcements that have an update
|
||||||
// within the horizon as well. We send these second to ensure that they
|
// within the horizon as well. We send these second to ensure that they
|
||||||
|
|||||||
Reference in new issue
Block a user