diff --git a/NBitcoin/BIP174/PSBTInput.cs b/NBitcoin/BIP174/PSBTInput.cs index 00891632a..15362e8b0 100644 --- a/NBitcoin/BIP174/PSBTInput.cs +++ b/NBitcoin/BIP174/PSBTInput.cs @@ -5,7 +5,7 @@ using Newtonsoft.Json; using System.IO; using NBitcoin.DataEncoders; -using PartialSigKVMap = System.Collections.Generic.SortedDictionary; +using PartialSigKVMap = System.Collections.Generic.SortedDictionary; using System.Diagnostics.CodeAnalysis; using NBitcoin.Crypto; using System.Text; @@ -1094,12 +1094,8 @@ internal void Sign(KeyPair keyPair, SigningOptions? signingOptions) #endif CheckCompatibleSigHash(sigHash); var signature = PartialSigs[ecdsapk]; -#if HAS_SPAN - var existingSigHash = existingSig is TaprootSignature ts ? (uint)ts.SigHash : - (uint)((TransactionSignature)existingSig).SigHash; -#else - var existingSigHash = (uint)((TransactionSignature)existingSig).SigHash; -#endif + + var existingSigHash = (uint)existingSig.SigHash; if (Transaction is IHasForkId) existingSigHash = existingSigHash & ~(0x40u); if (!SameSigHash(existingSigHash, sigHash)) diff --git a/NBitcoin/BuilderExtensions/P2MultiSigBuilderExtension.cs b/NBitcoin/BuilderExtensions/P2MultiSigBuilderExtension.cs index 19a6f8e9d..6ced87ec4 100644 --- a/NBitcoin/BuilderExtensions/P2MultiSigBuilderExtension.cs +++ b/NBitcoin/BuilderExtensions/P2MultiSigBuilderExtension.cs @@ -78,7 +78,7 @@ public override void Finalize(InputSigningContext inputSigningContext) var multiSigParams = PayToMultiSigTemplate.Instance.ExtractScriptPubKeyParameters(scriptPubKey)!; if (multiSigParams.SignatureCount > txIn.PartialSigs.Count) return; - List sigs = new List(); + List sigs = new List(); int sigcount = 0; foreach (var pk in multiSigParams.PubKeys) { @@ -185,7 +185,7 @@ public override void MergePartialSignatures(InputSigningContext inputSigningCont var txIn = inputSigningContext.Input; var scriptPubKey = inputSigningContext.Coin.GetScriptCode(); - var sigs = new ITransactionSignature?[multiSigParams.PubKeys.Length]; + var sigs = new TransactionSignature?[multiSigParams.PubKeys.Length]; int sigCount = 0; for (int i = 0; i < multiSigParams.PubKeys.Length; i++) { diff --git a/NBitcoin/StandardScriptTemplate.cs b/NBitcoin/StandardScriptTemplate.cs index 1bfb33c8f..51442303d 100644 --- a/NBitcoin/StandardScriptTemplate.cs +++ b/NBitcoin/StandardScriptTemplate.cs @@ -380,12 +380,12 @@ protected override bool CheckScriptSigCore(Script scriptSig, Op[] scriptSigOps, } } - public Script GenerateScriptSig(ITransactionSignature[] signatures) + public Script GenerateScriptSig(TransactionSignature[] signatures) { - return GenerateScriptSig((IEnumerable)signatures); + return GenerateScriptSig((IEnumerable)signatures); } - public Script GenerateScriptSig(IEnumerable signatures) + public Script GenerateScriptSig(IEnumerable signatures) { List ops = new List(); ops.Add(OpcodeType.OP_0); @@ -604,7 +604,7 @@ public Script GenerateScriptSig(ECDSASignature signature) { return GenerateScriptSig(new TransactionSignature(signature, SigHash.All)); } - public Script GenerateScriptSig(ITransactionSignature signature) + public Script GenerateScriptSig(TransactionSignature signature) { return new Script( Op.GetPushOp(signature.ToBytes()) @@ -803,7 +803,7 @@ public Script GenerateScriptPubKey(KeyId pubkeyHash) ); } - public Script GenerateScriptSig(ITransactionSignature? signature, PubKey publicKey) + public Script GenerateScriptSig(TransactionSignature? signature, PubKey publicKey) { if (publicKey == null) throw new ArgumentNullException(nameof(publicKey));