mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
lndclient: expose failure reason
This commit is contained in:
parent
b054e84eb2
commit
c061206406
1 changed files with 11 additions and 2 deletions
|
|
@ -34,7 +34,12 @@ type RouterClient interface {
|
|||
|
||||
// PaymentStatus describe the state of a payment.
|
||||
type PaymentStatus struct {
|
||||
State lnrpc.Payment_PaymentStatus
|
||||
State lnrpc.Payment_PaymentStatus
|
||||
|
||||
// FailureReason is the reason why the payment failed. Only set when
|
||||
// State is Failed.
|
||||
FailureReason lnrpc.PaymentFailureReason
|
||||
|
||||
Preimage lntypes.Preimage
|
||||
Fee lnwire.MilliSatoshi
|
||||
Value lnwire.MilliSatoshi
|
||||
|
|
@ -232,7 +237,8 @@ func unmarshallPaymentStatus(rpcPayment *lnrpc.Payment) (
|
|||
State: rpcPayment.Status,
|
||||
}
|
||||
|
||||
if status.State == lnrpc.Payment_SUCCEEDED {
|
||||
switch status.State {
|
||||
case lnrpc.Payment_SUCCEEDED:
|
||||
preimage, err := lntypes.MakePreimageFromStr(
|
||||
rpcPayment.PaymentPreimage,
|
||||
)
|
||||
|
|
@ -242,6 +248,9 @@ func unmarshallPaymentStatus(rpcPayment *lnrpc.Payment) (
|
|||
status.Preimage = preimage
|
||||
status.Fee = lnwire.MilliSatoshi(rpcPayment.FeeMsat)
|
||||
status.Value = lnwire.MilliSatoshi(rpcPayment.ValueMsat)
|
||||
|
||||
case lnrpc.Payment_FAILED:
|
||||
status.FailureReason = rpcPayment.FailureReason
|
||||
}
|
||||
|
||||
for _, htlc := range rpcPayment.Htlcs {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue