File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -837,21 +837,29 @@ func (n *namespacedDB) purge() error {
837
837
func newPaymentFailure (sourceIdx * int ,
838
838
failureMsg lnwire.FailureMessage ) paymentFailure {
839
839
840
+ // If we can't identify a failure source, we also won't have a decrypted
841
+ // failure message. In this case we return an empty payment failure.
840
842
if sourceIdx == nil {
841
843
return paymentFailure {}
842
844
}
843
845
844
- return paymentFailure {
846
+ info := paymentFailure {
845
847
sourceIdx : tlv .SomeRecordT (
846
848
tlv.NewPrimitiveRecord [tlv.TlvType0 ](
847
849
uint8 (* sourceIdx ),
848
- )),
849
- msg : tlv .SomeRecordT (
850
+ ),
851
+ ),
852
+ }
853
+
854
+ if failureMsg != nil {
855
+ info .msg = tlv .SomeRecordT (
850
856
tlv.NewRecordT [tlv.TlvType1 ](
851
857
failureMessage {failureMsg },
852
858
),
853
- ),
859
+ )
854
860
}
861
+
862
+ return info
855
863
}
856
864
857
865
// paymentFailure holds additional information about a payment failure.
You can’t perform that action at this time.
0 commit comments