Beispiel #1
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);
        }
Beispiel #2
0
        public void ConvertWitnessTest(IOperation[] ops, byte[] expected)
        {
            ScriptSerializer ser = new ScriptSerializer();

            byte[] actual = ser.ConvertWitness(ops);
            Assert.Equal(expected, actual);
        }