diff --git a/src/Angor/Shared/ProtocolNew/Scripts/TaprootScriptBuilder.cs b/src/Angor/Shared/ProtocolNew/Scripts/TaprootScriptBuilder.cs index 979216d9..a820c479 100644 --- a/src/Angor/Shared/ProtocolNew/Scripts/TaprootScriptBuilder.cs +++ b/src/Angor/Shared/ProtocolNew/Scripts/TaprootScriptBuilder.cs @@ -89,7 +89,12 @@ private static TaprootSpendInfo BuildTaprootSpendInfo(ProjectScripts scripts) var scriptWeights = BuildTaprootScripts(scripts); - var treeInfo = TaprootSpendInfo.WithHuffmanTree(taprootKey, scriptWeights.ToArray()); + // Transform the scripts to TapScript format + var tapScriptWeights = scriptWeights + .Select(sw => (sw.Item1, sw.Item2.ToTapScript(TapLeafVersion.C0))) + .ToList(); + + var treeInfo = TaprootSpendInfo.WithHuffmanTree(taprootKey, tapScriptWeights.ToArray()); return treeInfo; } diff --git a/src/Angor/Shared/ProtocolNew/SeederTransactionActions.cs b/src/Angor/Shared/ProtocolNew/SeederTransactionActions.cs index 54854f01..63080df8 100644 --- a/src/Angor/Shared/ProtocolNew/SeederTransactionActions.cs +++ b/src/Angor/Shared/ProtocolNew/SeederTransactionActions.cs @@ -82,7 +82,9 @@ public Transaction AddSignaturesToRecoverSeederFundsTransaction(ProjectInfo proj var controlBlock = _taprootScriptBuilder.CreateControlBlock(projectScripts, _ => _.Recover); - var execData = new TaprootExecutionData(stageIndex, new NBitcoin.Script(projectScripts.Recover.ToBytes()).TaprootV1LeafHash) { SigHash = sigHash }; + var tapScript = new NBitcoin.Script(projectScripts.Recover.ToBytes()).ToTapScript(TapLeafVersion.C0); + + var execData = new TaprootExecutionData(stageIndex, tapScript.LeafHash) { SigHash = sigHash }; var hash = nbitcoinRecoveryTransaction.GetSignatureHashTaproot(outputs, execData); _logger.LogInformation($"project={projectInfo.ProjectIdentifier}; seeder-pubkey={key.PubKey.ToHex()}; stage={stageIndex}; hash={hash}");