Example #1
0
 public TransactionMessage(byte[] raw_data)
     : base(raw_data)
 {
     this.transaction = new TransactionCapsule(GetCodedInputStream(data));
     this.type        = (byte)MessageTypes.MsgType.TX;
     if (Message.IsFilter)
     {
         CompareBytes(data, this.transaction.Data);
         TransactionCapsule.ValidContractProto(this.transaction.Instance.RawData.Contract[0]);
     }
 }
Example #2
0
 public TransactionsMessage(byte[] data)
     : base(data)
 {
     this.type         = (byte)MessageTypes.MsgType.TXS;
     this.transactions = Transactions.Parser.ParseFrom(data);
     if (IsFilter)
     {
         CompareBytes(data, this.transactions.ToByteArray());
         TransactionCapsule.ValidContractProto(new List <Transaction>(this.transactions.Transactions_));
     }
 }
Example #3
0
 public BlockMessage(byte[] raw_data)
     : base(raw_data)
 {
     this.type  = (byte)MessageTypes.MsgType.BLOCK;
     this.block = new BlockCapsule(GetCodedInputStream(data));
     if (Message.IsFilter)
     {
         Message.CompareBytes(data, block.Data);
         TransactionCapsule.ValidContractProto(new List <Protocol.Transaction>(block.Instance.Transactions));
     }
 }
Example #4
0
        public BlocksMessage(byte[] data)
            : base(data)
        {
            this.type = (byte)MessageTypes.MsgType.BLOCKS;

            Items items = Items.Parser.ParseFrom(GetCodedInputStream(data));

            if (items.Type == Items.Types.ItemType.Block)
            {
                blocks = new List <Protocol.Block>(items.Blocks);
            }

            if (IsFilter && blocks.IsNotNullOrEmpty())
            {
                CompareBytes(data, items.ToByteArray());
                foreach (Block block in blocks)
                {
                    TransactionCapsule.ValidContractProto(new List <Protocol.Transaction>(block.Transactions));
                }
            }
        }