Exemplo n.º 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);
        }
Exemplo n.º 2
0
        /// <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);
        }