Ejemplo n.º 1
0
 public ChainInventoryMessage(byte[] data)
     : base(data)
 {
     try
     {
         this.type      = (byte)MessageTypes.MsgType.BLOCK_CHAIN_INVENTORY;
         this.inventory = Protocol.ChainInventory.Parser.ParseFrom(data);
     }
     catch (System.Exception e)
     {
         Logger.Error(e.Message);
     }
 }
Ejemplo n.º 2
0
        public ChainInventoryMessage(List <BlockCapsule.BlockId> ids, long remain_num)
        {
            this.inventory = new Protocol.ChainInventory();
            ids.ForEach(id =>
            {
                Protocol.ChainInventory.Types.BlockId b = new Protocol.ChainInventory.Types.BlockId();
                b.Hash   = id.Hash.ToByteString();
                b.Number = id.Num;
                this.inventory.Ids.Add(b);
            });

            this.inventory.RemainNum = remain_num;
            this.type = (byte)MessageTypes.MsgType.BLOCK_CHAIN_INVENTORY;
            this.data = this.inventory.ToByteArray();
        }