File tree Expand file tree Collapse file tree
src/Networks/Blockcore.Networks.City/Networks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ protected void RegisterRules(IConsensus consensus)
221221 // rules that require the store to be loaded (coinview)
222222 . Register < FetchUtxosetRule > ( )
223223 . Register < TransactionDuplicationActivationRule > ( )
224- . Register < CheckPosUtxosetRule > ( ) // implements BIP68, MaxSigOps and BlockReward calculation
224+ . Register < CityCheckPosUtxosetRule > ( ) // implements BIP68, MaxSigOps and BlockReward calculation
225225 // Place the PosColdStakingRule after the PosCoinviewRule to ensure that all input scripts have been evaluated
226226 // and that the "IsColdCoinStake" flag would have been set by the OP_CHECKCOLDSTAKEVERIFY opcode if applicable.
227227 . Register < PosColdStakingRule > ( )
Original file line number Diff line number Diff line change 1+ using Blockcore . Features . Consensus . Rules . UtxosetRules ;
2+ using NBitcoin ;
3+
4+ namespace City . Networks . Rules
5+ {
6+ /// <summary>
7+ /// Proof of stake override for the coinview rules - BIP68, MaxSigOps and BlockReward checks.
8+ /// The City rule reduces the coinbase reward from 20 to 2 at block height 1 111 111?
9+ /// </summary>
10+ public class CityCheckPosUtxosetRule : CheckPosUtxosetRule
11+ {
12+ private static readonly int REDUCTIONHEIGHT = 1111111 ;
13+
14+ /// <inheritdoc />
15+ public override Money GetProofOfWorkReward ( int height )
16+ {
17+ if ( this . IsPremine ( height ) )
18+ return this . consensus . PremineReward ;
19+
20+ return this . consensus . ProofOfWorkReward ;
21+ }
22+
23+ /// <summary>
24+ /// Gets miner's coin stake reward.
25+ /// </summary>
26+ /// <param name="height">Target block height.</param>
27+ /// <returns>Miner's coin stake reward.</returns>
28+ public override Money GetProofOfStakeReward ( int height )
29+ {
30+ if ( this . IsPremine ( height ) )
31+ return this . consensus . PremineReward ;
32+
33+ if ( height > REDUCTIONHEIGHT )
34+ {
35+ return this . consensus . ProofOfStakeReward / 10 ;
36+ }
37+
38+ return this . consensus . ProofOfStakeReward ;
39+ }
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments