Esempio n. 1
0
 public PowMining(
     IAsyncLoopFactory asyncLoopFactory,
     IBlockProvider blockProvider,
     IConsensusLoop consensusLoop,
     ConcurrentChain chain,
     IDateTimeProvider dateTimeProvider,
     ITxMempool mempool,
     MempoolSchedulerLock mempoolLock,
     Network network,
     INodeLifetime nodeLifetime,
     ILoggerFactory loggerFactory)
 {
     this.asyncLoopFactory = asyncLoopFactory;
     this.blockProvider    = blockProvider;
     this.chain            = chain;
     this.consensusLoop    = consensusLoop;
     this.dateTimeProvider = dateTimeProvider;
     this.loggerFactory    = loggerFactory;
     this.logger           = loggerFactory.CreateLogger(this.GetType().FullName);
     this.mempool          = mempool;
     this.mempoolLock      = mempoolLock;
     this.network          = network;
     this.nodeLifetime     = nodeLifetime;
     this.miningCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(new[] { this.nodeLifetime.ApplicationStopping });
 }
Esempio n. 2
0
 public SmartContractFeature(IConsensusLoop consensusLoop, ILoggerFactory loggerFactory, Network network, ContractStateRepositoryRoot stateRoot)
 {
     this.consensusLoop = consensusLoop;
     this.logger        = loggerFactory.CreateLogger(this.GetType().FullName);
     this.network       = network;
     this.stateRoot     = stateRoot;
 }
 public FullNodeController(
     ILoggerFactory loggerFactory,
     IPooledTransaction pooledTransaction = null,
     IPooledGetUnspentTransaction pooledGetUnspentTransaction = null,
     IGetUnspentTransaction getUnspentTransaction             = null,
     INetworkDifficulty networkDifficulty = null,
     IConsensusLoop consensusLoop         = null,
     IFullNode fullNode        = null,
     NodeSettings nodeSettings = null,
     Network network           = null,
     ConcurrentChain chain     = null,
     IChainState chainState    = null,
     Connection.IConnectionManager connectionManager = null)
     : base(
         fullNode: fullNode,
         nodeSettings: nodeSettings,
         network: network,
         chain: chain,
         chainState: chainState,
         connectionManager: connectionManager)
 {
     this.logger                      = loggerFactory.CreateLogger(this.GetType().FullName);
     this.pooledTransaction           = pooledTransaction;
     this.pooledGetUnspentTransaction = pooledGetUnspentTransaction;
     this.getUnspentTransaction       = getUnspentTransaction;
     this.networkDifficulty           = networkDifficulty;
     this.consensusLoop               = consensusLoop;
 }
Esempio n. 4
0
        public ConsensusStats(
            CoinView coinView,
            IConsensusLoop consensusLoop,
            IInitialBlockDownloadState initialBlockDownloadState,
            ConcurrentChain chain,
            IConnectionManager connectionManager,
            IDateTimeProvider dateTimeProvider,
            ILoggerFactory loggerFactory)
        {
            CoinViewStack stack = new CoinViewStack(coinView);

            this.cache   = stack.Find <CachedCoinView>();
            this.dbreeze = stack.Find <DBreezeCoinView>();
            this.bottom  = stack.Bottom;

            this.consensusLoop   = consensusLoop;
            this.lookaheadPuller = this.consensusLoop.Puller as LookaheadBlockPuller;

            this.lastSnapshot              = consensusLoop.Validator.PerformanceCounter.Snapshot();
            this.lastSnapshot2             = this.dbreeze?.PerformanceCounter.Snapshot();
            this.lastSnapshot3             = this.cache?.PerformanceCounter.Snapshot();
            this.initialBlockDownloadState = initialBlockDownloadState;
            this.chain             = chain;
            this.connectionManager = connectionManager;
            this.dateTimeProvider  = dateTimeProvider;
            this.logger            = loggerFactory.CreateLogger(this.GetType().FullName);
        }
Esempio n. 5
0
 public ConsensusController(ILoggerFactory loggerFactory, IChainState chainState = null,
                            IConsensusLoop consensusLoop = null, ConcurrentChain chain = null)
     : base(chainState: chainState, chain: chain)
 {
     this.logger        = loggerFactory.CreateLogger(this.GetType().FullName);
     this.ConsensusLoop = consensusLoop;
 }
