routing: remove pruneVertexFailure function
This commit is contained in:
parent
aca136a91c
commit
71037969b7
@ -1758,6 +1758,7 @@ func (r *ChannelRouter) sendPayment(payment *LightningPayment,
|
|||||||
}
|
}
|
||||||
|
|
||||||
errSource := fErr.ErrorSource
|
errSource := fErr.ErrorSource
|
||||||
|
errVertex := NewVertex(errSource)
|
||||||
|
|
||||||
log.Tracef("node=%x reported failure when sending "+
|
log.Tracef("node=%x reported failure when sending "+
|
||||||
"htlc=%x", errSource.SerializeCompressed(),
|
"htlc=%x", errSource.SerializeCompressed(),
|
||||||
@ -1806,9 +1807,7 @@ func (r *ChannelRouter) sendPayment(payment *LightningPayment,
|
|||||||
update := onionErr.Update
|
update := onionErr.Update
|
||||||
r.applyChannelUpdate(&update, errSource)
|
r.applyChannelUpdate(&update, errSource)
|
||||||
|
|
||||||
pruneVertexFailure(
|
paySession.ReportVertexFailure(errVertex)
|
||||||
paySession, errSource,
|
|
||||||
)
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
// If we hit an instance of onion payload corruption or
|
// If we hit an instance of onion payload corruption or
|
||||||
@ -1849,9 +1848,7 @@ func (r *ChannelRouter) sendPayment(payment *LightningPayment,
|
|||||||
chanID := update.ShortChannelID
|
chanID := update.ShortChannelID
|
||||||
_, ok := errFailedFeeChans[chanID]
|
_, ok := errFailedFeeChans[chanID]
|
||||||
if ok {
|
if ok {
|
||||||
pruneVertexFailure(
|
paySession.ReportVertexFailure(errVertex)
|
||||||
paySession, errSource,
|
|
||||||
)
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1868,9 +1865,7 @@ func (r *ChannelRouter) sendPayment(payment *LightningPayment,
|
|||||||
update := onionErr.Update
|
update := onionErr.Update
|
||||||
r.applyChannelUpdate(&update, errSource)
|
r.applyChannelUpdate(&update, errSource)
|
||||||
|
|
||||||
pruneVertexFailure(
|
paySession.ReportVertexFailure(errVertex)
|
||||||
paySession, errSource,
|
|
||||||
)
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
// The outgoing channel that this node was meant to
|
// The outgoing channel that this node was meant to
|
||||||
@ -1897,18 +1892,14 @@ func (r *ChannelRouter) sendPayment(payment *LightningPayment,
|
|||||||
// required features, then we'll note this error and
|
// required features, then we'll note this error and
|
||||||
// continue.
|
// continue.
|
||||||
case *lnwire.FailRequiredNodeFeatureMissing:
|
case *lnwire.FailRequiredNodeFeatureMissing:
|
||||||
pruneVertexFailure(
|
paySession.ReportVertexFailure(errVertex)
|
||||||
paySession, errSource,
|
|
||||||
)
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
// If the send fail due to a node not having the
|
// If the send fail due to a node not having the
|
||||||
// required features, then we'll note this error and
|
// required features, then we'll note this error and
|
||||||
// continue.
|
// continue.
|
||||||
case *lnwire.FailRequiredChannelFeatureMissing:
|
case *lnwire.FailRequiredChannelFeatureMissing:
|
||||||
pruneVertexFailure(
|
paySession.ReportVertexFailure(errVertex)
|
||||||
paySession, errSource,
|
|
||||||
)
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
// If the next hop in the route wasn't known or
|
// If the next hop in the route wasn't known or
|
||||||
@ -1926,15 +1917,11 @@ func (r *ChannelRouter) sendPayment(payment *LightningPayment,
|
|||||||
// reason, then we'll note this and continue with the
|
// reason, then we'll note this and continue with the
|
||||||
// routes.
|
// routes.
|
||||||
case *lnwire.FailTemporaryNodeFailure:
|
case *lnwire.FailTemporaryNodeFailure:
|
||||||
pruneVertexFailure(
|
paySession.ReportVertexFailure(errVertex)
|
||||||
paySession, errSource,
|
|
||||||
)
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
case *lnwire.FailPermanentNodeFailure:
|
case *lnwire.FailPermanentNodeFailure:
|
||||||
pruneVertexFailure(
|
paySession.ReportVertexFailure(errVertex)
|
||||||
paySession, errSource,
|
|
||||||
)
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
// If we crafted a route that contains a too long time
|
// If we crafted a route that contains a too long time
|
||||||
@ -1947,9 +1934,7 @@ func (r *ChannelRouter) sendPayment(payment *LightningPayment,
|
|||||||
// that as a hint during future path finding through
|
// that as a hint during future path finding through
|
||||||
// that node.
|
// that node.
|
||||||
case *lnwire.FailExpiryTooFar:
|
case *lnwire.FailExpiryTooFar:
|
||||||
pruneVertexFailure(
|
paySession.ReportVertexFailure(errVertex)
|
||||||
paySession, errSource,
|
|
||||||
)
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
// If we get a permanent channel or node failure, then
|
// If we get a permanent channel or node failure, then
|
||||||
@ -1968,19 +1953,6 @@ func (r *ChannelRouter) sendPayment(payment *LightningPayment,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pruneVertexFailure will attempt to prune a vertex from the current available
|
|
||||||
// vertexes of the target payment session in response to an encountered routing
|
|
||||||
// error.
|
|
||||||
func pruneVertexFailure(paySession *paymentSession, errSource *btcec.PublicKey) {
|
|
||||||
// By default, we'll try to prune the node that actually sent us the
|
|
||||||
// error.
|
|
||||||
errNode := NewVertex(errSource)
|
|
||||||
|
|
||||||
// Once we've located the vertex, we'll report this failure to
|
|
||||||
// missionControl and restart path finding.
|
|
||||||
paySession.ReportVertexFailure(errNode)
|
|
||||||
}
|
|
||||||
|
|
||||||
// pruneEdgeFailure will attempts to prune an edge from the current available
|
// pruneEdgeFailure will attempts to prune an edge from the current available
|
||||||
// edges of the target payment session in response to an encountered routing
|
// edges of the target payment session in response to an encountered routing
|
||||||
// error.
|
// error.
|
||||||
|
Loading…
Reference in New Issue
Block a user