示例#1
0
        public void Convert_SingleSigTest(IOperation[] ops, byte[] sig, byte[] expected)
        {
            ScriptSerializer ser = new ScriptSerializer();

            byte[] actual = ser.Convert(ops, sig);
            Assert.Equal(expected, actual);
        }
示例#2
0
文件: OpData.cs 项目: supaFool/Denovo
        /// <inheritdoc/>
        public bool Verify(Signature sig, PublicKey pubKey, ReadOnlySpan<byte> sigBa)
        {
            byte[] spendScr, dataToSign;
            if (IsSegWit)
            {
                spendScr = scriptSer.ConvertWitness(ExecutingScript);
                dataToSign = Tx.SerializeForSigningSegWit(spendScr, TxInIndex, AmountBeingSpent, sig.SigHash);
            }
            else
            {
                spendScr = scriptSer.Convert(ExecutingScript, sigBa);
                dataToSign = Tx.SerializeForSigning(spendScr, TxInIndex, sig.SigHash);
            }

            return calc.Verify(dataToSign, sig, pubKey, ForceLowS);
        }