Skip to content

Commit 7f2e357

Browse files
committed
watchtower: prepare infrastructure for production taproot support
This commit adds preparatory infrastructure and TODO markers in the watchtower justice kit generation for future production taproot channel support. The changes establish placeholders for channel type detection and script option selection that will be needed when watchtowers begin handling breach scenarios for production taproot channels. The current implementation includes commented code structures that demonstrate the intended approach for integrating production script options into the justice transaction generation process. When channel type information becomes available in the BreachRetribution structure, these placeholders can be activated to ensure that watchtowers generate justice transactions using the appropriate script optimization level. This preparatory work ensures that the watchtower system has a clear path toward production taproot support while maintaining current functionality for staging taproot and legacy channels. The TODO comments provide explicit guidance for future development when watchtower breach handling for production taproot channels is implemented.
1 parent 70fcfd9 commit 7f2e357

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

watchtower/blob/justice_kit.go

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,17 @@ func newTaprootJusticeKit(sweepScript []byte,
310310

311311
// TODO(roasbeef): aux leaf tower updates needed
312312

313+
// TODO: Add channel type info to BreachRetribution to determine
314+
// whether to use production scripts for final taproot channels.
315+
// For now, we default to staging scripts.
316+
var scriptOpts []input.TaprootScriptOpt
317+
// if chanType.IsTaprootFinal() {
318+
// scriptOpts = append(scriptOpts, input.WithProdScripts())
319+
// }
320+
313321
tree, err := input.NewLocalCommitScriptTree(
314322
breachInfo.RemoteDelay, keyRing.ToLocalKey,
315-
keyRing.RevocationKey, fn.None[txscript.TapLeaf](),
323+
keyRing.RevocationKey, fn.None[txscript.TapLeaf](), scriptOpts...,
316324
)
317325
if err != nil {
318326
return nil, err
@@ -352,8 +360,15 @@ func (t *taprootJusticeKit) ToLocalOutputSpendInfo() (*txscript.PkScript,
352360
return nil, nil, err
353361
}
354362

363+
// TODO: Add channel type info to determine whether to use production
364+
// scripts for final taproot channels. For now, we default to staging scripts.
365+
var scriptOpts []input.TaprootScriptOpt
366+
// if chanType.IsTaprootFinal() {
367+
// scriptOpts = append(scriptOpts, input.WithProdScripts())
368+
// }
369+
355370
revokeScript, err := input.TaprootLocalCommitRevokeScript(
356-
localDelayedPubKey, revocationPubKey,
371+
localDelayedPubKey, revocationPubKey, scriptOpts...,
357372
)
358373
if err != nil {
359374
return nil, nil, err
@@ -419,8 +434,15 @@ func (t *taprootJusticeKit) ToRemoteOutputSpendInfo() (*txscript.PkScript,
419434
return nil, nil, 0, err
420435
}
421436

437+
// TODO: Add channel type info to determine whether to use production
438+
// scripts for final taproot channels. For now, we default to staging scripts.
439+
var scriptOpts []input.TaprootScriptOpt
440+
// if chanType.IsTaprootFinal() {
441+
// scriptOpts = append(scriptOpts, input.WithProdScripts())
442+
// }
443+
422444
scriptTree, err := input.NewRemoteCommitScriptTree(
423-
toRemotePk, fn.None[txscript.TapLeaf](),
445+
toRemotePk, fn.None[txscript.TapLeaf](), scriptOpts...,
424446
)
425447
if err != nil {
426448
return nil, nil, 0, err

0 commit comments

Comments
 (0)