Skip to content

Commit 85bba2c

Browse files
committed
multi: add SCB restore support for production taproot channels
Add the missing SimpleTaprootFinalVersion case to chanrestore.openChannelShell() so that SCB backups created for production taproot channels can be properly restored. Without this, the channel type bits were not reconstructed during restore, causing DLP to fail. Also add integration tests for both confirmed and zero-conf variants of production taproot channel backup restoration.
1 parent fd3b638 commit 85bba2c

3 files changed

Lines changed: 36 additions & 2 deletions

File tree

chanrestore.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ func (c *chanDBRestorer) openChannelShell(backup chanbackup.Single) (
170170
chanType |= channeldb.SimpleTaprootFeatureBit
171171
chanType |= channeldb.TapscriptRootBit
172172

173+
case chanbackup.SimpleTaprootFinalVersion:
174+
chanType = channeldb.ZeroHtlcTxFeeBit
175+
chanType |= channeldb.AnchorOutputsBit
176+
chanType |= channeldb.SingleFunderTweaklessBit
177+
chanType |= channeldb.SimpleTaprootFeatureBit
178+
chanType |= channeldb.TaprootFinalBit
179+
173180
default:
174181
return nil, fmt.Errorf("unknown Single version: %w", err)
175182
}

itest/lnd_channel_backup_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,30 @@ var channelRestoreTestCases = []*lntest.TestCase{
8585
)
8686
},
8787
},
88+
{
89+
// Restore a channel back up of a confirmed production
90+
// taproot channel.
91+
Name: "restore simple taproot final",
92+
TestFunc: func(ht *lntest.HarnessTest) {
93+
runChanRestoreScenarioCommitTypes(
94+
ht,
95+
lnrpc.CommitmentType_SIMPLE_TAPROOT_FINAL,
96+
false,
97+
)
98+
},
99+
},
100+
{
101+
// Restore a channel back up of an unconfirmed production
102+
// taproot channel.
103+
Name: "restore simple taproot final zero conf",
104+
TestFunc: func(ht *lntest.HarnessTest) {
105+
runChanRestoreScenarioCommitTypes(
106+
ht,
107+
lnrpc.CommitmentType_SIMPLE_TAPROOT_FINAL,
108+
true,
109+
)
110+
},
111+
},
88112
{
89113
Name: "restore from rpc",
90114
TestFunc: testChannelBackupRestoreFromRPC,

lnwallet/channel.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,8 +922,11 @@ func WithAuxResolver(resolver AuxContractResolver) ChannelOpt {
922922
}
923923

924924
// WithCustomSigningRand is used to provide a custom random source for
925-
// generating deterministic JIT signing nonces in MuSig2 sessions. This should
926-
// only be used in tests that need reproducible MuSig2 signatures.
925+
// generating deterministic JIT signing nonces in MuSig2 sessions.
926+
//
927+
// WARNING: This MUST only be used for test vector generation. Setting this in
928+
// production will produce deterministic nonces, enabling private key extraction
929+
// via nonce reuse.
927930
func WithCustomSigningRand(rand io.Reader) ChannelOpt {
928931
return func(o *channelOpts) {
929932
o.customSigningRand = fn.Some[io.Reader](rand)

0 commit comments

Comments
 (0)