Skip to content

Commit 2f58991

Browse files
committed
test: fix nil dereference in TestLoopOutFailOffchain
1 parent 4f877dd commit 2f58991

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/context.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func (ctx *Context) AssertPaid(
151151
return done
152152
}
153153

154-
// Assert that client pays swap invoice.
154+
// Assert that the client pays swap invoice.
155155
for {
156156
var swapPayment RouterPaymentChannelMessage
157157
select {
@@ -171,7 +171,12 @@ func (ctx *Context) AssertPaid(
171171

172172
done := func(result error) {
173173
if result != nil {
174-
swapPayment.Errors <- result
174+
// Send a terminal FAILED status so the client
175+
// always receives a non-nil PaymentStatus and
176+
// won't dereference nil.
177+
swapPayment.Updates <- lndclient.PaymentStatus{
178+
State: lnrpc.Payment_FAILED,
179+
}
175180
return
176181
}
177182
swapPayment.Updates <- lndclient.PaymentStatus{

0 commit comments

Comments
 (0)