channeldb+contractcourt: add additional logging around co-op channel closes

This commit is contained in:
Olaoluwa Osuntokun 2018-04-12 17:13:28 -07:00
parent f667e3b29f
commit 7a13378671
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21
3 changed files with 17 additions and 12 deletions

@ -493,8 +493,8 @@ func (d *DB) MarkChanFullyClosed(chanPoint *wire.OutPoint) error {
chanSummaryBytes := closedChanBucket.Get(chanID) chanSummaryBytes := closedChanBucket.Get(chanID)
if chanSummaryBytes == nil { if chanSummaryBytes == nil {
return fmt.Errorf("no closed channel by that chanID " + return fmt.Errorf("no closed channel for "+
"found") "chan_point=%v found", chanPoint)
} }
chanSummaryReader := bytes.NewReader(chanSummaryBytes) chanSummaryReader := bytes.NewReader(chanSummaryBytes)

@ -276,6 +276,8 @@ func (c *ChainArbitrator) resolveContract(chanPoint wire.OutPoint,
// the channel source. // the channel source.
err := c.chanSource.MarkChanFullyClosed(&chanPoint) err := c.chanSource.MarkChanFullyClosed(&chanPoint)
if err != nil { if err != nil {
log.Errorf("ChainArbitrator: unable to mark ChannelPoint(%v) "+
"fully closed: %v", chanPoint, err)
return err return err
} }

@ -457,8 +457,9 @@ func (c *chainWatcher) dispatchCooperativeClose(commitSpend *chainntnfs.SpendDet
return return
} }
log.Infof("Waiting for txid=%v to close ChannelPoint(%v) on chain", log.Infof("closeObserver: waiting for txid=%v to close "+
commitSpend.SpenderTxHash, c.chanState.FundingOutpoint) "ChannelPoint(%v) on chain", commitSpend.SpenderTxHash,
c.chanState.FundingOutpoint)
select { select {
case confInfo, ok := <-confNtfn.Confirmed: case confInfo, ok := <-confNtfn.Confirmed:
@ -467,8 +468,9 @@ func (c *chainWatcher) dispatchCooperativeClose(commitSpend *chainntnfs.SpendDet
return return
} }
log.Infof("ChannelPoint(%v) is fully closed, at height: %v", log.Infof("closeObserver: ChannelPoint(%v) is fully "+
c.chanState.FundingOutpoint, confInfo.BlockHeight) "closed, at height: %v", c.chanState.FundingOutpoint,
confInfo.BlockHeight)
err := c.markChanClosed() err := c.markChanClosed()
if err != nil { if err != nil {
@ -724,8 +726,9 @@ func (c *CooperativeCloseCtx) LogPotentialClose(potentialClose *channeldb.Channe
return return
} }
log.Infof("Waiting for txid=%v to close ChannelPoint(%v) on chain", log.Infof("closeCtx: waiting for txid=%v to close "+
potentialClose.ClosingTXID, c.watcher.chanState.FundingOutpoint) "ChannelPoint(%v) on chain", potentialClose.ClosingTXID,
c.watcher.chanState.FundingOutpoint)
select { select {
case confInfo, ok := <-confNtfn.Confirmed: case confInfo, ok := <-confNtfn.Confirmed:
@ -734,7 +737,7 @@ func (c *CooperativeCloseCtx) LogPotentialClose(potentialClose *channeldb.Channe
return return
} }
log.Infof("ChannelPoint(%v) is fully closed, at "+ log.Infof("closeCtx: ChannelPoint(%v) is fully closed, at "+
"height: %v", c.watcher.chanState.FundingOutpoint, "height: %v", c.watcher.chanState.FundingOutpoint,
confInfo.BlockHeight) confInfo.BlockHeight)
@ -751,14 +754,14 @@ func (c *CooperativeCloseCtx) LogPotentialClose(potentialClose *channeldb.Channe
err := c.watcher.chanState.CloseChannel(potentialClose) err := c.watcher.chanState.CloseChannel(potentialClose)
if err != nil { if err != nil {
log.Warnf("unable to update latest close for "+ log.Warnf("closeCtx: unable to update latest "+
"ChannelPoint(%v): %v", "close for ChannelPoint(%v): %v",
c.watcher.chanState.FundingOutpoint, err) c.watcher.chanState.FundingOutpoint, err)
} }
err = c.watcher.markChanClosed() err = c.watcher.markChanClosed()
if err != nil { if err != nil {
log.Errorf("unable to mark chan fully "+ log.Errorf("closeCtx: unable to mark chan fully "+
"closed: %v", err) "closed: %v", err)
return return
} }