protected override void UpdateHeaders() { base.UpdateHeaders(); var stake = new BlockStake(this.pblock); this.pblock.Header.Bits = StakeValidator.GetNextTargetRequired(stakeChain, this.chain.Tip, this.network.Consensus, this.options.IsProofOfStake); }
protected override void UpdateHeaders() { this.logger.LogTrace("()"); base.UpdateHeaders(); var stake = new BlockStake(this.pblock); this.pblock.Header.Bits = StakeValidator.GetNextTargetRequired(this.stakeChain, this.ChainTip, this.network.Consensus, this.options.IsProofOfStake); this.logger.LogTrace("(-)"); }
public TestPosConsensusRulesUnitTestBase() : base(KnownNetworks.StratisTest) { this.stakeChain = new Mock <IStakeChain>(); this.stakeValidator = new Mock <IStakeValidator>(); this.lookaheadBlockPuller = new Mock <IBlockPuller>(); this.coinView = new Mock <ICoinView>(); this.rewindDataIndexStore = new Mock <IRewindDataIndexCache>(); this.consensusRules = InitializeConsensusRules(); this.stakeValidator.Setup(s => s.CheckStakeSignature(It.IsAny <BlockSignature>(), It.IsAny <uint256>(), It.IsAny <Transaction>())) .Returns((BlockSignature signature, uint256 blockHash, Transaction coinstakeTx) => { var validator = new StakeValidator(this.network, this.stakeChain.Object, this.ChainIndexer, this.coinView.Object, this.loggerFactory.Object); return(validator.CheckStakeSignature(signature, blockHash, coinstakeTx)); }); }
public PosBlockAssembler( ConsensusLoop consensusLoop, Network network, MempoolSchedulerLock mempoolLock, TxMempool mempool, IDateTimeProvider dateTimeProvider, StakeChain stakeChain, StakeValidator 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; }
public PosAssemblerFactory( ConsensusLoop consensusLoop, Network network, MempoolSchedulerLock mempoolScheduler, TxMempool mempool, StakeValidator stakeValidator, IDateTimeProvider dateTimeProvider, ILoggerFactory loggerFactory, StakeChain stakeChain = null) { this.consensusLoop = consensusLoop; this.network = network; this.mempoolScheduler = mempoolScheduler; this.mempool = mempool; this.stakeValidator = stakeValidator; this.dateTimeProvider = dateTimeProvider; this.stakeChain = stakeChain; this.loggerFactory = loggerFactory; this.logger = loggerFactory.CreateLogger(this.GetType().FullName); }