diff --git a/src/Angor.Test/Angor.Test.csproj b/src/Angor.Test/Angor.Test.csproj index 02195e48..c6a9c380 100644 --- a/src/Angor.Test/Angor.Test.csproj +++ b/src/Angor.Test/Angor.Test.csproj @@ -22,7 +22,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Angor.Test/DataBuilders/AngorScripts.cs b/src/Angor.Test/DataBuilders/AngorScripts.cs index 7df1679e..f331551b 100644 --- a/src/Angor.Test/DataBuilders/AngorScripts.cs +++ b/src/Angor.Test/DataBuilders/AngorScripts.cs @@ -26,8 +26,8 @@ public static Script CreateControlBlock(ProjectScripts scripts, Expression (sw.Item1, sw.Item2.ToTapScript(TapLeafVersion.C0))) - .ToList(); - - var treeInfo = TaprootSpendInfo.WithHuffmanTree(taprootKey, tapScriptWeights.ToArray()); + var treeInfo = TaprootSpendInfo.WithHuffmanTree(taprootKey, scriptWeights.ToArray()); return treeInfo; } diff --git a/src/Angor.Test/DataBuilders/InvestmentOperations.cs b/src/Angor.Test/DataBuilders/InvestmentOperations.cs index 3204869d..f4e2f9c0 100644 --- a/src/Angor.Test/DataBuilders/InvestmentOperations.cs +++ b/src/Angor.Test/DataBuilders/InvestmentOperations.cs @@ -203,8 +203,8 @@ public Transaction SpendFounderStage(Network network, FounderContext context, in var sighash = TaprootSigHash.All;// TaprootSigHash.Single | TaprootSigHash.AnyoneCanPay; var allSpendingOutputs = signingContext.Select(s => s.spendingOutput.TxOut).ToArray(); - var trxData = spender.PrecomputeTransactionData(allSpendingOutputs); - var execData = new TaprootExecutionData(inputIndex, scriptToExecute.ToTapScript(TapLeafVersion.C0).LeafHash) { SigHash = sighash }; + var trxData = spender.PrecomputeTransactionData(allSpendingOutputs); + var execData = new TaprootExecutionData(inputIndex, scriptToExecute.TaprootV1LeafHash) { SigHash = sighash }; var hash = spender.GetSignatureHashTaproot(trxData, execData); var key = new Key(Encoders.Hex.DecodeData(founderPrivateKey)); @@ -286,9 +286,9 @@ public List FounderSignInvestorRecoveryTransactions(InvestorContext cont const TaprootSigHash sigHash = TaprootSigHash.Single | TaprootSigHash.AnyoneCanPay; var hash = stageTransaction.GetSignatureHashTaproot(new[] { investmentTransaction.Outputs[i+2] }, - new TaprootExecutionData(0, - new NBitcoin.Script(scriptStages.Recover.ToBytes()).ToTapScript(TapLeafVersion.C0).LeafHash) - { SigHash = sigHash }); + new TaprootExecutionData(0, + new NBitcoin.Script(scriptStages.Recover.ToBytes()).TaprootV1LeafHash) + { SigHash = sigHash }); var signature = key.SignTaprootKeySpend(hash, sigHash); @@ -329,8 +329,8 @@ public void AddWitScriptToInvestorRecoveryTransactions(InvestorContext context, var hash = stageTransaction.GetSignatureHashTaproot(new[] { investmentTransaction.Outputs[index + 2] }, new TaprootExecutionData(0, - new NBitcoin.Script(projectScripts.Recover.ToBytes()).ToTapScript(TapLeafVersion.C0).LeafHash) - { SigHash = sigHash }); + new NBitcoin.Script(projectScripts.Recover.ToBytes()).TaprootV1LeafHash) + { SigHash = sigHash }); var investorSignature = key.SignTaprootKeySpend(hash, sigHash); @@ -446,7 +446,7 @@ public Transaction RecoverEndOfProjectFunds(Network network, InvestorContext con var allSpendingOutputs = signingContext.Select(s => s.spendingOutput.TxOut).ToArray(); var trxData = spender.PrecomputeTransactionData(allSpendingOutputs); - var execData = new TaprootExecutionData(inputIndex, scriptToExecute.ToTapScript(TapLeafVersion.C0).LeafHash) { SigHash = sighash }; + var execData = new TaprootExecutionData(inputIndex, scriptToExecute.TaprootV1LeafHash) { SigHash = sighash }; var hash = spender.GetSignatureHashTaproot(trxData, execData); var key = new Key(Encoders.Hex.DecodeData(investorPrivateKey)); @@ -566,7 +566,7 @@ public Transaction RecoverFundsNoPenalty(Network network, InvestorContext contex var allSpendingOutputs = signingContext.Select(s => s.spendingOutput.TxOut).ToArray(); var trxData = spender.PrecomputeTransactionData(allSpendingOutputs); - var execData = new TaprootExecutionData(inputIndex, scriptToExecute.ToTapScript(TapLeafVersion.C0).LeafHash) { SigHash = sighash }; + var execData = new TaprootExecutionData(inputIndex, scriptToExecute.TaprootV1LeafHash) { SigHash = sighash }; var hash = spender.GetSignatureHashTaproot(trxData, execData); var key = new Key(Encoders.Hex.DecodeData(investorPrivateKey)); diff --git a/src/Angor/Client/Angor.Client.csproj b/src/Angor/Client/Angor.Client.csproj index af92dace..ffa3b936 100644 --- a/src/Angor/Client/Angor.Client.csproj +++ b/src/Angor/Client/Angor.Client.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/Angor/Client/Properties/launchSettings.json b/src/Angor/Client/Properties/launchSettings.json index 05a3932a..b3370349 100644 --- a/src/Angor/Client/Properties/launchSettings.json +++ b/src/Angor/Client/Properties/launchSettings.json @@ -1,12 +1,5 @@ { - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:15856", - "sslPort": 44308 - } - }, + "$schema": "https://json.schemastore.org/launchsettings.json", "profiles": { "http": { "commandName": "Project", @@ -27,14 +20,6 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } } } } diff --git a/src/Angor/Shared/Angor.Shared.csproj b/src/Angor/Shared/Angor.Shared.csproj index 1f948dbd..59b5ccde 100644 --- a/src/Angor/Shared/Angor.Shared.csproj +++ b/src/Angor/Shared/Angor.Shared.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/Angor/Shared/ProtocolNew/FounderTransactionActions.cs b/src/Angor/Shared/ProtocolNew/FounderTransactionActions.cs index 0bf7c039..6c1c3f38 100644 --- a/src/Angor/Shared/ProtocolNew/FounderTransactionActions.cs +++ b/src/Angor/Shared/ProtocolNew/FounderTransactionActions.cs @@ -62,9 +62,7 @@ public SignatureInfo SignInvestorRecoveryTransactions(ProjectInfo projectInfo, s { var scriptStages = _investmentScriptBuilder.BuildProjectScriptsForStage(projectInfo, investorKey, stageIndex, secretHash); - var tapScript = new NBitcoin.Script(scriptStages.Recover.ToBytes()).ToTapScript(TapLeafVersion.C0); - - var execData = new TaprootExecutionData(stageIndex, tapScript.LeafHash) { SigHash = sigHash }; + var execData = new TaprootExecutionData(stageIndex, new NBitcoin.Script(scriptStages.Recover.ToBytes()).TaprootV1LeafHash) { SigHash = sigHash }; var hash = nbitcoinRecoveryTransaction.GetSignatureHashTaproot(outputs, execData); var sig = key.SignTaprootKeySpend(hash, sigHash).ToString(); @@ -126,9 +124,7 @@ public TransactionInfo SpendFounderStage(ProjectInfo projectInfo, IEnumerable _.Recover); - var tapScript = new NBitcoin.Script(scriptStages.Recover.ToBytes()).ToTapScript(TapLeafVersion.C0); - - var execData = new TaprootExecutionData(stageIndex, tapScript.LeafHash) { SigHash = sigHash }; + var execData = new TaprootExecutionData(stageIndex, new NBitcoin.Script(scriptStages.Recover.ToBytes()).TaprootV1LeafHash) { SigHash = sigHash }; var hash = nbitcoinRecoveryTransaction.GetSignatureHashTaproot(outputs, execData); _logger.LogInformation($"project={projectInfo.ProjectIdentifier}; investor-pubkey={key.PubKey.ToHex()}; stage={stageIndex}; hash={hash}"); @@ -292,9 +290,7 @@ public bool CheckInvestorRecoverySignatures(ProjectInfo projectInfo, Transaction { var scriptStages = _investmentScriptBuilder.BuildProjectScriptsForStage(projectInfo, investorKey, stageIndex, secretHash); - var tapScript = new NBitcoin.Script(scriptStages.Recover.ToBytes()).ToTapScript(TapLeafVersion.C0); - - var execData = new TaprootExecutionData(stageIndex, tapScript.LeafHash) { SigHash = sigHash }; + var execData = new TaprootExecutionData(stageIndex, new NBitcoin.Script(scriptStages.Recover.ToBytes()).TaprootV1LeafHash) { SigHash = sigHash }; var hash = nBitcoinRecoveryTransaction.GetSignatureHashTaproot(outputs, execData); var sig = founderSignatures.Signatures.First(f => f.StageIndex == stageIndex).Signature; diff --git a/src/Angor/Shared/ProtocolNew/Scripts/TaprootScriptBuilder.cs b/src/Angor/Shared/ProtocolNew/Scripts/TaprootScriptBuilder.cs index a820c479..9fad87ee 100644 --- a/src/Angor/Shared/ProtocolNew/Scripts/TaprootScriptBuilder.cs +++ b/src/Angor/Shared/ProtocolNew/Scripts/TaprootScriptBuilder.cs @@ -24,8 +24,8 @@ public Script CreateControlBlock(ProjectScripts scripts, Expression (sw.Item1, sw.Item2.ToTapScript(TapLeafVersion.C0))) - .ToList(); - - var treeInfo = TaprootSpendInfo.WithHuffmanTree(taprootKey, tapScriptWeights.ToArray()); + var treeInfo = TaprootSpendInfo.WithHuffmanTree(taprootKey, scriptWeights.ToArray()); return treeInfo; } diff --git a/src/Angor/Shared/ProtocolNew/SeederTransactionActions.cs b/src/Angor/Shared/ProtocolNew/SeederTransactionActions.cs index 63080df8..54854f01 100644 --- a/src/Angor/Shared/ProtocolNew/SeederTransactionActions.cs +++ b/src/Angor/Shared/ProtocolNew/SeederTransactionActions.cs @@ -82,9 +82,7 @@ public Transaction AddSignaturesToRecoverSeederFundsTransaction(ProjectInfo proj var controlBlock = _taprootScriptBuilder.CreateControlBlock(projectScripts, _ => _.Recover); - var tapScript = new NBitcoin.Script(projectScripts.Recover.ToBytes()).ToTapScript(TapLeafVersion.C0); - - var execData = new TaprootExecutionData(stageIndex, tapScript.LeafHash) { SigHash = sigHash }; + var execData = new TaprootExecutionData(stageIndex, new NBitcoin.Script(projectScripts.Recover.ToBytes()).TaprootV1LeafHash) { SigHash = sigHash }; var hash = nbitcoinRecoveryTransaction.GetSignatureHashTaproot(outputs, execData); _logger.LogInformation($"project={projectInfo.ProjectIdentifier}; seeder-pubkey={key.PubKey.ToHex()}; stage={stageIndex}; hash={hash}"); diff --git a/src/Angor/Shared/ProtocolNew/TransactionBuilders/SpendingTransactionBuilder.cs b/src/Angor/Shared/ProtocolNew/TransactionBuilders/SpendingTransactionBuilder.cs index 6f975b17..a68ce9d8 100644 --- a/src/Angor/Shared/ProtocolNew/TransactionBuilders/SpendingTransactionBuilder.cs +++ b/src/Angor/Shared/ProtocolNew/TransactionBuilders/SpendingTransactionBuilder.cs @@ -77,7 +77,7 @@ public TransactionInfo BuildRecoverInvestorRemainingFundsInProject(string invest input.WitScript[input.WitScript.PushCount - 2]); //control block is the last and execute one before it var hash = spendingTrx.GetSignatureHashTaproot(trxData, - new TaprootExecutionData(inputIndex, scriptToExecute.ToTapScript(TapLeafVersion.C0).LeafHash) { SigHash = sigHash }); + new TaprootExecutionData(inputIndex, scriptToExecute.TaprootV1LeafHash) { SigHash = sigHash }); var sig = key.SignTaprootKeySpend(hash, sigHash);