Exemplo n.º 1
0
        private List <ChainedHeaderBlock> AddBlocksToBlockStoreQueue(int blocksCount = 500)
        {
            var chainedHeaderBlocks = new List <ChainedHeaderBlock>(blocksCount);

            for (int i = 0; i < blocksCount; i++)
            {
                Block block = TransactionsHelper.CreateDummyBlockWithTransaction(this.network, this.chainIndexer.Tip);

                var header = new ChainedHeader(block.Header, block.GetHash(), this.chainIndexer.Tip);

                this.chainIndexer.SetTip(header);
                chainedHeaderBlocks.Add(new ChainedHeaderBlock(block, header));
            }

            foreach (ChainedHeaderBlock chainedHeaderBlock in chainedHeaderBlocks)
            {
                this.blockStoreQueue.AddToPending(chainedHeaderBlock);
            }

            return(chainedHeaderBlocks);
        }