Esempio n. 6
0
        protected BlockDefinition(
            IConsensusLoop consensusLoop,
            IDateTimeProvider dateTimeProvider,
            ILoggerFactory loggerFactory,
            ITxMempool mempool,
            MempoolSchedulerLock mempoolLock,
            Network network,
            BlockDefinitionOptions options = null)
        {
            this.ConsensusLoop    = consensusLoop;
            this.DateTimeProvider = dateTimeProvider;
            this.logger           = loggerFactory.CreateLogger(this.GetType().FullName);
            this.Mempool          = mempool;
            this.MempoolLock      = mempoolLock;
            this.Network          = network;

            this.Options         = options ?? new BlockDefinitionOptions();
            this.BlockMinFeeRate = this.Options.BlockMinFeeRate;

            // Limit weight to between 4K and MAX_BLOCK_WEIGHT-4K for sanity.
            this.BlockMaxWeight = (uint)Math.Max(4000, Math.Min(PowMining.DefaultBlockMaxWeight - 4000, this.Options.BlockMaxWeight));

            // Limit size to between 1K and MAX_BLOCK_SERIALIZED_SIZE-1K for sanity.
            this.BlockMaxSize = (uint)Math.Max(1000, Math.Min(network.Consensus.Option <PowConsensusOptions>().MaxBlockSerializedSize - 1000, this.Options.BlockMaxSize));

            // Whether we need to account for byte usage (in addition to weight usage).
            this.NeedSizeAccounting = (this.BlockMaxSize < network.Consensus.Option <PowConsensusOptions>().MaxBlockSerializedSize - 1000);

            this.Configure();
        }
Esempio n. 7
0
        public ConsensusFeature(
            DBreezeCoinView dBreezeCoinView,
            Network network,
            LookaheadBlockPuller blockPuller,
            ICoinView coinView,
            IChainState chainState,
            IConnectionManager connectionManager,
            Signals.Signals signals,
            IConsensusLoop consensusLoop,
            NodeDeployments nodeDeployments,
            ILoggerFactory loggerFactory,
            ConsensusStats consensusStats,
            IConsensusRules consensusRules,
            NodeSettings nodeSettings,
            ConsensusSettings consensusSettings,
            StakeChainStore stakeChain = null)
        {
            this.dBreezeCoinView   = dBreezeCoinView;
            this.blockPuller       = blockPuller;
            this.coinView          = coinView;
            this.chainState        = chainState;
            this.connectionManager = connectionManager;
            this.signals           = signals;
            this.consensusLoop     = consensusLoop;
            this.nodeDeployments   = nodeDeployments;
            this.stakeChain        = stakeChain;
            this.logger            = loggerFactory.CreateLogger(this.GetType().FullName);
            this.loggerFactory     = loggerFactory;
            this.consensusStats    = consensusStats;
            this.consensusSettings = consensusSettings;
            this.consensusRules    = consensusRules;

            this.chainState.MaxReorgLength = network.Consensus.MaxReorgLength;
        }
