Merge pull request #2433 from cfromknecht/lookout-txid-logging
watchtower/lookout: correct txid + session id logging
This commit is contained in:
commit
b6fe6059a1
@ -116,7 +116,7 @@ func (l *Lookout) watchBlocks(epochs *chainntnfs.BlockEpochEvent) {
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case epoch := <-epochs.Epochs:
|
case epoch := <-epochs.Epochs:
|
||||||
log.Debugf("Fetching block for (height=%d, hash=%x)",
|
log.Debugf("Fetching block for (height=%d, hash=%s)",
|
||||||
epoch.Height, epoch.Hash)
|
epoch.Height, epoch.Hash)
|
||||||
|
|
||||||
// Fetch the full block from the backend corresponding
|
// Fetch the full block from the backend corresponding
|
||||||
@ -125,7 +125,7 @@ func (l *Lookout) watchBlocks(epochs *chainntnfs.BlockEpochEvent) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO(conner): add retry logic?
|
// TODO(conner): add retry logic?
|
||||||
log.Errorf("Unable to fetch block for "+
|
log.Errorf("Unable to fetch block for "+
|
||||||
"(height=%x, hash=%x): %v",
|
"(height=%x, hash=%s): %v",
|
||||||
epoch.Height, epoch.Hash, err)
|
epoch.Height, epoch.Hash, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -153,7 +153,7 @@ func (l *Lookout) processEpoch(epoch *chainntnfs.BlockEpoch,
|
|||||||
|
|
||||||
numTxnsInBlock := len(block.Transactions)
|
numTxnsInBlock := len(block.Transactions)
|
||||||
|
|
||||||
log.Debugf("Scanning %d transaction in block (height=%d, hash=%x) "+
|
log.Debugf("Scanning %d transaction in block (height=%d, hash=%s) "+
|
||||||
"for breaches", numTxnsInBlock, epoch.Height, epoch.Hash)
|
"for breaches", numTxnsInBlock, epoch.Height, epoch.Hash)
|
||||||
|
|
||||||
// Iterate over the transactions contained in the block, deriving a
|
// Iterate over the transactions contained in the block, deriving a
|
||||||
@ -178,7 +178,7 @@ func (l *Lookout) processEpoch(epoch *chainntnfs.BlockEpoch,
|
|||||||
|
|
||||||
// No matches were found, we are done.
|
// No matches were found, we are done.
|
||||||
if len(matches) == 0 {
|
if len(matches) == 0 {
|
||||||
log.Debugf("No breaches found in (height=%d, hash=%x)",
|
log.Debugf("No breaches found in (height=%d, hash=%s)",
|
||||||
epoch.Height, epoch.Hash)
|
epoch.Height, epoch.Hash)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ func (l *Lookout) processEpoch(epoch *chainntnfs.BlockEpoch,
|
|||||||
breachCountStr = "breaches"
|
breachCountStr = "breaches"
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infof("Found %d %s in (height=%d, hash=%x)",
|
log.Infof("Found %d %s in (height=%d, hash=%s)",
|
||||||
len(matches), breachCountStr, epoch.Height, epoch.Hash)
|
len(matches), breachCountStr, epoch.Height, epoch.Hash)
|
||||||
|
|
||||||
// For each match, use our index to retrieve the original transaction,
|
// For each match, use our index to retrieve the original transaction,
|
||||||
@ -199,7 +199,7 @@ func (l *Lookout) processEpoch(epoch *chainntnfs.BlockEpoch,
|
|||||||
for _, match := range matches {
|
for _, match := range matches {
|
||||||
commitTx := hintToTx[match.Hint]
|
commitTx := hintToTx[match.Hint]
|
||||||
log.Infof("Dispatching punisher for client %s, breach-txid=%s",
|
log.Infof("Dispatching punisher for client %s, breach-txid=%s",
|
||||||
match.ID, commitTx.TxHash().String())
|
match.ID, commitTx.TxHash())
|
||||||
|
|
||||||
// The decryption key for the state update should be the full
|
// The decryption key for the state update should be the full
|
||||||
// txid of the breaching commitment transaction.
|
// txid of the breaching commitment transaction.
|
||||||
@ -219,7 +219,7 @@ func (l *Lookout) processEpoch(epoch *chainntnfs.BlockEpoch,
|
|||||||
// the right transaction.
|
// the right transaction.
|
||||||
log.Debugf("Unable to decrypt blob for client %s, "+
|
log.Debugf("Unable to decrypt blob for client %s, "+
|
||||||
"breach-txid %s: %v", match.ID,
|
"breach-txid %s: %v", match.ID,
|
||||||
commitTx.TxHash().String(), err)
|
commitTx.TxHash(), err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,12 +261,12 @@ func (l *Lookout) dispatchPunisher(desc *JusticeDescriptor) {
|
|||||||
// canceled during shutdown since this method is waitgrouped.
|
// canceled during shutdown since this method is waitgrouped.
|
||||||
err := l.cfg.Punisher.Punish(desc, l.quit)
|
err := l.cfg.Punisher.Punish(desc, l.quit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("Unable to punish breach-txid %s for %x: %v",
|
log.Errorf("Unable to punish breach-txid %s for %s: %v",
|
||||||
desc.SessionInfo.ID,
|
desc.BreachedCommitTx.TxHash(), desc.SessionInfo.ID,
|
||||||
desc.BreachedCommitTx.TxHash().String(), err)
|
err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infof("Punishment for client %s with breach-txid=%s dispatched",
|
log.Infof("Punishment for client %s with breach-txid=%s dispatched",
|
||||||
desc.SessionInfo.ID, desc.BreachedCommitTx.TxHash().String())
|
desc.SessionInfo.ID, desc.BreachedCommitTx.TxHash())
|
||||||
}
|
}
|
||||||
|
@ -35,18 +35,18 @@ func (p *BreachPunisher) Punish(desc *JusticeDescriptor, quit <-chan struct{}) e
|
|||||||
justiceTxn, err := desc.CreateJusticeTxn()
|
justiceTxn, err := desc.CreateJusticeTxn()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("Unable to create justice txn for "+
|
log.Errorf("Unable to create justice txn for "+
|
||||||
"client=%s with breach-txid=%x: %v",
|
"client=%s with breach-txid=%s: %v",
|
||||||
desc.SessionInfo.ID, desc.BreachedCommitTx.TxHash(), err)
|
desc.SessionInfo.ID, desc.BreachedCommitTx.TxHash(), err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infof("Publishing justice transaction txid=%x for client=%s",
|
log.Infof("Publishing justice transaction for client=%s with txid=%s",
|
||||||
justiceTxn.TxHash(), desc.SessionInfo.ID)
|
desc.SessionInfo.ID, justiceTxn.TxHash())
|
||||||
|
|
||||||
err = p.cfg.PublishTx(justiceTxn)
|
err = p.cfg.PublishTx(justiceTxn)
|
||||||
if err != nil && err != lnwallet.ErrDoubleSpend {
|
if err != nil && err != lnwallet.ErrDoubleSpend {
|
||||||
log.Errorf("Unable to publish justice txn for client=%s"+
|
log.Errorf("Unable to publish justice txn for client=%s"+
|
||||||
"with breach-txid=%x: %v",
|
"with breach-txid=%s: %v",
|
||||||
desc.SessionInfo.ID, desc.BreachedCommitTx.TxHash(), err)
|
desc.SessionInfo.ID, desc.BreachedCommitTx.TxHash(), err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user