test: fix nil dereference

fixes tests TestLoopOutFailOffchain,
TestLoopOutPaymentParameters
This commit is contained in:
Slyghtning 2025-08-19 14:09:02 +02:00
parent fe747a0670
commit cc26813f24
No known key found for this signature in database
GPG key ID: F82D456EA023C9BF
2 changed files with 19 additions and 2 deletions

View file

@ -151,7 +151,7 @@ func (ctx *Context) AssertPaid(
return done
}
// Assert that client pays swap invoice.
// Assert that the client pays swap invoice.
for {
var swapPayment RouterPaymentChannelMessage
select {
@ -171,7 +171,12 @@ func (ctx *Context) AssertPaid(
done := func(result error) {
if result != nil {
swapPayment.Errors <- result
// Send a terminal FAILED status so the client
// always receives a non-nil PaymentStatus and
// won't dereference nil.
swapPayment.Updates <- lndclient.PaymentStatus{
State: lnrpc.Payment_FAILED,
}
return
}
swapPayment.Updates <- lndclient.PaymentStatus{