1111using NBitcoin ;
1212using NBitcoin . BouncyCastle . Math ;
1313using NBitcoin . DataEncoders ;
14+ using Blockcore . Networks . RoyalSportsCity . Networks . Deployments ;
1415
1516namespace Blockcore . Networks . RoyalSportsCity . Networks
1617{
17- public class RoyalSportsCityTest : RoyalSportsCityMain
18- {
19- public RoyalSportsCityTest ( )
20- {
21- CoinSetup setup = RoyalSportsCitySetup . Instance . Setup ;
22- NetworkSetup network = RoyalSportsCitySetup . Instance . Test ;
23-
24- NetworkType = NetworkType . Testnet ;
25-
26- Name = network . Name ;
27- CoinTicker = network . CoinTicker ;
28- Magic = ConversionTools . ConvertToUInt32 ( setup . Magic , true ) ;
29- RootFolderName = network . RootFolderName ;
30- DefaultPort = network . DefaultPort ;
31- DefaultRPCPort = network . DefaultRPCPort ;
32- DefaultAPIPort = network . DefaultAPIPort ;
33-
34- var consensusFactory = new PosConsensusFactory ( ) ;
35-
36- // Create the genesis block.
37- GenesisTime = network . GenesisTime ;
38- GenesisNonce = network . GenesisNonce ;
39- GenesisBits = network . GenesisBits ;
40- GenesisVersion = network . GenesisVersion ;
41- GenesisReward = network . GenesisReward ;
42-
43- Block genesisBlock = CreateGenesisBlock ( consensusFactory ,
44- GenesisTime ,
45- GenesisNonce ,
46- GenesisBits ,
47- GenesisVersion ,
48- GenesisReward ,
49- setup . GenesisText ) ;
50-
51- Genesis = genesisBlock ;
52-
53- var consensusOptions = new PosConsensusOptions
54- {
55- MaxBlockBaseSize = 1_000_000 ,
56- MaxStandardVersion = 2 ,
57- MaxStandardTxWeight = 100_000 ,
58- MaxBlockSigopsCost = 20_000 ,
59- MaxStandardTxSigopsCost = 20_000 / 5 ,
60- WitnessScaleFactor = 4
61- } ;
62-
63- var buriedDeployments = new BuriedDeploymentsArray
64- {
65- [ BuriedDeployments . BIP34 ] = 0 ,
66- [ BuriedDeployments . BIP65 ] = 0 ,
67- [ BuriedDeployments . BIP66 ] = 0
68- } ;
69-
70- Consensus = new Blockcore . Consensus . Consensus (
18+ public class RoyalSportsCityTest : RoyalSportsCityMain
19+ {
20+ public RoyalSportsCityTest ( )
21+ {
22+ CoinSetup setup = RoyalSportsCitySetup . Instance . Setup ;
23+ NetworkSetup network = RoyalSportsCitySetup . Instance . Test ;
24+
25+ NetworkType = NetworkType . Testnet ;
26+
27+ Name = network . Name ;
28+ CoinTicker = network . CoinTicker ;
29+ Magic = ConversionTools . ConvertToUInt32 ( setup . Magic , true ) ;
30+ RootFolderName = network . RootFolderName ;
31+ DefaultPort = network . DefaultPort ;
32+ DefaultRPCPort = network . DefaultRPCPort ;
33+ DefaultAPIPort = network . DefaultAPIPort ;
34+
35+ var consensusFactory = new PosConsensusFactory ( ) ;
36+
37+ // Create the genesis block.
38+ GenesisTime = network . GenesisTime ;
39+ GenesisNonce = network . GenesisNonce ;
40+ GenesisBits = network . GenesisBits ;
41+ GenesisVersion = network . GenesisVersion ;
42+ GenesisReward = network . GenesisReward ;
43+
44+ Block genesisBlock = CreateGenesisBlock ( consensusFactory ,
45+ GenesisTime ,
46+ GenesisNonce ,
47+ GenesisBits ,
48+ GenesisVersion ,
49+ GenesisReward ,
50+ setup . GenesisText ) ;
51+
52+ Genesis = genesisBlock ;
53+
54+ var consensusOptions = new PosConsensusOptions
55+ {
56+ MaxBlockBaseSize = 1_000_000 ,
57+ MaxStandardVersion = 2 ,
58+ MaxStandardTxWeight = 100_000 ,
59+ MaxBlockSigopsCost = 20_000 ,
60+ MaxStandardTxSigopsCost = 20_000 / 5 ,
61+ WitnessScaleFactor = 4
62+ } ;
63+
64+ var buriedDeployments = new BuriedDeploymentsArray
65+ {
66+ [ BuriedDeployments . BIP34 ] = 0 ,
67+ [ BuriedDeployments . BIP65 ] = 0 ,
68+ [ BuriedDeployments . BIP66 ] = 0
69+ } ;
70+ var bip9Deployments = new RoyalSportsCityBIP9Deployments ( )
71+ {
72+ [ RoyalSportsCityBIP9Deployments . CSV ] = new BIP9DeploymentsParameters ( "CSV" , 0 , BIP9DeploymentsParameters . AlwaysActive , 999999999 , BIP9DeploymentsParameters . AlwaysActive ) ,
73+ [ RoyalSportsCityBIP9Deployments . Segwit ] = new BIP9DeploymentsParameters ( "Segwit" , 1 , BIP9DeploymentsParameters . AlwaysActive , 999999999 , BIP9DeploymentsParameters . AlwaysActive ) ,
74+ [ RoyalSportsCityBIP9Deployments . ColdStaking ] = new BIP9DeploymentsParameters ( "ColdStaking" , 2 , BIP9DeploymentsParameters . AlwaysActive , 999999999 , BIP9DeploymentsParameters . AlwaysActive ) ,
75+ } ;
76+ Consensus = new Blockcore . Consensus . Consensus (
7177 consensusFactory : consensusFactory ,
7278 consensusOptions : consensusOptions ,
7379 coinType : setup . CoinType ,
@@ -77,7 +83,7 @@ public RoyalSportsCityTest()
7783 majorityRejectBlockOutdated : 950 ,
7884 majorityWindow : 1000 ,
7985 buriedDeployments : buriedDeployments ,
80- bip9Deployments : new NoBIP9Deployments ( ) ,
86+ bip9Deployments : bip9Deployments ,
8187 bip34Hash : null ,
8288 minerConfirmationWindow : 2016 , // nPowTargetTimespan / nPowTargetSpacing
8389 maxReorgLength : 500 ,
@@ -102,36 +108,36 @@ public RoyalSportsCityTest()
102108 proofOfStakeTimestampMask : setup . ProofOfStakeTimestampMask
103109 ) ;
104110
105- Base58Prefixes [ ( int ) Base58Type . PUBKEY_ADDRESS ] = new byte [ ] { ( byte ) network . PubKeyAddress } ;
106- Base58Prefixes [ ( int ) Base58Type . SCRIPT_ADDRESS ] = new byte [ ] { ( byte ) network . ScriptAddress } ;
107- Base58Prefixes [ ( int ) Base58Type . SECRET_KEY ] = new byte [ ] { ( 239 ) } ;
108- Base58Prefixes [ ( int ) Base58Type . ENCRYPTED_SECRET_KEY_NO_EC ] = new byte [ ] { 0x01 , 0x42 } ;
109- Base58Prefixes [ ( int ) Base58Type . ENCRYPTED_SECRET_KEY_EC ] = new byte [ ] { 0x01 , 0x43 } ;
110- Base58Prefixes [ ( int ) Base58Type . EXT_PUBLIC_KEY ] = new byte [ ] { ( 0x04 ) , ( 0x88 ) , ( 0xB2 ) , ( 0x1E ) } ;
111- Base58Prefixes [ ( int ) Base58Type . EXT_SECRET_KEY ] = new byte [ ] { ( 0x04 ) , ( 0x88 ) , ( 0xAD ) , ( 0xE4 ) } ;
112- Base58Prefixes [ ( int ) Base58Type . PASSPHRASE_CODE ] = new byte [ ] { 0x2C , 0xE9 , 0xB3 , 0xE1 , 0xFF , 0x39 , 0xE2 } ;
113- Base58Prefixes [ ( int ) Base58Type . CONFIRMATION_CODE ] = new byte [ ] { 0x64 , 0x3B , 0xF6 , 0xA8 , 0x9A } ;
114- Base58Prefixes [ ( int ) Base58Type . ASSET_ID ] = new byte [ ] { 115 } ;
115-
116- Bech32Encoders = new Bech32Encoder [ 2 ] ;
117- var encoder = new Bech32Encoder ( network . CoinTicker . ToLowerInvariant ( ) ) ;
118- Bech32Encoders [ ( int ) Bech32Type . WITNESS_PUBKEY_ADDRESS ] = encoder ;
119- Bech32Encoders [ ( int ) Bech32Type . WITNESS_SCRIPT_ADDRESS ] = encoder ;
120-
121- Checkpoints = network . Checkpoints ;
122- DNSSeeds = network . DNS . Select ( dns => new DNSSeedData ( dns , dns ) ) . ToList ( ) ;
123- SeedNodes = network . Nodes . Select ( node => new NBitcoin . Protocol . NetworkAddress ( IPAddress . Parse ( node ) , network . DefaultPort ) ) . ToList ( ) ;
124-
125- StandardScriptsRegistry = new RoyalSportsCityStandardScriptsRegistry ( ) ;
126-
127- // 64 below should be changed to TargetSpacingSeconds when we move that field.
128- Assert ( DefaultBanTimeSeconds <= Consensus . MaxReorgLength * 64 / 2 ) ;
129-
130- Assert ( Consensus . HashGenesisBlock == uint256 . Parse ( network . HashGenesisBlock ) ) ;
131- Assert ( Genesis . Header . HashMerkleRoot == uint256 . Parse ( network . HashMerkleRoot ) ) ;
132-
133- RegisterRules ( Consensus ) ;
134- RegisterMempoolRules ( Consensus ) ;
135- }
136- }
111+ Base58Prefixes [ ( int ) Base58Type . PUBKEY_ADDRESS ] = new byte [ ] { ( byte ) network . PubKeyAddress } ;
112+ Base58Prefixes [ ( int ) Base58Type . SCRIPT_ADDRESS ] = new byte [ ] { ( byte ) network . ScriptAddress } ;
113+ Base58Prefixes [ ( int ) Base58Type . SECRET_KEY ] = new byte [ ] { ( 239 ) } ;
114+ Base58Prefixes [ ( int ) Base58Type . ENCRYPTED_SECRET_KEY_NO_EC ] = new byte [ ] { 0x01 , 0x42 } ;
115+ Base58Prefixes [ ( int ) Base58Type . ENCRYPTED_SECRET_KEY_EC ] = new byte [ ] { 0x01 , 0x43 } ;
116+ Base58Prefixes [ ( int ) Base58Type . EXT_PUBLIC_KEY ] = new byte [ ] { ( 0x04 ) , ( 0x88 ) , ( 0xB2 ) , ( 0x1E ) } ;
117+ Base58Prefixes [ ( int ) Base58Type . EXT_SECRET_KEY ] = new byte [ ] { ( 0x04 ) , ( 0x88 ) , ( 0xAD ) , ( 0xE4 ) } ;
118+ Base58Prefixes [ ( int ) Base58Type . PASSPHRASE_CODE ] = new byte [ ] { 0x2C , 0xE9 , 0xB3 , 0xE1 , 0xFF , 0x39 , 0xE2 } ;
119+ Base58Prefixes [ ( int ) Base58Type . CONFIRMATION_CODE ] = new byte [ ] { 0x64 , 0x3B , 0xF6 , 0xA8 , 0x9A } ;
120+ Base58Prefixes [ ( int ) Base58Type . ASSET_ID ] = new byte [ ] { 115 } ;
121+
122+ Bech32Encoders = new Bech32Encoder [ 2 ] ;
123+ var encoder = new Bech32Encoder ( network . CoinTicker . ToLowerInvariant ( ) ) ;
124+ Bech32Encoders [ ( int ) Bech32Type . WITNESS_PUBKEY_ADDRESS ] = encoder ;
125+ Bech32Encoders [ ( int ) Bech32Type . WITNESS_SCRIPT_ADDRESS ] = encoder ;
126+
127+ Checkpoints = network . Checkpoints ;
128+ DNSSeeds = network . DNS . Select ( dns => new DNSSeedData ( dns , dns ) ) . ToList ( ) ;
129+ SeedNodes = network . Nodes . Select ( node => new NBitcoin . Protocol . NetworkAddress ( IPAddress . Parse ( node ) , network . DefaultPort ) ) . ToList ( ) ;
130+
131+ StandardScriptsRegistry = new RoyalSportsCityStandardScriptsRegistry ( ) ;
132+
133+ // 64 below should be changed to TargetSpacingSeconds when we move that field.
134+ Assert ( DefaultBanTimeSeconds <= Consensus . MaxReorgLength * 64 / 2 ) ;
135+
136+ Assert ( Consensus . HashGenesisBlock == uint256 . Parse ( network . HashGenesisBlock ) ) ;
137+ Assert ( Genesis . Header . HashMerkleRoot == uint256 . Parse ( network . HashMerkleRoot ) ) ;
138+
139+ RegisterRules ( Consensus ) ;
140+ RegisterMempoolRules ( Consensus ) ;
141+ }
142+ }
137143}
0 commit comments