routing+channeldb: add more failure reasons

This commit is contained in:
Joost Jager 2019-06-04 11:22:23 +02:00
parent d6d87e12fe
commit ae46fb00cb
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7
7 changed files with 241 additions and 167 deletions

@ -94,10 +94,17 @@ const (
// destination was found during path finding.
FailureReasonNoRoute FailureReason = 1
// FailureReasonError indicates that an unexpected error happened during
// payment.
FailureReasonError FailureReason = 2
// FailureReasonIncorrectPaymentDetails indicates that either the hash
// is unknown or the final cltv delta or amount is incorrect.
FailureReasonIncorrectPaymentDetails FailureReason = 3
// TODO(halseth): cancel state.
// TODO(joostjager): Add failure reasons for:
// UnknownPaymentHash, FinalInvalidAmt, FinalInvalidCltv
// LocalLiquidityInsufficient, RemoteCapacityInsufficient.
)
@ -108,6 +115,10 @@ func (r FailureReason) String() string {
return "timeout"
case FailureReasonNoRoute:
return "no_route"
case FailureReasonError:
return "error"
case FailureReasonIncorrectPaymentDetails:
return "incorrect_payment_details"
}
return "unknown"

@ -39,6 +39,13 @@ const (
//All possible routes were tried and failed permanently. Or were no
//routes to the destination at all.
PaymentState_FAILED_NO_ROUTE PaymentState = 3
//*
//A non-recoverable error has occured.
PaymentState_FAILED_ERROR PaymentState = 4
//*
//Payment details incorrect (unknown hash, invalid amt or
//invalid final cltv delta)
PaymentState_FAILED_INCORRECT_PAYMENT_DETAILS PaymentState = 5
)
var PaymentState_name = map[int32]string{
@ -46,13 +53,17 @@ var PaymentState_name = map[int32]string{
1: "SUCCEEDED",
2: "FAILED_TIMEOUT",
3: "FAILED_NO_ROUTE",
4: "FAILED_ERROR",
5: "FAILED_INCORRECT_PAYMENT_DETAILS",
}
var PaymentState_value = map[string]int32{
"IN_FLIGHT": 0,
"SUCCEEDED": 1,
"FAILED_TIMEOUT": 2,
"FAILED_NO_ROUTE": 3,
"IN_FLIGHT": 0,
"SUCCEEDED": 1,
"FAILED_TIMEOUT": 2,
"FAILED_NO_ROUTE": 3,
"FAILED_ERROR": 4,
"FAILED_INCORRECT_PAYMENT_DETAILS": 5,
}
func (x PaymentState) String() string {
@ -1146,106 +1157,108 @@ func init() {
func init() { proto.RegisterFile("routerrpc/router.proto", fileDescriptor_7a0613f69d37b0a5) }
var fileDescriptor_7a0613f69d37b0a5 = []byte{
// 1575 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0xdd, 0x72, 0x22, 0xc7,
0x15, 0x36, 0x02, 0x09, 0x71, 0xf8, 0xd1, 0xa8, 0xa5, 0xd5, 0xb2, 0x68, 0xb5, 0x96, 0x27, 0xc9,
0x5a, 0xb5, 0xe5, 0x48, 0x09, 0xa9, 0x75, 0xf9, 0x2a, 0x29, 0x16, 0x1a, 0x33, 0x59, 0x98, 0x91,
0x1b, 0x58, 0x5b, 0xc9, 0x45, 0x57, 0x0b, 0x5a, 0x30, 0x25, 0x98, 0xc1, 0xd3, 0x8d, 0xb3, 0xca,
0x45, 0xee, 0x92, 0xd7, 0x49, 0x9e, 0x20, 0x97, 0x79, 0x87, 0xbc, 0x4d, 0xaa, 0xbb, 0x07, 0x18,
0x10, 0xda, 0xf8, 0x4a, 0xcc, 0x77, 0xbe, 0x3e, 0xe7, 0xf4, 0xf9, 0xeb, 0x23, 0x38, 0x89, 0xc2,
0xb9, 0xe4, 0x51, 0x34, 0x1b, 0x5c, 0x99, 0x5f, 0x97, 0xb3, 0x28, 0x94, 0x21, 0xca, 0x2d, 0xf1,
0x4a, 0x2e, 0x9a, 0x0d, 0x0c, 0x6a, 0xff, 0x67, 0x07, 0x50, 0x97, 0x07, 0xc3, 0x6b, 0xf6, 0x30,
0xe5, 0x81, 0x24, 0xfc, 0xc7, 0x39, 0x17, 0x12, 0x21, 0xc8, 0x0c, 0xb9, 0x90, 0xe5, 0xd4, 0x79,
0xea, 0xa2, 0x40, 0xf4, 0x6f, 0x64, 0x41, 0x9a, 0x4d, 0x65, 0x79, 0xe7, 0x3c, 0x75, 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7, 0x7b, 0xb0, 0xb0, 0x90, 0xfe, 0x54, 0x3d, 0xda, 0xf1,
0xea, 0x85, 0x2a, 0x09, 0xfe, 0xc6, 0x3e, 0x57, 0x39, 0xdd, 0x2a, 0x8b, 0xcb, 0xbc, 0x6d, 0xae,
0x18, 0x2f, 0x3f, 0x8f, 0xae, 0xb8, 0xbe, 0x71, 0x55, 0x5e, 0x3d, 0x25, 0x8e, 0xb5, 0x0d, 0xe1,
0x68, 0x4b, 0x43, 0xa2, 0x5f, 0x25, 0x3d, 0x78, 0xb2, 0x9d, 0x2b, 0xaf, 0xff, 0x1f, 0x6d, 0x65,
0x65, 0x4b, 0xe7, 0xae, 0x59, 0x79, 0xba, 0xef, 0xd7, 0xac, 0x7c, 0x62, 0x00, 0xbc, 0xfb, 0xed,
0x9f, 0xae, 0x46, 0xbe, 0x1c, 0xcf, 0x6f, 0x2f, 0x07, 0xe1, 0xf4, 0x6a, 0xe2, 0x8f, 0xc6, 0x32,
0xf0, 0x83, 0x51, 0xc0, 0xe5, 0x5f, 0xc2, 0xe8, 0xfe, 0x6a, 0x12, 0x0c, 0xaf, 0xf4, 0x32, 0x79,
0xb5, 0x54, 0x77, 0xbb, 0xa7, 0xff, 0xad, 0xfa, 0xdd, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9a,
0xf3, 0x15, 0x70, 0x86, 0x0d, 0x00, 0x00,
// 1601 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0xdd, 0x72, 0x1a, 0xc9,
0x15, 0x5e, 0x04, 0x08, 0x71, 0xf8, 0x1b, 0xb5, 0x64, 0x19, 0x23, 0xcb, 0xab, 0x9d, 0x24, 0x5e,
0x95, 0x6b, 0x23, 0x25, 0xa4, 0xbc, 0xb5, 0x57, 0x49, 0x61, 0x68, 0x96, 0x89, 0x61, 0x46, 0xdb,
0x80, 0x77, 0x9d, 0x5c, 0x74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0xe0, 0xd1, 0x39, 0x50, 0x7b, 0xf9, 0x73, 0xb4, 0xb5, 0x95, 0x1d, 0x2d, 0xbf, 0x61, 0xe5,
0xf1, 0x81, 0xb1, 0x61, 0xe5, 0x23, 0x93, 0xe3, 0xcd, 0x6f, 0xff, 0x74, 0x35, 0x71, 0xc5, 0x74,
0x71, 0x73, 0x39, 0x0a, 0x66, 0x57, 0x9e, 0x3b, 0x99, 0x0a, 0xdf, 0xf5, 0x27, 0x3e, 0x17, 0x7f,
0x09, 0xc2, 0xbb, 0x2b, 0xcf, 0x1f, 0x5f, 0xa9, 0x2d, 0xf4, 0x6a, 0xa5, 0xee, 0x66, 0x5f, 0xfd,
0x3f, 0xf6, 0xbb, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0xd2, 0x24, 0x56, 0xf2, 0xbf, 0x0d, 0x00,
0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

@ -86,6 +86,17 @@ enum PaymentState {
routes to the destination at all.
*/
FAILED_NO_ROUTE = 3;
/**
A non-recoverable error has occured.
*/
FAILED_ERROR = 4;
/**
Payment details incorrect (unknown hash, invalid amt or
invalid final cltv delta)
*/
FAILED_INCORRECT_PAYMENT_DETAILS = 5;
}

@ -539,17 +539,13 @@ func (s *Server) trackPayment(paymentHash lntypes.Hash,
result.Route,
)
} else {
switch result.FailureReason {
case channeldb.FailureReasonTimeout:
status.State = PaymentState_FAILED_TIMEOUT
case channeldb.FailureReasonNoRoute:
status.State = PaymentState_FAILED_NO_ROUTE
default:
return errors.New("unknown failure reason")
state, err := marshallFailureReason(
result.FailureReason,
)
if err != nil {
return err
}
status.State = state
}
// Send event to the client.
@ -565,3 +561,26 @@ func (s *Server) trackPayment(paymentHash lntypes.Hash,
return nil
}
// marshallFailureReason marshalls the failure reason to the corresponding rpc
// type.
func marshallFailureReason(reason channeldb.FailureReason) (
PaymentState, error) {
switch reason {
case channeldb.FailureReasonTimeout:
return PaymentState_FAILED_TIMEOUT, nil
case channeldb.FailureReasonNoRoute:
return PaymentState_FAILED_NO_ROUTE, nil
case channeldb.FailureReasonError:
return PaymentState_FAILED_ERROR, nil
case channeldb.FailureReasonIncorrectPaymentDetails:
return PaymentState_FAILED_INCORRECT_PAYMENT_DETAILS, nil
}
return 0, errors.New("unknown failure reason")
}

@ -13803,7 +13803,7 @@ func testHoldInvoicePersistence(net *lntest.NetworkHarness, t *harnessTest) {
status.State)
}
} else {
if status.State != routerrpc.PaymentState_FAILED_NO_ROUTE {
if status.State != routerrpc.PaymentState_FAILED_INCORRECT_PAYMENT_DETAILS {
t.Fatalf("state not failed: %v",
status.State)
}

@ -338,39 +338,41 @@ func (p *paymentLifecycle) sendPaymentAttempt(firstHop lnwire.ShortChannelID,
// handleSendError inspects the given error from the Switch and determines
// whether we should make another payment attempt.
func (p *paymentLifecycle) handleSendError(sendErr error) error {
var finalOutcome bool
var reason channeldb.FailureReason
// If an internal, non-forwarding error occurred, we can stop trying.
fErr, ok := sendErr.(*htlcswitch.ForwardingError)
if !ok {
finalOutcome = true
reason = channeldb.FailureReasonError
} else {
finalOutcome = p.router.processSendError(
var final bool
final, reason = p.router.processSendError(
p.paySession, &p.attempt.Route, fErr,
)
// Save the forwarding error so it can be returned if this turns
// out to be the last attempt.
p.lastError = fErr
}
if !final {
// Save the forwarding error so it can be returned if
// this turns out to be the last attempt.
p.lastError = fErr
if finalOutcome {
log.Errorf("Payment %x failed with final outcome: %v",
p.payment.PaymentHash, sendErr)
// Mark the payment failed with no route.
// TODO(halseth): make payment codes for the actual reason we
// don't continue path finding.
err := p.router.cfg.Control.Fail(
p.payment.PaymentHash, channeldb.FailureReasonNoRoute,
)
if err != nil {
return err
return nil
}
// Terminal state, return the error we encountered.
return sendErr
}
return nil
log.Debugf("Payment %x failed: final_outcome=%v, raw_err=%v",
p.payment.PaymentHash, reason, sendErr)
// Mark the payment failed with no route.
//
// TODO(halseth): make payment codes for the actual reason we don't
// continue path finding.
err := p.router.cfg.Control.Fail(
p.payment.PaymentHash, reason,
)
if err != nil {
return err
}
// Terminal state, return the error we encountered.
return sendErr
}

@ -1805,7 +1805,8 @@ func (r *ChannelRouter) sendPayment(
// to continue with an alternative route. This is indicated by the boolean
// return value.
func (r *ChannelRouter) processSendError(paySession PaymentSession,
rt *route.Route, fErr *htlcswitch.ForwardingError) bool {
rt *route.Route, fErr *htlcswitch.ForwardingError) (
bool, channeldb.FailureReason) {
errSource := fErr.ErrorSource
errVertex := route.NewVertex(errSource)
@ -1818,7 +1819,7 @@ func (r *ChannelRouter) processSendError(paySession PaymentSession,
rt, route.Vertex(errVertex),
)
if err != nil {
return true
return true, channeldb.FailureReasonError
}
// processChannelUpdateAndRetry is a closure that
@ -1861,22 +1862,33 @@ func (r *ChannelRouter) processSendError(paySession PaymentSession,
// hash or we sent the wrong payment amount to the
// destination, then we'll terminate immediately.
case *lnwire.FailUnknownPaymentHash:
return true
// TODO(joostjager): Check onionErr.Amount() whether it matches
// what we expect. (Will it ever not match, because if not
// final_incorrect_htlc_amount would be returned?)
return true, channeldb.FailureReasonIncorrectPaymentDetails
// If we sent the wrong amount to the destination, then
// we'll exit early.
case *lnwire.FailIncorrectPaymentAmount:
return true
return true, channeldb.FailureReasonIncorrectPaymentDetails
// If the time-lock that was extended to the final node
// was incorrect, then we can't proceed.
case *lnwire.FailFinalIncorrectCltvExpiry:
return true
// TODO(joostjager): Take into account that second last hop may
// have deliberately handed out an htlc that expires too soon.
// In that case we should continue routing.
return true, channeldb.FailureReasonError
// If we crafted an invalid onion payload for the final
// node, then we'll exit early.
case *lnwire.FailFinalIncorrectHtlcAmount:
return true
// TODO(joostjager): Take into account that second last hop may
// have deliberately handed out an htlc with a too low value. In
// that case we should continue routing.
return true, channeldb.FailureReasonError
// Similarly, if the HTLC expiry that we extended to
// the final hop expires too soon, then will fail the
@ -1885,12 +1897,15 @@ func (r *ChannelRouter) processSendError(paySession PaymentSession,
// TODO(roasbeef): can happen to to race condition, try
// again with recent block height
case *lnwire.FailFinalExpiryTooSoon:
return true
// TODO(joostjager): Take into account that any hop may have
// delayed. Ideally we should continue routing. Knowing the
// delaying node at this point would help.
return true, channeldb.FailureReasonIncorrectPaymentDetails
// If we erroneously attempted to cross a chain border,
// then we'll cancel the payment.
case *lnwire.FailInvalidRealm:
return true
return true, channeldb.FailureReasonError
// If we get a notice that the expiry was too soon for
// an intermediate node, then we'll prune out the node
@ -1899,17 +1914,20 @@ func (r *ChannelRouter) processSendError(paySession PaymentSession,
case *lnwire.FailExpiryTooSoon:
r.applyChannelUpdate(&onionErr.Update, errSource)
paySession.ReportVertexFailure(errVertex)
return false
return false, 0
// If we hit an instance of onion payload corruption or
// an invalid version, then we'll exit early as this
// shouldn't happen in the typical case.
// If we hit an instance of onion payload corruption or an invalid
// version, then we'll exit early as this shouldn't happen in the
// typical case.
//
// TODO(joostjager): Take into account that the previous hop may have
// tampered with the onion. Routing should continue using other paths.
case *lnwire.FailInvalidOnionVersion:
return true
return true, channeldb.FailureReasonError
case *lnwire.FailInvalidOnionHmac:
return true
return true, channeldb.FailureReasonError
case *lnwire.FailInvalidOnionKey:
return true
return true, channeldb.FailureReasonError
// If we get a failure due to violating the minimum
// amount, we'll apply the new minimum amount and retry
@ -1918,7 +1936,7 @@ func (r *ChannelRouter) processSendError(paySession PaymentSession,
processChannelUpdateAndRetry(
&onionErr.Update, errSource,
)
return false
return false, 0
// If we get a failure due to a fee, we'll apply the
// new fee update, and retry our attempt using the
@ -1927,7 +1945,7 @@ func (r *ChannelRouter) processSendError(paySession PaymentSession,
processChannelUpdateAndRetry(
&onionErr.Update, errSource,
)
return false
return false, 0
// If we get the failure for an intermediate node that
// disagrees with our time lock values, then we'll
@ -1936,7 +1954,7 @@ func (r *ChannelRouter) processSendError(paySession PaymentSession,
processChannelUpdateAndRetry(
&onionErr.Update, errSource,
)
return false
return false, 0
// The outgoing channel that this node was meant to
// forward one is currently disabled, so we'll apply
@ -1944,7 +1962,7 @@ func (r *ChannelRouter) processSendError(paySession PaymentSession,
case *lnwire.FailChannelDisabled:
r.applyChannelUpdate(&onionErr.Update, errSource)
paySession.ReportEdgeFailure(failedEdge, 0)
return false
return false, 0
// It's likely that the outgoing channel didn't have
// sufficient capacity, so we'll prune this edge for
@ -1952,21 +1970,21 @@ func (r *ChannelRouter) processSendError(paySession PaymentSession,
case *lnwire.FailTemporaryChannelFailure:
r.applyChannelUpdate(onionErr.Update, errSource)
paySession.ReportEdgeFailure(failedEdge, failedAmt)
return false
return false, 0
// If the send fail due to a node not having the
// required features, then we'll note this error and
// continue.
case *lnwire.FailRequiredNodeFeatureMissing:
paySession.ReportVertexFailure(errVertex)
return false
return false, 0
// If the send fail due to a node not having the
// required features, then we'll note this error and
// continue.
case *lnwire.FailRequiredChannelFeatureMissing:
paySession.ReportVertexFailure(errVertex)
return false
return false, 0
// If the next hop in the route wasn't known or
// offline, we'll only the channel which we attempted
@ -1977,18 +1995,18 @@ func (r *ChannelRouter) processSendError(paySession PaymentSession,
// another node.
case *lnwire.FailUnknownNextPeer:
paySession.ReportEdgeFailure(failedEdge, 0)
return false
return false, 0
// If the node wasn't able to forward for which ever
// reason, then we'll note this and continue with the
// routes.
case *lnwire.FailTemporaryNodeFailure:
paySession.ReportVertexFailure(errVertex)
return false
return false, 0
case *lnwire.FailPermanentNodeFailure:
paySession.ReportVertexFailure(errVertex)
return false
return false, 0
// If we crafted a route that contains a too long time
// lock for an intermediate node, we'll prune the node.
@ -2001,7 +2019,7 @@ func (r *ChannelRouter) processSendError(paySession PaymentSession,
// that node.
case *lnwire.FailExpiryTooFar:
paySession.ReportVertexFailure(errVertex)
return false
return false, 0
// If we get a permanent channel or node failure, then
// we'll prune the channel in both directions and
@ -2013,10 +2031,10 @@ func (r *ChannelRouter) processSendError(paySession PaymentSession,
to: failedEdge.from,
channel: failedEdge.channel,
}, 0)
return false
return false, 0
default:
return true
return true, channeldb.FailureReasonError
}
}