mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-10 20:03:34 +02:00
lnd+contractcourt: add more debug logs
This commit adds more debug logs for witness beacon and channel arbitrator.
This commit is contained in:
@@ -1589,11 +1589,15 @@ func (c *ChannelArbitrator) checkCommitChainActions(height uint32,
|
|||||||
)
|
)
|
||||||
|
|
||||||
if toChain {
|
if toChain {
|
||||||
|
// Convert to int64 in case of overflow.
|
||||||
|
remainingBlocks := int64(htlc.RefundTimeout) -
|
||||||
|
int64(height)
|
||||||
|
|
||||||
log.Infof("ChannelArbitrator(%v): go to chain for "+
|
log.Infof("ChannelArbitrator(%v): go to chain for "+
|
||||||
"outgoing htlc %x: timeout=%v, "+
|
"outgoing htlc %x: timeout=%v, "+
|
||||||
"blocks_until_expiry=%v, broadcast_delta=%v",
|
"blocks_until_expiry=%v, broadcast_delta=%v",
|
||||||
c.cfg.ChanPoint, htlc.RHash[:],
|
c.cfg.ChanPoint, htlc.RHash[:],
|
||||||
htlc.RefundTimeout, htlc.RefundTimeout-height,
|
htlc.RefundTimeout, remainingBlocks,
|
||||||
c.cfg.OutgoingBroadcastDelta,
|
c.cfg.OutgoingBroadcastDelta,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1620,11 +1624,15 @@ func (c *ChannelArbitrator) checkCommitChainActions(height uint32,
|
|||||||
)
|
)
|
||||||
|
|
||||||
if toChain {
|
if toChain {
|
||||||
|
// Convert to int64 in case of overflow.
|
||||||
|
remainingBlocks := int64(htlc.RefundTimeout) -
|
||||||
|
int64(height)
|
||||||
|
|
||||||
log.Infof("ChannelArbitrator(%v): go to chain for "+
|
log.Infof("ChannelArbitrator(%v): go to chain for "+
|
||||||
"incoming htlc %x: timeout=%v, "+
|
"incoming htlc %x: timeout=%v, "+
|
||||||
"blocks_until_expiry=%v, broadcast_delta=%v",
|
"blocks_until_expiry=%v, broadcast_delta=%v",
|
||||||
c.cfg.ChanPoint, htlc.RHash[:],
|
c.cfg.ChanPoint, htlc.RHash[:],
|
||||||
htlc.RefundTimeout, htlc.RefundTimeout-height,
|
htlc.RefundTimeout, remainingBlocks,
|
||||||
c.cfg.IncomingBroadcastDelta,
|
c.cfg.IncomingBroadcastDelta,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@@ -140,6 +140,9 @@ func (h *htlcIncomingContestResolver) Resolve() (ContractResolver, error) {
|
|||||||
return nil, errResolverShuttingDown
|
return nil, errResolverShuttingDown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Debugf("%T(%v): Resolving incoming HTLC(expiry=%v, height=%v)", h,
|
||||||
|
h.htlcResolution.ClaimOutpoint, h.htlcExpiry, currentHeight)
|
||||||
|
|
||||||
// We'll first check if this HTLC has been timed out, if so, we can
|
// We'll first check if this HTLC has been timed out, if so, we can
|
||||||
// return now and mark ourselves as resolved. If we're past the point of
|
// return now and mark ourselves as resolved. If we're past the point of
|
||||||
// expiry of the HTLC, then at this point the sender can sweep it, so
|
// expiry of the HTLC, then at this point the sender can sweep it, so
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package lnd
|
package lnd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
@@ -127,6 +128,11 @@ func (p *preimageBeacon) LookupPreimage(
|
|||||||
|
|
||||||
// Otherwise, we'll perform a final check using the witness cache.
|
// Otherwise, we'll perform a final check using the witness cache.
|
||||||
preimage, err := p.wCache.LookupSha256Witness(payHash)
|
preimage, err := p.wCache.LookupSha256Witness(payHash)
|
||||||
|
if errors.Is(err, channeldb.ErrNoWitnesses) {
|
||||||
|
ltndLog.Debugf("No witness for payment %v", payHash)
|
||||||
|
return lntypes.Preimage{}, false
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ltndLog.Errorf("Unable to lookup witness: %v", err)
|
ltndLog.Errorf("Unable to lookup witness: %v", err)
|
||||||
return lntypes.Preimage{}, false
|
return lntypes.Preimage{}, false
|
||||||
@@ -147,7 +153,9 @@ func (p *preimageBeacon) AddPreimages(preimages ...lntypes.Preimage) error {
|
|||||||
// the caller when delivering notifications.
|
// the caller when delivering notifications.
|
||||||
preimageCopies := make([]lntypes.Preimage, 0, len(preimages))
|
preimageCopies := make([]lntypes.Preimage, 0, len(preimages))
|
||||||
for _, preimage := range preimages {
|
for _, preimage := range preimages {
|
||||||
srvrLog.Infof("Adding preimage=%v to witness cache", preimage)
|
srvrLog.Infof("Adding preimage=%v to witness cache for %v",
|
||||||
|
preimage, preimage.Hash())
|
||||||
|
|
||||||
preimageCopies = append(preimageCopies, preimage)
|
preimageCopies = append(preimageCopies, preimage)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,6 +182,9 @@ func (p *preimageBeacon) AddPreimages(preimages ...lntypes.Preimage) error {
|
|||||||
}(client)
|
}(client)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
srvrLog.Debugf("Added %d preimage(s) to witness cache",
|
||||||
|
len(preimageCopies))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user