Exemple #1
0
        private int InsertReceipts(ReceiptsSyncBatch batch)
        {
            bool hasBreachedProtocol = false;
            int  validResponsesCount = 0;

            for (int i = 0; i < batch.Infos.Length; i++)
            {
                BlockInfo?blockInfo = batch.Infos[i];
                TxReceipt[]? receipts = (batch.Response?.Length ?? 0) <= i
                    ? null
                    : (batch.Response ![i] ?? Array.Empty <TxReceipt>());
Exemple #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));
        }