routing+routerrpc: notify full payment structures

This commit fixes the inconsistency between the payment state as
reported by routerrpc.SendPayment/routerrpc.TrackPayment and the main
rpc ListPayments call.

In addition to that, payment state changes are now sent out for every
state change. This opens the door to user interfaces giving more
feedback to the user about the payment process. This is especially
interesting for multi-part payments.
This commit is contained in:
Joost Jager
2020-04-03 17:05:05 +02:00
parent 5bebda8c5d
commit af4abe7d58
8 changed files with 392 additions and 617 deletions

View File

@@ -393,14 +393,14 @@ func sendPaymentRequest(ctx *cli.Context,
return err
}
if status.State != routerrpc.PaymentState_IN_FLIGHT {
if status.Status != lnrpc.Payment_IN_FLIGHT {
printRespJSON(status)
// If we get a payment error back, we pass an error up
// to main which eventually calls fatal() and returns
// with a non-zero exit code.
if status.State != routerrpc.PaymentState_SUCCEEDED {
return errors.New(status.State.String())
if status.Status != lnrpc.Payment_SUCCEEDED {
return errors.New(status.Status.String())
}
return nil
@@ -454,7 +454,7 @@ func trackPayment(ctx *cli.Context) error {
printRespJSON(status)
if status.State != routerrpc.PaymentState_IN_FLIGHT {
if status.Status != lnrpc.Payment_IN_FLIGHT {
return nil
}
}