input: use script path for revocation clause for to_local output

In this commit, we modify the to_local script to use a script path for
the revocation scenario. With this change, we ensure that the internal
key is always revealed which means the anchor outputs can still always
be swept.
This commit is contained in:
Olaoluwa Osuntokun
2023-05-23 17:19:06 -07:00
parent 7f05c765c3
commit 8fc8640432
2 changed files with 74 additions and 27 deletions

View File

@@ -977,7 +977,6 @@ func localCommitSweepWitGen(sigHash txscript.SigHashType,
return TaprootCommitSpendSuccess(
signer, signDesc, spendTx,
commitScriptTree.revokeKey.PubKey(),
commitScriptTree.TapscriptTree,
)
}
@@ -1000,17 +999,18 @@ func localCommitRevokeWitGen(sigHash txscript.SigHashType,
KeyDesc: keychain.KeyDescriptor{
PubKey: revokeKey.PubKey(),
},
WitnessScript: commitScriptTree.RevocationLeaf.Script,
Output: commitScriptTree.txOut,
HashType: sigHash,
InputIndex: 0,
SigHashes: hashCache,
SignMethod: TaprootKeySpendSignMethod,
TapTweak: commitScriptTree.TapscriptRoot,
SignMethod: TaprootScriptSpendSignMethod,
PrevOutputFetcher: prevOuts,
}
return TaprootCommitSpendRevoke(
signer, signDesc, spendTx,
commitScriptTree.TapscriptTree,
)
}
}