Esempio n. 8
0
        public SmartContractPosPowBlockDefinition(
            IBlockBufferGenerator blockBufferGenerator,
            ICoinView coinView,
            IConsensusLoop consensusLoop,
            IDateTimeProvider dateTimeProvider,
            ISmartContractExecutorFactory executorFactory,
            ILoggerFactory loggerFactory,
            ITxMempool mempool,
            MempoolSchedulerLock mempoolLock,
            MinerSettings minerSettings,
            Network network,
            ISenderRetriever senderRetriever,
            IStakeChain stakeChain,
            IStakeValidator stakeValidator,
            IContractStateRoot stateRoot)
            : base(consensusLoop, dateTimeProvider, loggerFactory, mempool, mempoolLock, minerSettings, network)
        {
            this.coinView        = coinView;
            this.executorFactory = executorFactory;
            this.logger          = loggerFactory.CreateLogger(this.GetType().FullName);
            this.senderRetriever = senderRetriever;
            this.stakeChain      = stakeChain;
            this.stakeValidator  = stakeValidator;
            this.stateRoot       = stateRoot;

            // When building smart contract blocks, we will be generating and adding both transactions to the block and txouts to the coinbase.
            // At the moment, these generated objects aren't accounted for in the block size and weight accounting.
            // This means that if blocks started getting full, this miner could start generating blocks greater than the max consensus block size.
            // To avoid this without significantly overhauling the BlockDefinition, for now we just lower the block size by a percentage buffer.
            // If in the future blocks are being built over the size limit and you need an easy fix, just increase the size of this buffer.
            this.Options = blockBufferGenerator.GetOptionsWithBuffer(this.Options);
        }
        public void TestSegwit_MinedOnCore_ActivatedOn_StratisNode()
        {
            using (NodeBuilder builder = NodeBuilder.Create(this))
            {
                CoreNode coreNode = builder.CreateBitcoinCoreNode(version: "0.15.1");

                coreNode.ConfigParameters.AddOrReplace("debug", "1");
                coreNode.ConfigParameters.AddOrReplace("printtoconsole", "0");
                coreNode.Start();

                CoreNode stratisNode = builder.CreateStratisPowNode(start: true);

                RPCClient stratisNodeRpc = stratisNode.CreateRPCClient();
                RPCClient coreRpc        = coreNode.CreateRPCClient();

                coreRpc.AddNode(stratisNode.Endpoint, false);
                stratisNodeRpc.AddNode(coreNode.Endpoint, false);

                // core (in version 0.15.1) only mines segwit blocks above a certain height on regtest
                // future versions of core will change that behaviour so this test may need to be changed in the future
                // see issue for more details https://github.com/stratisproject/StratisBitcoinFullNode/issues/1028
                BIP9DeploymentsParameters prevSegwitDeployment = Network.RegTest.Consensus.BIP9Deployments[BIP9Deployments.Segwit];
                Network.RegTest.Consensus.BIP9Deployments[BIP9Deployments.Segwit] = new BIP9DeploymentsParameters(1, 0, DateTime.Now.AddDays(50).ToUnixTimestamp());

                try
                {
                    // generate 450 blocks, block 431 will be segwit activated.
                    coreRpc.Generate(450);

                    TestHelper.WaitLoop(() => stratisNode.CreateRPCClient().GetBestBlockHash() == coreNode.CreateRPCClient().GetBestBlockHash());

                    // segwit activation on Bitcoin regtest.
                    // - On regtest deployment state changes every 144 block, the threshold for activating a rule is 108 blocks.
                    // segwit deployment status should be:
                    // - Defined up to block 142.
                    // - Started at block 143 to block 286 .
                    // - LockedIn 287 (as segwit should already be signaled in blocks).
                    // - Active at block 431.

                    IConsensusLoop   consensusLoop       = stratisNode.FullNode.NodeService <IConsensusLoop>();
                    ThresholdState[] segwitDefinedState  = consensusLoop.NodeDeployments.BIP9.GetStates(stratisNode.FullNode.Chain.GetBlock(142));
                    ThresholdState[] segwitStartedState  = consensusLoop.NodeDeployments.BIP9.GetStates(stratisNode.FullNode.Chain.GetBlock(143));
                    ThresholdState[] segwitLockedInState = consensusLoop.NodeDeployments.BIP9.GetStates(stratisNode.FullNode.Chain.GetBlock(287));
                    ThresholdState[] segwitActiveState   = consensusLoop.NodeDeployments.BIP9.GetStates(stratisNode.FullNode.Chain.GetBlock(431));

                    // check that segwit is got activated at block 431
                    Assert.Equal(ThresholdState.Defined, segwitDefinedState.GetValue((int)BIP9Deployments.Segwit));
                    Assert.Equal(ThresholdState.Started, segwitStartedState.GetValue((int)BIP9Deployments.Segwit));
                    Assert.Equal(ThresholdState.LockedIn, segwitLockedInState.GetValue((int)BIP9Deployments.Segwit));
                    Assert.Equal(ThresholdState.Active, segwitActiveState.GetValue((int)BIP9Deployments.Segwit));
                }
                finally
                {
                    Network.RegTest.Consensus.BIP9Deployments[BIP9Deployments.Segwit] = prevSegwitDeployment;
                }
            }
        }
 public ConsensusManager(IConsensusLoop consensusLoop = null, IDateTimeProvider dateTimeProvider = null, NodeSettings nodeSettings = null, Network network = null,
                         IPowConsensusValidator consensusValidator = null)
 {
     this.ConsensusLoop      = consensusLoop;
     this.DateTimeProvider   = dateTimeProvider;
     this.NodeSettings       = nodeSettings;
     this.Network            = network;
     this.ConsensusValidator = consensusValidator;
 }
