示例#1
0
        public PosMinting(ConsensusLoop consensusLoop, ConcurrentChain chain, Network network, ConnectionManager connection,
                          IDateTimeProvider dateTimeProvider, AssemblerFactory blockAssemblerFactory, BlockRepository blockRepository,
                          BlockStore.ChainBehavior.ChainState chainState, Signals signals, FullNode.CancellationProvider cancellationProvider,
                          NodeSettings settings, CoinView coinView, StakeChain stakeChain)
        {
            this.consensusLoop         = consensusLoop;
            this.chain                 = chain;
            this.network               = network;
            this.connection            = connection;
            this.dateTimeProvider      = dateTimeProvider;
            this.blockAssemblerFactory = blockAssemblerFactory;
            this.blockRepository       = blockRepository;
            this.chainState            = chainState;
            this.signals               = signals;
            this.cancellationProvider  = cancellationProvider;
            this.settings              = settings;
            this.coinView              = coinView;
            this.stakeChain            = stakeChain;

            this.minerSleep = 500;                                                                          // GetArg("-minersleep", 500);
            this.lastCoinStakeSearchTime = Utils.DateTimeToUnixTime(this.dateTimeProvider.GetTimeOffset()); // startup timestamp
            this.reserveBalance          = 0;                                                               // TOOD:settings.ReserveBalance
            this.minimumInputValue       = 0;

            this.posConsensusValidator = consensusLoop.Validator as PosConsensusValidator;
        }
        public override BlockTemplate CreateNewBlock(Script scriptPubKeyIn, bool fMineWitnessTx = true)
        {
            this.logger.LogTrace("({0}.{1}:{2},{3}:{4})", nameof(scriptPubKeyIn), nameof(scriptPubKeyIn.Length), scriptPubKeyIn.Length, nameof(fMineWitnessTx), fMineWitnessTx);

            base.CreateNewBlock(scriptPubKeyIn, fMineWitnessTx);

            this.coinbase.Outputs[0].ScriptPubKey = new Script();
            this.coinbase.Outputs[0].Value        = Money.Zero;

            PosConsensusValidator posValidator = this.consensusLoop.Validator as PosConsensusValidator;

            Guard.NotNull(posValidator, nameof(posValidator));

            this.logger.LogTrace("(-)");
            return(this.pblocktemplate);
        }
        public PosMinting(
            ConsensusLoop consensusLoop,
            ConcurrentChain chain,
            Network network,
            IConnectionManager connection,
            IDateTimeProvider dateTimeProvider,
            AssemblerFactory blockAssemblerFactory,
            BlockRepository blockRepository,
            ChainState chainState,
            Signals.Signals signals, INodeLifetime nodeLifetime,
            NodeSettings settings,
            CoinView coinView,
            StakeChain stakeChain,
            IWalletManager wallet,
            IAsyncLoopFactory asyncLoopFactory,
            ILoggerFactory loggerFactory)
        {
            this.consensusLoop         = consensusLoop;
            this.chain                 = chain;
            this.network               = network;
            this.connection            = connection;
            this.dateTimeProvider      = dateTimeProvider;
            this.blockAssemblerFactory = blockAssemblerFactory;
            this.blockRepository       = blockRepository;
            this.chainState            = chainState;
            this.signals               = signals;
            this.nodeLifetime          = nodeLifetime;
            this.settings              = settings;
            this.coinView              = coinView;
            this.stakeChain            = stakeChain;
            this.asyncLoopFactory      = asyncLoopFactory;
            this.wallet                = wallet as WalletManager;
            this.logger                = loggerFactory.CreateLogger(this.GetType().FullName);

            this.minerSleep = 500;                                                                          // GetArg("-minersleep", 500);
            this.lastCoinStakeSearchTime = Utils.DateTimeToUnixTime(this.dateTimeProvider.GetTimeOffset()); // startup timestamp
            this.reserveBalance          = 0;                                                               // TOOD:settings.ReserveBalance
            this.minimumInputValue       = 0;

            this.posConsensusValidator = consensusLoop.Validator as PosConsensusValidator;
        }