mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-10 14:17:56 +01:00
discovery: use correct channel ID for MarkEdgeLive
In processZombieUpdate, the SCID passed to MarkEdgeLive should _not_ be derived from the ChannelEdgeInfo ChannelID field since this field will not be populated when GetChannelByID returns a ChannelEdgeInfo along with an ErrZombieEdge error. So this commit ensures that a usable SCID is provided to processZombieUpdate.
This commit is contained in:
@@ -2022,8 +2022,12 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(
|
|||||||
|
|
||||||
// processZombieUpdate determines whether the provided channel update should
|
// processZombieUpdate determines whether the provided channel update should
|
||||||
// resurrect a given zombie edge.
|
// resurrect a given zombie edge.
|
||||||
|
//
|
||||||
|
// NOTE: only the NodeKey1Bytes and NodeKey2Bytes members of the ChannelEdgeInfo
|
||||||
|
// should be inspected.
|
||||||
func (d *AuthenticatedGossiper) processZombieUpdate(
|
func (d *AuthenticatedGossiper) processZombieUpdate(
|
||||||
chanInfo *models.ChannelEdgeInfo, msg *lnwire.ChannelUpdate) error {
|
chanInfo *models.ChannelEdgeInfo, scid lnwire.ShortChannelID,
|
||||||
|
msg *lnwire.ChannelUpdate) error {
|
||||||
|
|
||||||
// The least-significant bit in the flag on the channel update tells us
|
// The least-significant bit in the flag on the channel update tells us
|
||||||
// which edge is being updated.
|
// which edge is being updated.
|
||||||
@@ -2031,7 +2035,7 @@ func (d *AuthenticatedGossiper) processZombieUpdate(
|
|||||||
|
|
||||||
// Since we've deemed the update as not stale above, before marking it
|
// Since we've deemed the update as not stale above, before marking it
|
||||||
// live, we'll make sure it has been signed by the correct party. If we
|
// live, we'll make sure it has been signed by the correct party. If we
|
||||||
// have both pubkeys, either party can resurect the channel. If we've
|
// have both pubkeys, either party can resurrect the channel. If we've
|
||||||
// already marked this with the stricter, single-sided resurrection we
|
// already marked this with the stricter, single-sided resurrection we
|
||||||
// will only have the pubkey of the node with the oldest timestamp.
|
// will only have the pubkey of the node with the oldest timestamp.
|
||||||
var pubKey *btcec.PublicKey
|
var pubKey *btcec.PublicKey
|
||||||
@@ -2055,8 +2059,7 @@ func (d *AuthenticatedGossiper) processZombieUpdate(
|
|||||||
// With the signature valid, we'll proceed to mark the
|
// With the signature valid, we'll proceed to mark the
|
||||||
// edge as live and wait for the channel announcement to
|
// edge as live and wait for the channel announcement to
|
||||||
// come through again.
|
// come through again.
|
||||||
baseScid := lnwire.NewShortChanIDFromInt(chanInfo.ChannelID)
|
err = d.cfg.Router.MarkEdgeLive(scid)
|
||||||
err = d.cfg.Router.MarkEdgeLive(baseScid)
|
|
||||||
switch {
|
switch {
|
||||||
case errors.Is(err, channeldb.ErrZombieEdgeNotFound):
|
case errors.Is(err, channeldb.ErrZombieEdgeNotFound):
|
||||||
log.Errorf("edge with chan_id=%v was not found in the "+
|
log.Errorf("edge with chan_id=%v was not found in the "+
|
||||||
@@ -2740,7 +2743,7 @@ func (d *AuthenticatedGossiper) handleChanUpdate(nMsg *networkMsg,
|
|||||||
break
|
break
|
||||||
|
|
||||||
case channeldb.ErrZombieEdge:
|
case channeldb.ErrZombieEdge:
|
||||||
err = d.processZombieUpdate(chanInfo, upd)
|
err = d.processZombieUpdate(chanInfo, graphScid, upd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debug(err)
|
log.Debug(err)
|
||||||
nMsg.err <- err
|
nMsg.err <- err
|
||||||
|
|||||||
Reference in New Issue
Block a user