Esempio n. 11
0
        public ConsensusController(ILoggerFactory loggerFactory, IChainState chainState,
                                   IConsensusLoop consensusLoop, ConcurrentChain chain)
            : base(chainState: chainState, chain: chain)
        {
            Guard.NotNull(loggerFactory, nameof(loggerFactory));
            Guard.NotNull(consensusLoop, nameof(consensusLoop));
            Guard.NotNull(chain, nameof(chain));
            Guard.NotNull(chainState, nameof(chainState));

            this.logger        = loggerFactory.CreateLogger(this.GetType().FullName);
            this.ConsensusLoop = consensusLoop;
        }
 public PowBlockAssembler(
     IConsensusLoop consensusLoop,
     IDateTimeProvider dateTimeProvider,
     ILoggerFactory loggerFactory,
     ITxMempool mempool,
     MempoolSchedulerLock mempoolLock,
     Network network,
     AssemblerOptions options = null)
     : base(consensusLoop, dateTimeProvider, loggerFactory, mempool, mempoolLock, network)
 {
     this.logger = loggerFactory.CreateLogger(this.GetType().FullName);
 }
Esempio n. 13
0
 public PowTestBlockAssembler(
     IConsensusLoop consensusLoop,
     IDateTimeProvider dateTimeProvider,
     ILoggerFactory loggerFactory,
     ITxMempool mempool,
     MempoolSchedulerLock mempoolLock,
     Network network,
     AssemblerOptions options = null)
     : base(consensusLoop, dateTimeProvider, loggerFactory, mempool, mempoolLock, network, options)
 {
     this.block = this.BlockTemplate.Block;
 }
Esempio n. 14
0
 public PowTestBlockDefinition(
     IConsensusLoop consensusLoop,
     IDateTimeProvider dateTimeProvider,
     ILoggerFactory loggerFactory,
     ITxMempool mempool,
     MempoolSchedulerLock mempoolLock,
     Network network,
     IConsensusRules consensusRules,
     BlockDefinitionOptions options = null)
     : base(consensusLoop, dateTimeProvider, loggerFactory, mempool, mempoolLock, network, consensusRules)
 {
     this.block = this.BlockTemplate.Block;
 }
Esempio n. 15
0
 public PowTestBlockAssembler(
     IConsensusLoop consensusLoop,
     Network network,
     MempoolSchedulerLock mempoolLock,
     ITxMempool mempool,
     IDateTimeProvider dateTimeProvider,
     ChainedBlock chainTip,
     ILoggerFactory loggerFactory,
     AssemblerOptions options = null) :
     base(chainTip, consensusLoop, dateTimeProvider, loggerFactory, mempool, mempoolLock, network, options)
 {
     base.pblock = this.pblocktemplate.Block;
 }
 public PosTestBlockAssembler(
     IConsensusLoop consensusLoop,
     Network network,
     MempoolSchedulerLock mempoolLock,
     ITxMempool mempool,
     IDateTimeProvider dateTimeProvider,
     IStakeChain stakeChain,
     IStakeValidator stakeValidator,
     ILoggerFactory loggerFactory)
     : base(consensusLoop, dateTimeProvider, loggerFactory, mempool, mempoolLock, network, stakeChain, stakeValidator)
 {
     base.block = this.BlockTemplate.Block;
 }
        /// <summary>
        /// Creates a proof of work block assembler.
        /// </summary>
        /// <param name="consensusLoop">Consensus loop.</param>
        /// <param name="consensusRules"></param>
        /// <param name="dateTimeProvider">Date and time provider.</param>
        /// <param name="mempool">Memory pool for transactions.</param>
        /// <param name="mempoolLock">Async lock for memory pool.</param>
        /// <param name="network">Network running on.</param>
        /// <returns>Proof of work block assembler.</returns>
        private static PowBlockDefinition CreatePowBlockAssembler(IConsensusLoop consensusLoop, IConsensusRules consensusRules, IDateTimeProvider dateTimeProvider, LoggerFactory loggerFactory, TxMempool mempool, MempoolSchedulerLock mempoolLock, Network network)
        {
            var options = new BlockDefinitionOptions
            {
                BlockMaxWeight = network.Consensus.Option <PowConsensusOptions>().MaxBlockWeight,
                BlockMaxSize   = network.Consensus.Option <PowConsensusOptions>().MaxBlockSerializedSize
            };

            var blockMinFeeRate = new FeeRate(PowMining.DefaultBlockMinTxFee);

            options.BlockMinFeeRate = blockMinFeeRate;

            return(new PowBlockDefinition(consensusLoop, dateTimeProvider, loggerFactory, mempool, mempoolLock, network, consensusRules, options));
        }
