Пример #1
0
        public void TryDeserialize_LargeScriptTest()
        {
            // TestNet TxId= 88bac1e84c235aa0418345bf430fb43b336875974b6e87dc958de196f9222c35
            byte[]       expected     = Helper.HexToBytes("4d1127").ConcatFast(Helper.GetBytes(10001)).AppendToEnd((byte)OP.DROP);
            byte[]       veryLongData = Helper.HexToBytes("fd1527").ConcatFast(expected);
            PubkeyScript scr          = new PubkeyScript();
            bool         b            = scr.TryDeserialize(new FastStreamReader(veryLongData), out string error);

            Assert.True(b, error);
            Assert.Null(error);
            Assert.Equal(expected, scr.Data);
        }
Пример #2
0
        [InlineData(new byte[] { 3, 0xba, 0xbb, 0xbc }, new byte[] { 0xba, 0xbb, 0xbc })] // 3 invalid OP codes
        public void TryDeserializeTest(byte[] data, byte[] expected)
        {
            PubkeyScript scr   = new PubkeyScript();
            bool         b     = scr.TryDeserialize(new FastStreamReader(data), out string error);
            FastStream   write = new FastStream(data.Length);

            scr.Serialize(write);

            Assert.True(b);
            Assert.Null(error);
            Assert.Equal(expected, scr.Data);
        }