contractcourt+lnd: add debug log

This commit is contained in:
yyforyongyu 2021-08-08 16:08:08 +08:00
parent 7038d0e5c8
commit 64f4e21ab4
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868
2 changed files with 18 additions and 5 deletions

View File

@ -176,6 +176,7 @@ func (b *breachArbiter) start() error {
}, func() {
breachRetInfos = make(map[wire.OutPoint]retributionInfo)
}); err != nil {
brarLog.Errorf("Unable to create retribution info: %v", err)
return err
}
@ -190,6 +191,9 @@ func (b *breachArbiter) start() error {
return err
}
brarLog.Debugf("Found %v closing channels, %v retribution records",
len(closedChans), len(breachRetInfos))
// Using the set of non-pending, closed channels, reconcile any
// discrepancies between the channeldb and the retribution store by
// removing any retribution information for which we have already
@ -199,6 +203,9 @@ func (b *breachArbiter) start() error {
// TODO(halseth): no need continue on IsPending once closed channels
// actually means close transaction is confirmed.
for _, chanSummary := range closedChans {
brarLog.Debugf("Working on close channel: %v, is_pending: %v",
chanSummary.ChanPoint, chanSummary.IsPending)
if chanSummary.IsPending {
continue
}
@ -212,6 +219,9 @@ func (b *breachArbiter) start() error {
return err
}
delete(breachRetInfos, *chanPoint)
brarLog.Debugf("Skipped closed channel: %v",
chanSummary.ChanPoint)
}
}
@ -220,6 +230,9 @@ func (b *breachArbiter) start() error {
for chanPoint := range breachRetInfos {
retInfo := breachRetInfos[chanPoint]
brarLog.Debugf("Handling breach handoff on startup "+
"for ChannelPoint(%v)", chanPoint)
// Register for a notification when the breach transaction is
// confirmed on chain.
breachTXID := retInfo.commitHash

View File

@ -435,10 +435,10 @@ func (c *ChannelArbitrator) Start(state *chanArbStartState) error {
}
}
log.Debugf("Starting ChannelArbitrator(%v), htlc_set=%v",
log.Debugf("Starting ChannelArbitrator(%v), htlc_set=%v, state=%v",
c.cfg.ChanPoint, newLogClosure(func() string {
return spew.Sdump(c.activeHTLCs)
}),
}), state.currentState,
)
// Set our state from our starting state.
@ -795,7 +795,7 @@ func (c *ChannelArbitrator) stateStep(
// default state. If this isn't a self initiated event (we're
// checking due to a chain update), then we'll exit now.
if len(chainActions) == 0 && trigger == chainTrigger {
log.Tracef("ChannelArbitrator(%v): no actions for "+
log.Debugf("ChannelArbitrator(%v): no actions for "+
"chain trigger, terminating", c.cfg.ChanPoint)
return StateDefault, closeTx, nil
@ -1303,7 +1303,7 @@ func (c *ChannelArbitrator) advanceState(
// transition to is that same state that we started at.
for {
priorState = c.state
log.Tracef("ChannelArbitrator(%v): attempting state step with "+
log.Debugf("ChannelArbitrator(%v): attempting state step with "+
"trigger=%v from state=%v", c.cfg.ChanPoint, trigger,
priorState)
@ -1324,7 +1324,7 @@ func (c *ChannelArbitrator) advanceState(
// our prior state back as the next state, then we'll
// terminate.
if nextState == priorState {
log.Tracef("ChannelArbitrator(%v): terminating at "+
log.Debugf("ChannelArbitrator(%v): terminating at "+
"state=%v", c.cfg.ChanPoint, nextState)
return nextState, forceCloseTx, nil
}