Esempio n. 18
0
 public PosTestBlockAssembler(IConsensusLoop consensusLoop,
                              Network network,
                              MempoolSchedulerLock mempoolLock,
                              ITxMempool mempool,
                              IDateTimeProvider dateTimeProvider,
                              IStakeChain stakeChain,
                              IStakeValidator stakeValidator,
                              ChainedBlock chainTip,
                              ILoggerFactory loggerFactory,
                              AssemblerOptions options = null) :
     base(consensusLoop, network, mempoolLock, mempool, dateTimeProvider, stakeChain, stakeValidator, chainTip, loggerFactory, options)
 {
     base.pblock = this.pblocktemplate.Block;
 }
Esempio n. 19
0
        public void TestSegwitActivation()
        {
            using (NodeBuilder builder = NodeBuilder.Create(version: "0.15.1"))
            {
                CoreNode coreNode = builder.CreateNode(false);

                coreNode.ConfigParameters.AddOrReplace("debug", "1");
                coreNode.ConfigParameters.AddOrReplace("printtoconsole", "0");
                coreNode.Start();

                CoreNode node1 = builder.CreateStratisPowNode(true, fullNodeBuilder =>
                {
                    fullNodeBuilder
                    .UseConsensus()
                    .UseBlockStore()
                    .UseMempool()
                    .UseBlockNotification()
                    .UseTransactionNotification()
                    .AddMining()
                    .UseWallet()
                    .UseApi()
                    .AddRPC();
                });

                WalletManager wm1 = node1.FullNode.NodeService <IWalletManager>() as WalletManager;
                wm1.CreateWallet("Test1", "alice1");

                RPCClient rpc1    = node1.CreateRPCClient();
                RPCClient coreRpc = coreNode.CreateRPCClient();

                coreRpc.AddNode(node1.Endpoint, false);
                rpc1.AddNode(coreNode.Endpoint, false);

                coreRpc.Generate(450);

                BIP9DeploymentsArray bip9Constants = node1.FullNode.Network.Consensus.BIP9Deployments;
                IConsensusLoop       consensusLoop = node1.FullNode.NodeService <IConsensusLoop>();
                ThresholdState[]     bip9State     = consensusLoop.NodeDeployments.BIP9.GetStates(node1.FullNode.Chain.Tip.Previous);

                Money     amount       = new Money(5.0m, MoneyUnit.BTC);
                HdAddress destination1 = wm1.GetUnusedAddress(new WalletAccountReference("alice1", "account 0"));

                coreRpc.SendToAddress(BitcoinAddress.Create(destination1.Address, Network.RegTest), amount);

                coreRpc.Generate(1);

                Assert.Equal(ThresholdState.Active, bip9State.GetValue((int)BIP9Deployments.Segwit));
            }
        }
