Example #1
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));
        }
Example #2
0
        public override Task <ReceiptsSyncBatch?> PrepareRequest()
        {
            ReceiptsSyncBatch?batch = null;

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

                // Array.Reverse(infos);
            }

            _receiptStorage.LowestInsertedReceiptBlockNumber = _syncStatusList.LowestInsertWithoutGaps;

            return(Task.FromResult(batch));
        }