1+ using System ;
2+ using System . Collections . Generic ;
3+ using Blockcore . Base . Deployments ;
4+ using Blockcore . Consensus ;
5+ using NBitcoin ;
6+ using NBitcoin . BouncyCastle . Math ;
7+
8+ namespace Blockcore . Networks . XRC . Consensus
9+ {
10+ public class XRCConsensus : IConsensus
11+ {
12+ /// <inheritdoc />
13+ public long CoinbaseMaturity { get ; set ; }
14+
15+ /// <inheritdoc />
16+ public Money PremineReward { get ; }
17+
18+ /// <inheritdoc />
19+ public long PremineHeight { get ; }
20+
21+ /// <inheritdoc />
22+ public Money ProofOfWorkReward { get ; }
23+
24+ /// <inheritdoc />
25+ public Money ProofOfStakeReward { get ; }
26+
27+ /// <inheritdoc />
28+ public uint MaxReorgLength { get ; private set ; }
29+
30+ /// <inheritdoc />
31+ public long MaxMoney { get ; }
32+
33+ public ConsensusOptions Options { get ; set ; }
34+
35+ public BuriedDeploymentsArray BuriedDeployments { get ; }
36+
37+ public IBIP9DeploymentsArray BIP9Deployments { get ; }
38+
39+ public int SubsidyHalvingInterval { get ; }
40+
41+ public int MajorityEnforceBlockUpgrade { get ; }
42+
43+ public int MajorityRejectBlockOutdated { get ; }
44+
45+ public int MajorityWindow { get ; }
46+
47+ public uint256 BIP34Hash { get ; }
48+
49+ public Target PowLimit { get ; }
50+ public Target PowLimit2 { get ; }
51+ public int PowLimit2Height { get ; }
52+ public uint PowLimit2Time { get ; }
53+
54+ public TimeSpan TargetTimespan { get ; }
55+
56+ public TimeSpan TargetSpacing { get ; }
57+
58+ public bool PowAllowMinDifficultyBlocks { get ; }
59+
60+ /// <inheritdoc />
61+ public bool PosNoRetargeting { get ; }
62+
63+ /// <inheritdoc />
64+ public bool PowNoRetargeting { get ; }
65+
66+ public uint256 HashGenesisBlock { get ; }
67+
68+ /// <inheritdoc />
69+ public uint256 MinimumChainWork { get ; }
70+
71+ public int MinerConfirmationWindow { get ; set ; }
72+
73+ /// <inheritdoc />
74+ public int CoinType { get ; }
75+
76+ public BigInteger ProofOfStakeLimit { get ; }
77+
78+ public BigInteger ProofOfStakeLimitV2 { get ; }
79+
80+ /// <inheritdoc />
81+ public int LastPOWBlock { get ; set ; }
82+
83+ /// <inheritdoc />
84+ public bool IsProofOfStake { get ; }
85+
86+ /// <inheritdoc />
87+ public bool PosEmptyCoinbase { get ; set ; }
88+
89+ /// <inheritdoc />
90+ public bool PosUseTimeFieldInKernalHash { get ; set ; }
91+
92+ /// <inheritdoc />
93+ public uint ProofOfStakeTimestampMask { get ; set ; }
94+
95+ /// <inheritdoc />
96+ public uint256 DefaultAssumeValid { get ; }
97+
98+ /// <inheritdoc />
99+ public ConsensusFactory ConsensusFactory { get ; }
100+
101+ /// <inheritdoc />
102+ public ConsensusRules ConsensusRules { get ; }
103+
104+ /// <inheritdoc />
105+ public List < Type > MempoolRules { get ; set ; }
106+
107+ public XRCConsensus (
108+ ConsensusFactory consensusFactory ,
109+ ConsensusOptions consensusOptions ,
110+ int coinType ,
111+ uint256 hashGenesisBlock ,
112+ int subsidyHalvingInterval ,
113+ int majorityEnforceBlockUpgrade ,
114+ int majorityRejectBlockOutdated ,
115+ int majorityWindow ,
116+ BuriedDeploymentsArray buriedDeployments ,
117+ IBIP9DeploymentsArray bip9Deployments ,
118+ uint256 bip34Hash ,
119+ int minerConfirmationWindow ,
120+ uint maxReorgLength ,
121+ uint256 defaultAssumeValid ,
122+ long maxMoney ,
123+ long coinbaseMaturity ,
124+ long premineHeight ,
125+ Money premineReward ,
126+ Money proofOfWorkReward ,
127+ TimeSpan targetTimespan ,
128+ TimeSpan targetSpacing ,
129+ bool powAllowMinDifficultyBlocks ,
130+ bool posNoRetargeting ,
131+ bool powNoRetargeting ,
132+ Target powLimit ,
133+ Target powLimit2 ,
134+ int powLimit2Height ,
135+ uint powLimit2Time ,
136+ uint256 minimumChainWork ,
137+ bool isProofOfStake ,
138+ int lastPowBlock ,
139+ BigInteger proofOfStakeLimit ,
140+ BigInteger proofOfStakeLimitV2 ,
141+ Money proofOfStakeReward ,
142+ uint proofOfStakeTimestampMask )
143+ {
144+ this . CoinbaseMaturity = coinbaseMaturity ;
145+ this . PremineReward = premineReward ;
146+ this . PremineHeight = premineHeight ;
147+ this . ProofOfWorkReward = proofOfWorkReward ;
148+ this . ProofOfStakeReward = proofOfStakeReward ;
149+ this . MaxReorgLength = maxReorgLength ;
150+ this . MaxMoney = maxMoney ;
151+ this . Options = consensusOptions ;
152+ this . BuriedDeployments = buriedDeployments ;
153+ this . BIP9Deployments = bip9Deployments ;
154+ this . SubsidyHalvingInterval = subsidyHalvingInterval ;
155+ this . MajorityEnforceBlockUpgrade = majorityEnforceBlockUpgrade ;
156+ this . MajorityRejectBlockOutdated = majorityRejectBlockOutdated ;
157+ this . MajorityWindow = majorityWindow ;
158+ this . BIP34Hash = bip34Hash ;
159+ this . PowLimit = powLimit ;
160+ this . PowLimit2 = powLimit2 ;
161+ this . PowLimit2Height = powLimit2Height ;
162+ this . PowLimit2Time = powLimit2Time ;
163+ this . TargetTimespan = targetTimespan ;
164+ this . TargetSpacing = targetSpacing ;
165+ this . PowAllowMinDifficultyBlocks = powAllowMinDifficultyBlocks ;
166+ this . PosNoRetargeting = posNoRetargeting ;
167+ this . PowNoRetargeting = powNoRetargeting ;
168+ this . HashGenesisBlock = hashGenesisBlock ;
169+ this . MinimumChainWork = minimumChainWork ;
170+ this . MinerConfirmationWindow = minerConfirmationWindow ;
171+ this . CoinType = coinType ;
172+ this . ProofOfStakeLimit = proofOfStakeLimit ;
173+ this . ProofOfStakeLimitV2 = proofOfStakeLimitV2 ;
174+ this . LastPOWBlock = lastPowBlock ;
175+ this . IsProofOfStake = isProofOfStake ;
176+ this . DefaultAssumeValid = defaultAssumeValid ;
177+ this . ConsensusFactory = consensusFactory ;
178+ this . ConsensusRules = new ConsensusRules ( ) ;
179+ this . MempoolRules = new List < Type > ( ) ;
180+ this . ProofOfStakeTimestampMask = proofOfStakeTimestampMask ;
181+ }
182+ }
183+ }
0 commit comments