routing: don't prune our own channels during zombie channel collection
This commit is a precautionary commit which ensure that we don’t attempt to prune our _own_ channels during zombie channel collection.
This commit is contained in:
parent
9b0b945a3d
commit
b29a73a0dd
@ -81,8 +81,9 @@ type FeeSchema struct {
|
|||||||
|
|
||||||
// FeeRate is the rate that will be charged for forwarding payments.
|
// FeeRate is the rate that will be charged for forwarding payments.
|
||||||
// This value should be interpreted as the numerator for a fraction
|
// This value should be interpreted as the numerator for a fraction
|
||||||
// whose denominator is 1 million. As a result the effective fee rate
|
// (fixed point arithmetic) whose denominator is 1 million. As a result
|
||||||
// charged per mSAT will be: (amount * FeeRate/1,000,000)
|
// the effective fee rate charged per mSAT will be: (amount *
|
||||||
|
// FeeRate/1,000,000).
|
||||||
FeeRate uint32
|
FeeRate uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,9 +147,9 @@ func newRouteTuple(amt lnwire.MilliSatoshi, dest []byte) routeTuple {
|
|||||||
// ChannelRouter is the HtlcSwitch, and below that is the Bitcoin blockchain
|
// ChannelRouter is the HtlcSwitch, and below that is the Bitcoin blockchain
|
||||||
// itself. The primary role of the ChannelRouter is to respond to queries for
|
// itself. The primary role of the ChannelRouter is to respond to queries for
|
||||||
// potential routes that can support a payment amount, and also general graph
|
// potential routes that can support a payment amount, and also general graph
|
||||||
// reachability questions. The router will prune the channel graph automatically
|
// reachability questions. The router will prune the channel graph
|
||||||
// as new blocks are discovered which spend certain known funding outpoints,
|
// automatically as new blocks are discovered which spend certain known funding
|
||||||
// thereby closing their respective channels.
|
// outpoints, thereby closing their respective channels.
|
||||||
type ChannelRouter struct {
|
type ChannelRouter struct {
|
||||||
ntfnClientCounter uint64
|
ntfnClientCounter uint64
|
||||||
|
|
||||||
@ -405,16 +406,15 @@ func (r *ChannelRouter) networkHandler() {
|
|||||||
case updateMsg := <-r.networkUpdates:
|
case updateMsg := <-r.networkUpdates:
|
||||||
// Process the routing update to determine if this is
|
// Process the routing update to determine if this is
|
||||||
// either a new update from our PoV or an update to a
|
// either a new update from our PoV or an update to a
|
||||||
// prior vertex/edge we previously
|
// prior vertex/edge we previously accepted.
|
||||||
// accepted.
|
|
||||||
err := r.processUpdate(updateMsg.msg)
|
err := r.processUpdate(updateMsg.msg)
|
||||||
updateMsg.err <- err
|
updateMsg.err <- err
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send off a new notification for the newly
|
// Send off a new notification for the newly accepted
|
||||||
// accepted update.
|
// update.
|
||||||
topChange := &TopologyChange{}
|
topChange := &TopologyChange{}
|
||||||
err = addToTopologyChange(r.cfg.Graph, topChange,
|
err = addToTopologyChange(r.cfg.Graph, topChange,
|
||||||
updateMsg.msg)
|
updateMsg.msg)
|
||||||
@ -537,6 +537,16 @@ func (r *ChannelRouter) networkHandler() {
|
|||||||
filterPruneChans := func(info *channeldb.ChannelEdgeInfo,
|
filterPruneChans := func(info *channeldb.ChannelEdgeInfo,
|
||||||
e1, e2 *channeldb.ChannelEdgePolicy) error {
|
e1, e2 *channeldb.ChannelEdgePolicy) error {
|
||||||
|
|
||||||
|
// We'll ensure that we don't attempt to prune
|
||||||
|
// our *own* channels from the graph, as in any
|
||||||
|
// case this shuold be re-advertised by the
|
||||||
|
// sub-system above us.
|
||||||
|
if info.NodeKey1.IsEqual(r.selfNode.PubKey) ||
|
||||||
|
info.NodeKey2.IsEqual(r.selfNode.PubKey) {
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// If *both* edges haven't been updated for a
|
// If *both* edges haven't been updated for a
|
||||||
// period of chanExpiry, then we'll mark the
|
// period of chanExpiry, then we'll mark the
|
||||||
// channel itself as eligible for graph
|
// channel itself as eligible for graph
|
||||||
|
Loading…
Reference in New Issue
Block a user