htlcswitch: add logging to quiescer
This commit is contained in:
1 file changed
+10
@@ -5,6 +5,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btclog/v2"
|
||||||
|
"github.com/lightningnetwork/lnd/build"
|
||||||
"github.com/lightningnetwork/lnd/fn"
|
"github.com/lightningnetwork/lnd/fn"
|
||||||
"github.com/lightningnetwork/lnd/lntypes"
|
"github.com/lightningnetwork/lnd/lntypes"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
@@ -135,6 +137,9 @@ type QuiescerCfg struct {
|
|||||||
type QuiescerLive struct {
|
type QuiescerLive struct {
|
||||||
cfg QuiescerCfg
|
cfg QuiescerCfg
|
||||||
|
|
||||||
|
// log is a quiescer-scoped logging instance.
|
||||||
|
log btclog.Logger
|
||||||
|
|
||||||
// localInit indicates whether our path through this state machine was
|
// localInit indicates whether our path through this state machine was
|
||||||
// initiated by our node. This can be true or false independently of
|
// initiated by our node. This can be true or false independently of
|
||||||
// remoteInit.
|
// remoteInit.
|
||||||
@@ -169,8 +174,11 @@ type QuiescerLive struct {
|
|||||||
|
|
||||||
// NewQuiescer creates a new quiescer for the given channel.
|
// NewQuiescer creates a new quiescer for the given channel.
|
||||||
func NewQuiescer(cfg QuiescerCfg) Quiescer {
|
func NewQuiescer(cfg QuiescerCfg) Quiescer {
|
||||||
|
logPrefix := fmt.Sprintf("Quiescer(%v):", cfg.chanID)
|
||||||
|
|
||||||
return &QuiescerLive{
|
return &QuiescerLive{
|
||||||
cfg: cfg,
|
cfg: cfg,
|
||||||
|
log: build.NewPrefixLog(logPrefix, log),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,6 +512,8 @@ func (q *QuiescerLive) Resume() {
|
|||||||
// channel has been quiescent and then resets the quiescer state to its initial
|
// channel has been quiescent and then resets the quiescer state to its initial
|
||||||
// state.
|
// state.
|
||||||
func (q *QuiescerLive) resume() {
|
func (q *QuiescerLive) resume() {
|
||||||
|
q.log.Debug("quiescence terminated, resuming htlc traffic")
|
||||||
|
|
||||||
// since we are resuming we want to cancel the quiescence timeout
|
// since we are resuming we want to cancel the quiescence timeout
|
||||||
// action.
|
// action.
|
||||||
q.cancelTimeout()
|
q.cancelTimeout()
|
||||||
|
|||||||
Reference in new issue
Block a user