lnrpc: add failure detail none to link event rpc

This commit is contained in:
carla 2020-05-04 09:33:25 +02:00
parent 2c979fc179
commit e229717025
No known key found for this signature in database
GPG Key ID: 4CA7FE54A6213C91

@ -120,15 +120,21 @@ func rpcFailReason(linkErr *htlcswitch.LinkError) (lnrpc.Failure_FailureCode,
if err != nil { if err != nil {
return 0, 0, err return 0, 0, err
} }
wireCode := wireErr.GetCode()
// If the link has no failure detail, return with failure detail none.
if linkErr.FailureDetail == nil {
return wireCode, FailureDetail_NO_DETAIL, nil
}
switch failureDetail := linkErr.FailureDetail.(type) { switch failureDetail := linkErr.FailureDetail.(type) {
case invoices.FailResolutionResult: case invoices.FailResolutionResult:
fd, err := rpcFailureResolution(failureDetail) fd, err := rpcFailureResolution(failureDetail)
return wireErr.GetCode(), fd, err return wireCode, fd, err
case htlcswitch.OutgoingFailure: case htlcswitch.OutgoingFailure:
fd, err := rpcOutgoingFailure(failureDetail) fd, err := rpcOutgoingFailure(failureDetail)
return wireErr.GetCode(), fd, err return wireCode, fd, err
default: default:
return 0, 0, fmt.Errorf("unknown failure "+ return 0, 0, fmt.Errorf("unknown failure "+