Skip to content

Commit 0ca9123

Browse files
authored
Merge pull request #10000 from yyforyongyu/explore-dyn
watchtower: fix logging and add comments
2 parents c7aa179 + bef90c6 commit 0ca9123

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

watchtower/lookout/justice_descriptor.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/davecgh/go-spew/spew"
1313
"github.com/lightningnetwork/lnd/input"
1414
"github.com/lightningnetwork/lnd/lntypes"
15+
"github.com/lightningnetwork/lnd/lnutils"
1516
"github.com/lightningnetwork/lnd/watchtower/blob"
1617
"github.com/lightningnetwork/lnd/watchtower/wtdb"
1718
)
@@ -230,6 +231,9 @@ func (p *JusticeDescriptor) CreateJusticeTxn() (*wire.MsgTx, error) {
230231
case input.P2WPKHSize:
231232
weightEstimate.AddP2WKHOutput()
232233

234+
// NOTE: P2TR has the same size as P2WSH (34 bytes), their output sizes
235+
// are also the same (43 bytes), so here we implicitly catch the P2TR
236+
// output case.
233237
case input.P2WSHSize:
234238
weightEstimate.AddP2WSHOutput()
235239

@@ -260,8 +264,9 @@ func (p *JusticeDescriptor) CreateJusticeTxn() (*wire.MsgTx, error) {
260264

261265
sweepInputs = append(sweepInputs, toLocalInput)
262266

263-
log.Debugf("Found to local witness output=%#v, stack=%v",
264-
toLocalInput.txOut, toLocalInput.witness)
267+
log.Debugf("Found to local witness output=%v, stack=%x",
268+
lnutils.SpewLogClosure(toLocalInput.txOut),
269+
toLocalInput.witness)
265270

266271
// If the justice kit specifies that we have to sweep the to-remote
267272
// output, we'll also try to assemble the output and add it to weight
@@ -273,8 +278,9 @@ func (p *JusticeDescriptor) CreateJusticeTxn() (*wire.MsgTx, error) {
273278
}
274279
sweepInputs = append(sweepInputs, toRemoteInput)
275280

276-
log.Debugf("Found to remote witness output=%#v, stack=%v",
277-
toRemoteInput.txOut, toRemoteInput.witness)
281+
log.Debugf("Found to remote witness output=%v, stack=%x",
282+
lnutils.SpewLogClosure(toRemoteInput.txOut),
283+
toRemoteInput.witness)
278284

279285
// Get the weight for the to-remote witness and add that to the
280286
// estimator.

0 commit comments

Comments
 (0)