mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-18 21:35:24 +01:00
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:
parent
6aac2762b3
commit
6459385dfd
@ -7,6 +7,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/netann"
|
||||
"github.com/lightningnetwork/lnd/routing"
|
||||
"github.com/lightningnetwork/lnd/routing/route"
|
||||
)
|
||||
|
||||
@ -131,10 +132,24 @@ func (c *ChanSeries) UpdatesInHorizon(chain chainhash.Hash,
|
||||
|
||||
updates = append(updates, chanAnn)
|
||||
if edge1 != nil {
|
||||
updates = append(updates, edge1)
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
if edge2 != nil {
|
||||
updates = append(updates, edge2)
|
||||
err := routing.ValidateChannelUpdateFields(0, edge2)
|
||||
if err != nil {
|
||||
log.Errorf("not sending invalid channel "+
|
||||
"update %v: %v", edge2, err)
|
||||
} else {
|
||||
updates = append(updates, edge2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user