Esempio n. 1
0
 public void Setup()
 {
     _mergeConfig = new MergeConfig()
     {
         Enabled = true, BlockAuthorAccount = TestItem.AddressA.ToString()
     };
     _context = Build.ContextWithMocks();
     _context.ConfigProvider.GetConfig <IMergeConfig>().Returns(_mergeConfig);
     _context.ConfigProvider.GetConfig <ISyncConfig>().Returns(new SyncConfig());
     _context.MemDbFactory            = new MemDbFactory();
     _context.BlockProducerEnvFactory = new BlockProducerEnvFactory(
         _context.DbProvider !,
         _context.BlockTree !,
         _context.ReadOnlyTrieStore !,
         _context.SpecProvider !,
         _context.BlockValidator !,
         _context.RewardCalculatorSource !,
         _context.ReceiptStorage !,
         _context.BlockPreprocessor !,
         _context.TxPool !,
         _context.TransactionComparerProvider,
         new MiningConfig(),
         _context.LogManager !);
     _plugin = new MergePlugin();
 }
Esempio n. 2
0
 public void Setup()
 {
     _mergeConfig = new MergeConfig()
     {
         Enabled = true, BlockAuthorAccount = TestItem.AddressA.ToString()
     };
     _context = Build.ContextWithMocks();
     _context.ConfigProvider.GetConfig <IMergeConfig>().Returns(_mergeConfig);
     _context.ConfigProvider.GetConfig <ISyncConfig>().Returns(new SyncConfig());
     _context.MemDbFactory = new MemDbFactory();
     _plugin = new MergePlugin();
 }
        public void Setup()
        {
            _mergeConfig = new MergeConfig()
            {
                Enabled = true
            };
            MiningConfig?  miningConfig  = new() { Enabled = true };
            IJsonRpcConfig jsonRpcConfig = new JsonRpcConfig()
            {
                Enabled = true, EnabledModules = new[] { "engine" }
            };

            _context = Build.ContextWithMocks();
            _context.SealEngineType = SealEngineType.Clique;
            _context.ConfigProvider.GetConfig <IMergeConfig>().Returns(_mergeConfig);
            _context.ConfigProvider.GetConfig <ISyncConfig>().Returns(new SyncConfig());
            _context.ConfigProvider.GetConfig <IMiningConfig>().Returns(miningConfig);
            _context.ConfigProvider.GetConfig <IJsonRpcConfig>().Returns(jsonRpcConfig);
            _context.BlockProcessingQueue?.IsEmpty.Returns(true);
            _context.MemDbFactory            = new MemDbFactory();
            _context.BlockProducerEnvFactory = new BlockProducerEnvFactory(
                _context.DbProvider !,
                _context.BlockTree !,
                _context.ReadOnlyTrieStore !,
                _context.SpecProvider !,
                _context.BlockValidator !,
                _context.RewardCalculatorSource !,
                _context.ReceiptStorage !,
                _context.BlockPreprocessor !,
                _context.TxPool !,
                _context.TransactionComparerProvider,
                miningConfig,
                _context.LogManager !);
            _context.ChainSpec !.Clique = new CliqueParameters()
            {
                Epoch  = CliqueConfig.Default.Epoch,
                Period = CliqueConfig.Default.BlockPeriod
            };
            _plugin = new MergePlugin();

            _consensusPlugin = new();
        }