Esempio n. 20
0
 public PowBlockDefinition(
     IConsensusLoop consensusLoop,
     IDateTimeProvider dateTimeProvider,
     ILoggerFactory loggerFactory,
     ITxMempool mempool,
     MempoolSchedulerLock mempoolLock,
     MinerSettings minerSettings,
     Network network,
     IConsensusRules consensusRules,
     BlockDefinitionOptions options = null)
     : base(consensusLoop, dateTimeProvider, loggerFactory, mempool, mempoolLock, minerSettings, network)
 {
     this.consensusRules = consensusRules;
     this.logger         = loggerFactory.CreateLogger(this.GetType().FullName);
 }
 public PosPowBlockDefinition(
     IConsensusLoop consensusLoop,
     IDateTimeProvider dateTimeProvider,
     ILoggerFactory loggerFactory,
     ITxMempool mempool,
     MempoolSchedulerLock mempoolLock,
     Network network,
     IStakeChain stakeChain,
     IStakeValidator stakeValidator)
     : base(consensusLoop, dateTimeProvider, loggerFactory, mempool, mempoolLock, network, new BlockDefinitionOptions() { IsProofOfStake = false })
 {
     this.logger         = loggerFactory.CreateLogger(this.GetType().FullName);
     this.stakeChain     = stakeChain;
     this.stakeValidator = stakeValidator;
 }
        public PowBlockAssembler(
            IConsensusLoop consensusLoop,
            Network network,
            MempoolSchedulerLock mempoolLock,
            ITxMempool mempool,
            IDateTimeProvider dateTimeProvider,
            ChainedBlock chainTip,
            ILoggerFactory loggerFactory,
            AssemblerOptions options = null)
        {
            this.logger = loggerFactory.CreateLogger(this.GetType().FullName);

            options = options ?? new AssemblerOptions();
            this.blockMinFeeRate = options.BlockMinFeeRate;

            // Limit weight to between 4K and MAX_BLOCK_WEIGHT-4K for sanity.
            this.blockMaxWeight = (uint)Math.Max(4000, Math.Min(PowMining.DefaultBlockMaxWeight - 4000, options.BlockMaxWeight));

            // Limit size to between 1K and MAX_BLOCK_SERIALIZED_SIZE-1K for sanity.
            this.blockMaxSize = (uint)Math.Max(1000, Math.Min(network.Consensus.Option <PowConsensusOptions>().MaxBlockSerializedSize - 1000, options.BlockMaxSize));

            // Whether we need to account for byte usage (in addition to weight usage).
            this.needSizeAccounting = (this.blockMaxSize < network.Consensus.Option <PowConsensusOptions>().MaxBlockSerializedSize - 1000);

            this.consensusLoop    = consensusLoop;
            this.mempoolLock      = mempoolLock;
            this.mempool          = mempool;
            this.dateTimeProvider = dateTimeProvider;
            this.options          = options;
            this.network          = network;

            this.inBlock = new TxMempool.SetEntries();

            // Reserve space for coinbase tx.
            this.blockSize       = 1000;
            this.blockWeight     = 4000;
            this.blockSigOpsCost = 400;
            this.fIncludeWitness = false;

            // These counters do not include coinbase tx.
            this.blockTx = 0;
            this.fees    = 0;

            this.ChainTip       = chainTip;
            this.pblocktemplate = new BlockTemplate {
                Block = new Block(), VTxFees = new List <Money>()
            };
        }
Esempio n. 23
0
 public PosBlockDefinition(
     IConsensusLoop consensusLoop,
     IDateTimeProvider dateTimeProvider,
     ILoggerFactory loggerFactory,
     ITxMempool mempool,
     MempoolSchedulerLock mempoolLock,
     MinerSettings minerSettings,
     Network network,
     IStakeChain stakeChain,
     IStakeValidator stakeValidator)
     : base(consensusLoop, dateTimeProvider, loggerFactory, mempool, mempoolLock, minerSettings, network)
 {
     this.logger         = loggerFactory.CreateLogger(this.GetType().FullName);
     this.stakeChain     = stakeChain;
     this.stakeValidator = stakeValidator;
 }
Esempio n. 24
0
 public SmartContractBlockDefinition(
     CoinView coinView,
     IConsensusLoop consensusLoop,
     IDateTimeProvider dateTimeProvider,
     ISmartContractExecutorFactory executorFactory,
     ILoggerFactory loggerFactory,
     ITxMempool mempool,
     MempoolSchedulerLock mempoolLock,
     Network network,
     ContractStateRepositoryRoot stateRoot)
     : base(consensusLoop, dateTimeProvider, loggerFactory, mempool, mempoolLock, network)
 {
     this.coinView        = coinView;
     this.executorFactory = executorFactory;
     this.logger          = loggerFactory.CreateLogger(this.GetType());
     this.stateRoot       = stateRoot;
 }
Esempio n. 25
0
 public PosBlockAssembler(
     IConsensusLoop consensusLoop,
     Network network,
     MempoolSchedulerLock mempoolLock,
     ITxMempool mempool,
     IDateTimeProvider dateTimeProvider,
     IStakeChain stakeChain,
     IStakeValidator stakeValidator,
     ChainedBlock chainTip,
     ILoggerFactory loggerFactory,
     AssemblerOptions options = null)
     : base(consensusLoop, network, mempoolLock, mempool, dateTimeProvider, chainTip, loggerFactory, options)
 {
     this.logger         = loggerFactory.CreateLogger(this.GetType().FullName);
     this.stakeChain     = stakeChain;
     this.stakeValidator = stakeValidator;
 }
