public void Valid_block_makes_it_all_the_way()
        {
            Block newBlock = Build.A.Block.WithParent(_blockTree.Head).WithTotalDifficulty(_blockTree.Head.TotalDifficulty + 1).TestObject;

            _blockTree.SuggestBlock(newBlock);
            Thread.Sleep(1000);
            _blockchainProcessor.Received().Enqueue(newBlock, ProcessingOptions.IgnoreParentNotOnMainChain);
        }
示例#2
0
        public void Valid_block_with_transactions_makes_it_is_processed_normally_if_beam_syncing_finished()
        {
            ISyncModeSelector syncModeSelector = Substitute.For <ISyncModeSelector>();

            SetupBeamProcessor(syncModeSelector);
            syncModeSelector.Preparing += Raise.EventWith(new SyncModeChangedEventArgs(SyncMode.Beam, SyncMode.Full));
            syncModeSelector.Changing  += Raise.EventWith(new SyncModeChangedEventArgs(SyncMode.Beam, SyncMode.Full));
            syncModeSelector.Changed   += Raise.EventWith(new SyncModeChangedEventArgs(SyncMode.Beam, SyncMode.Full));

            EthereumEcdsa ethereumEcdsa = new EthereumEcdsa(MainnetSpecProvider.Instance, LimboLogs.Instance);
            Block         newBlock      = Build.A.Block.WithParent(_blockTree.Head).WithReceiptsRoot(new Keccak("0xeb82c315eaf2c2a5dfc1766b075263d80e8b3ab9cb690d5304cdf114fff26939")).WithTransactions(Build.A.Transaction.SignedAndResolved(ethereumEcdsa, TestItem.PrivateKeyA, 10000000).TestObject, Build.A.Transaction.SignedAndResolved(ethereumEcdsa, TestItem.PrivateKeyB, 10000000).TestObject).WithGasUsed(42000).WithTotalDifficulty(_blockTree.Head.TotalDifficulty + 1).TestObject;

            _blockTree.SuggestBlock(newBlock);
            Thread.Sleep(1000);
            _blockchainProcessor.DidNotReceiveWithAnyArgs().Process(newBlock, ProcessingOptions.Beam, NullBlockTracer.Instance);
            _blockchainProcessingQueue.Received().Enqueue(newBlock, ProcessingOptions.StoreReceipts);
        }