示例#1
0
        private int InsertBodies(BodiesSyncBatch batch)
        {
            bool hasBreachedProtocol = false;
            int  validResponsesCount = 0;

            for (int i = 0; i < batch.Infos.Length; i++)
            {
                BlockInfo?blockInfo = batch.Infos[i];
                BlockBody?body      = (batch.Response?.Length ?? 0) <= i
                    ? null
                    : batch.Response ![i];
示例#2
0
        public override Task <BodiesSyncBatch?> PrepareRequest()
        {
            BodiesSyncBatch?batch = null;

            if (ShouldBuildANewBatch())
            {
                BlockInfo[] infos = new BlockInfo[_requestSize];
                _syncStatusList.GetInfosForBatch(infos);
                if (infos[0] != null)
                {
                    batch             = new BodiesSyncBatch(infos);
                    batch.MinNumber   = infos[0].BlockNumber;
                    batch.Prioritized = true;
                }
            }

            _blockTree.LowestInsertedBodyNumber = _syncStatusList.LowestInsertWithoutGaps;

            return(Task.FromResult(batch));
        }