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:
1 parent
6edd942c70
commit
77ae7afe78
9 files changed
+256
-177
No files matched your search
@@ -2,6 +2,7 @@ package lnwallet
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
@@ -103,6 +104,10 @@ var (
|
||||
bobDustLimit = btcutil.Amount(1300)
|
||||
|
||||
testChannelCapacity float64 = 10
|
||||
|
||||
// ctxb is a context that will never be cancelled, that is used in
|
||||
// place of a real quit context.
|
||||
ctxb = context.Background()
|
||||
)
|
||||
|
||||
// CreateTestChannels creates to fully populated channels to be used within
|
||||
@@ -557,7 +562,7 @@ func calcStaticFee(chanType channeldb.ChannelType, numHTLCs int) btcutil.Amount
|
||||
// pending updates. This method is useful when testing interactions between two
|
||||
// live state machines.
|
||||
func ForceStateTransition(chanA, chanB *LightningChannel) error {
|
||||
aliceNewCommit, err := chanA.SignNextCommitment()
|
||||
aliceNewCommit, err := chanA.SignNextCommitment(ctxb)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -570,7 +575,7 @@ func ForceStateTransition(chanA, chanB *LightningChannel) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
bobNewCommit, err := chanB.SignNextCommitment()
|
||||
bobNewCommit, err := chanB.SignNextCommitment(ctxb)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user