multi: link quit can interrupt commitment signing

In this commit, we make sig job handling when singing a next commitment
non-blocking by allowing the shutdown of a channel link to prevent
further waiting on sig jobs by the channel state machine. This addresses
possible cases where the aux signer may be shut down via a separate quit
signal, so the state machine could block indefinitely on receiving an
update on a sig job.
This commit is contained in:
Jonathan Harvey-Buschel authored and Oliver Gugger committed 2024-10-17 17:35:29 +02:00
1 parent 6edd942c70
commit 77ae7afe78
9 files changed
+256 -177

No files matched your search

+4 -1
View File
@@ -1,6 +1,7 @@
package htlcswitch
import (
"context"
"crypto/sha256"
"testing"
"time"
@@ -94,7 +95,9 @@ func (l *linkTestContext) receiveHtlcAliceToBob() {
func (l *linkTestContext) sendCommitSigBobToAlice(expHtlcs int) {
l.t.Helper()
sigs, err := l.bobChannel.SignNextCommitment()
testQuit, testQuitFunc := context.WithCancel(context.Background())
defer testQuitFunc()
sigs, err := l.bobChannel.SignNextCommitment(testQuit)
if err != nil {
l.t.Fatalf("error signing commitment: %v", err)
}