mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-05 17:05:50 +02:00
contractcourt: add verbose logging in resolvers
We now put the outpoint in the resolvers's logging so it's easier to debug.
This commit is contained in:
@@ -82,6 +82,7 @@ func newTimeoutResolver(res lnwallet.OutgoingHtlcResolution,
|
||||
}
|
||||
|
||||
h.initReport()
|
||||
h.initLogger(fmt.Sprintf("%T(%v)", h, h.outpoint()))
|
||||
|
||||
return h
|
||||
}
|
||||
@@ -93,23 +94,25 @@ func (h *htlcTimeoutResolver) isTaproot() bool {
|
||||
)
|
||||
}
|
||||
|
||||
// outpoint returns the outpoint of the HTLC output we're attempting to sweep.
|
||||
func (h *htlcTimeoutResolver) outpoint() wire.OutPoint {
|
||||
// The primary key for this resolver will be the outpoint of the HTLC
|
||||
// on the commitment transaction itself. If this is our commitment,
|
||||
// then the output can be found within the signed timeout tx,
|
||||
// otherwise, it's just the ClaimOutpoint.
|
||||
if h.htlcResolution.SignedTimeoutTx != nil {
|
||||
return h.htlcResolution.SignedTimeoutTx.TxIn[0].PreviousOutPoint
|
||||
}
|
||||
|
||||
return h.htlcResolution.ClaimOutpoint
|
||||
}
|
||||
|
||||
// ResolverKey returns an identifier which should be globally unique for this
|
||||
// particular resolver within the chain the original contract resides within.
|
||||
//
|
||||
// NOTE: Part of the ContractResolver interface.
|
||||
func (h *htlcTimeoutResolver) ResolverKey() []byte {
|
||||
// The primary key for this resolver will be the outpoint of the HTLC
|
||||
// on the commitment transaction itself. If this is our commitment,
|
||||
// then the output can be found within the signed timeout tx,
|
||||
// otherwise, it's just the ClaimOutpoint.
|
||||
var op wire.OutPoint
|
||||
if h.htlcResolution.SignedTimeoutTx != nil {
|
||||
op = h.htlcResolution.SignedTimeoutTx.TxIn[0].PreviousOutPoint
|
||||
} else {
|
||||
op = h.htlcResolution.ClaimOutpoint
|
||||
}
|
||||
|
||||
key := newResolverID(op)
|
||||
key := newResolverID(h.outpoint())
|
||||
return key[:]
|
||||
}
|
||||
|
||||
@@ -1038,6 +1041,7 @@ func newTimeoutResolverFromReader(r io.Reader, resCfg ResolverConfig) (
|
||||
}
|
||||
|
||||
h.initReport()
|
||||
h.initLogger(fmt.Sprintf("%T(%v)", h, h.outpoint()))
|
||||
|
||||
return h, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user