Esempio n. 26
0
 public PowMining(
     IConsensusLoop consensusLoop,
     ConcurrentChain chain,
     Network network,
     IAssemblerFactory blockAssemblerFactory,
     INodeLifetime nodeLifetime,
     IAsyncLoopFactory asyncLoopFactory,
     ILoggerFactory loggerFactory)
 {
     this.consensusLoop         = consensusLoop;
     this.chain                 = chain;
     this.network               = network;
     this.blockAssemblerFactory = blockAssemblerFactory;
     this.nodeLifetime          = nodeLifetime;
     this.asyncLoopFactory      = asyncLoopFactory;
     this.logger                = loggerFactory.CreateLogger(this.GetType().FullName);
 }
Esempio n. 27
0
 public PowAssemblerFactory(
     IConsensusLoop consensusLoop,
     Network network,
     MempoolSchedulerLock mempoolLock,
     ITxMempool mempool,
     IDateTimeProvider dateTimeProvider,
     ILoggerFactory loggerFactory,
     IStakeChain stakeChain = null)
 {
     this.consensusLoop    = consensusLoop;
     this.network          = network;
     this.mempoolLock      = mempoolLock;
     this.mempool          = mempool;
     this.dateTimeProvider = dateTimeProvider;
     this.stakeChain       = stakeChain;
     this.loggerFactory    = loggerFactory;
     this.logger           = loggerFactory.CreateLogger(this.GetType().FullName);
 }
Esempio n. 28
0
 public SmartContractBlockDefinition(
     ICoinView coinView,
     IConsensusLoop consensusLoop,
     IDateTimeProvider dateTimeProvider,
     ISmartContractExecutorFactory executorFactory,
     ILoggerFactory loggerFactory,
     ITxMempool mempool,
     MempoolSchedulerLock mempoolLock,
     MinerSettings minerSettings,
     Network network,
     ContractStateRepositoryRoot stateRoot)
     : base(consensusLoop, dateTimeProvider, loggerFactory, mempool, mempoolLock, minerSettings, network)
 {
     this.coinView        = coinView;
     this.executorFactory = executorFactory;
     this.logger          = loggerFactory.CreateLogger(this.GetType());
     this.stateRoot       = stateRoot;
     this.refundOutputs   = new List <TxOut>();
     this.receipts        = new List <Receipt>();
 }
 public SmartContractsController(
     IBroadcasterManager broadcasterManager,
     IConsensusLoop consensus,
     IDateTimeProvider dateTimeProvider,
     ILoggerFactory loggerFactory,
     Network network,
     ISmartContractReceiptStorage receiptStorage,
     ContractStateRepositoryRoot stateRoot,
     IWalletManager walletManager,
     IWalletTransactionHandler walletTransactionHandler)
 {
     this.receiptStorage           = receiptStorage;
     this.stateRoot                = stateRoot;
     this.walletTransactionHandler = walletTransactionHandler;
     this.logger             = loggerFactory.CreateLogger(this.GetType().FullName);
     this.network            = network;
     this.coinType           = (CoinType)network.Consensus.CoinType;
     this.walletManager      = walletManager;
     this.broadcasterManager = broadcasterManager;
 }
 public SmartContractPosPowBlockDefinition(
     ICoinView coinView,
     IConsensusLoop consensusLoop,
     IDateTimeProvider dateTimeProvider,
     ISmartContractExecutorFactory executorFactory,
     ILoggerFactory loggerFactory,
     ITxMempool mempool,
     MempoolSchedulerLock mempoolLock,
     MinerSettings minerSettings,
     Network network,
     IStakeChain stakeChain,
     IStakeValidator stakeValidator,
     ContractStateRepositoryRoot stateRoot)
     : base(consensusLoop, dateTimeProvider, loggerFactory, mempool, mempoolLock, minerSettings, network)
 {
     this.coinView        = coinView;
     this.executorFactory = executorFactory;
     this.logger          = loggerFactory.CreateLogger(this.GetType().FullName);
     this.stakeChain      = stakeChain;
     this.stakeValidator  = stakeValidator;
     this.stateRoot       = stateRoot;
 }