|
8 | 8 | "strings" |
9 | 9 | "sync" |
10 | 10 | "time" |
| 11 | + |
| 12 | + gen "github.com/blinklabs-io/cdnsd/internal/handshake/protocol/genesis" |
11 | 13 | ) |
12 | 14 |
|
13 | 15 | type NetworkType string |
@@ -111,8 +113,8 @@ type Network struct { |
111 | 113 |
|
112 | 114 | HalvingInterval uint32 |
113 | 115 | CoinbaseMaturity uint32 |
114 | | - GenesisHash string |
115 | | - GenesisBlockHex string |
| 116 | + Genesis gen.Net |
| 117 | + GenesisBlock string |
116 | 118 | UnknownBitsMask uint32 |
117 | 119 |
|
118 | 120 | POW POWParams |
@@ -237,9 +239,12 @@ func testNet() *Network { |
237 | 239 | targetTimespan := targetWindow * targetSpacing |
238 | 240 |
|
239 | 241 | n := &Network{ |
240 | | - Type: "testnet", |
241 | | - Seeds: []string{"hs-testnet.bcoin.ninja"}, |
242 | | - Magic: 0, // Need to modify from genesis.testnet.magic |
| 242 | + Type: "testnet", |
| 243 | + Seeds: []string{"hs-testnet.bcoin.ninja"}, |
| 244 | + Magic: 2974944722, // Need to modify from genesis.testnet.magic |
| 245 | + |
| 246 | + // TODO: Need to implement Genesis & GenesisBlock in genesis.go & import here. |
| 247 | + // Genesis: "b1520dd24372f82ec94ebf8cf9d9b037d419c4aa3575d05dec70aedd1b427901", |
243 | 248 | Port: 13038, |
244 | 249 | BrontidePort: 45806, |
245 | 250 |
|
@@ -340,8 +345,132 @@ func testNet() *Network { |
340 | 345 | } |
341 | 346 |
|
342 | 347 | func mainNet() *Network { |
343 | | - // Need to implement |
344 | | - return &Network{} |
| 348 | + const ( |
| 349 | + targetSpacing = uint32(10 * 60) // 10 minutes |
| 350 | + targetWindow = uint32(144) |
| 351 | + ) |
| 352 | + blocksPerDay := uint32((24 * 60 * 60) / targetSpacing) |
| 353 | + targetTimespan := targetWindow * targetSpacing |
| 354 | + |
| 355 | + n := &Network{ |
| 356 | + Type: "main", |
| 357 | + Seeds: []string{"hs-mainnet.bcoin.ninja", "seed.htools.work"}, |
| 358 | + Magic: gen.Main.Magic, |
| 359 | + Genesis: gen.Main, |
| 360 | + GenesisBlock: gen.Maindata, |
| 361 | + Port: 12038, |
| 362 | + BrontidePort: 44806, |
| 363 | + |
| 364 | + CheckpointMap: map[uint32]string{ |
| 365 | + 1008: "0000000000001013c28fa079b545fb805f04c496687799b98e35e83cbbb8953e", |
| 366 | + 2016: "0000000000000424ee6c2a5d6e0da5edfc47a4a10328c1792056ee48303c3e40", |
| 367 | + 10000: "00000000000001a86811a6f520bf67cefa03207dc84fd315f58153b28694ec51", |
| 368 | + 20000: "0000000000000162c7ac70a582256f59c189b5c90d8e9861b3f374ed714c58de", |
| 369 | + 30000: "0000000000000004f790862846b23c3a81585aea0fa79a7d851b409e027bcaa7", |
| 370 | + 40000: "0000000000000002966206a40b10a575cb46531253b08dae8e1b356cfa277248", |
| 371 | + 50000: "00000000000000020c7447e7139feeb90549bfc77a7f18d4ff28f327c04f8d6e", |
| 372 | + 56880: "0000000000000001d4ef9ea6908bb4eb970d556bd07cbd7d06a634e1cd5bbf4e", |
| 373 | + 61043: "00000000000000015b84385e0307370f8323420eaa27ef6e407f2d3162f1fd05", |
| 374 | + 100000: "000000000000000136d7d3efa688072f40d9fdd71bd47bb961694c0f38950246", |
| 375 | + 130000: "0000000000000005ee5106df9e48bcd232a1917684ac344b35ddd9b9e4101096", |
| 376 | + 160000: "00000000000000021e723ce5aedc021ab4f85d46a6914e40148f01986baa46c9", |
| 377 | + 200000: "000000000000000181ebc18d6c34442ffef3eedca90c57ca8ecc29016a1cfe16", |
| 378 | + 225000: "00000000000000021f0be013ebad018a9ef97c8501766632f017a778781320d5", |
| 379 | + 258026: "0000000000000004963d20732c58e5a91cb7e1b61ec6709d031f1a5ca8c55b95", |
| 380 | + }, |
| 381 | + LastCheckpoint: 258026, |
| 382 | + |
| 383 | + HalvingInterval: 170000, |
| 384 | + CoinbaseMaturity: 100, |
| 385 | + |
| 386 | + POW: POWParams{ |
| 387 | + Limit: bi("0000000000ffff00000000000000000000000000000000000000000000000000"), |
| 388 | + Bits: 0x1c00ffff, |
| 389 | + Chainwork: bi("00000000000000000000000000000000000000000000000075b5a2b7bf522d45"), |
| 390 | + TargetWindow: targetWindow, |
| 391 | + TargetSpacing: targetSpacing, |
| 392 | + BlocksPerDay: blocksPerDay, |
| 393 | + TargetTimespan: targetTimespan, |
| 394 | + MinActual: targetTimespan / 4, |
| 395 | + MaxActual: targetTimespan * 4, |
| 396 | + TargetReset: false, |
| 397 | + NoRetargeting: false, |
| 398 | + }, |
| 399 | + |
| 400 | + Names: NamesParams{ |
| 401 | + AuctionStart: 14 * blocksPerDay, |
| 402 | + RolloutInterval: 7 * blocksPerDay, |
| 403 | + LockupPeriod: 30 * blocksPerDay, |
| 404 | + RenewalWindow: (2 * 365) * blocksPerDay, |
| 405 | + RenewalPeriod: 182 * blocksPerDay, |
| 406 | + RenewalMaturity: 30 * blocksPerDay, |
| 407 | + ClaimPeriod: (4 * 365) * blocksPerDay, |
| 408 | + AlexaLockupPeriod: (8 * 365) * blocksPerDay, |
| 409 | + ClaimFrequency: 2 * blocksPerDay, |
| 410 | + BiddingPeriod: 5 * blocksPerDay, |
| 411 | + RevealPeriod: 10 * blocksPerDay, |
| 412 | + TreeInterval: blocksPerDay >> 2, |
| 413 | + TransferLockup: 2 * blocksPerDay, |
| 414 | + AuctionMaturity: (5 + 10 + 14) * blocksPerDay, |
| 415 | + NoRollout: false, |
| 416 | + NoReserved: false, |
| 417 | + }, |
| 418 | + |
| 419 | + Block: BlockLimits{ |
| 420 | + PruneAfterHeight: 1000, |
| 421 | + KeepBlocks: 288, |
| 422 | + MaxTipAge: 12 * 60 * 60, |
| 423 | + SlowHeight: 0, |
| 424 | + }, |
| 425 | + |
| 426 | + GoosigStop: (365 + 30) * blocksPerDay, |
| 427 | + ActivationThreshold: 1916, |
| 428 | + MinerWindow: 2016, |
| 429 | + |
| 430 | + Deployments: map[string]Deployment{ |
| 431 | + "hardening": {Name: "hardening", Bit: 0, StartTime: 1581638400, Timeout: 1707868800, Threshold: -1, Window: -1, Required: false, Force: false}, |
| 432 | + "icannlockup": {Name: "icannlockup", Bit: 1, StartTime: 1691625600, Timeout: 1703980800, Threshold: -1, Window: -1, Required: false, Force: false}, |
| 433 | + "airstop": {Name: "airstop", Bit: 2, StartTime: 1751328000, Timeout: 1759881600, Threshold: -1, Window: -1, Required: false, Force: false}, |
| 434 | + "testdummy": {Name: "testdummy", Bit: 28, StartTime: 1199145601, Timeout: 1230767999, Threshold: -1, Window: -1, Required: false, Force: true}, |
| 435 | + }, |
| 436 | + Deploys: []Deployment{ |
| 437 | + {Name: "hardening", Bit: 0, StartTime: 1581638400, Timeout: 1707868800, Threshold: -1, Window: -1, Required: false, Force: false}, |
| 438 | + {Name: "icannlockup", Bit: 1, StartTime: 1691625600, Timeout: 1703980800, Threshold: -1, Window: -1, Required: false, Force: false}, |
| 439 | + {Name: "airstop", Bit: 2, StartTime: 1751328000, Timeout: 1759881600, Threshold: -1, Window: -1, Required: false, Force: false}, |
| 440 | + {Name: "testdummy", Bit: 28, StartTime: 1199145601, Timeout: 1230767999, Threshold: -1, Window: -1, Required: false, Force: true}, |
| 441 | + }, |
| 442 | + |
| 443 | + KeyPrefix: KeyPrefix{ |
| 444 | + Privkey: 0x80, |
| 445 | + XPubKey: 0x0488b21e, |
| 446 | + XPrivKey: 0x0488ade4, |
| 447 | + XPubKey58: "xpub", |
| 448 | + XPrivKey58: "xprv", |
| 449 | + CoinType: 5353, |
| 450 | + }, |
| 451 | + AddressPrefix: "hs", |
| 452 | + ClaimPrefix: "hns-claim:", |
| 453 | + RequireStandard: true, |
| 454 | + |
| 455 | + RPCPort: 12037, |
| 456 | + WalletPort: 12039, |
| 457 | + NSPort: 5349, |
| 458 | + RSPort: 5350, |
| 459 | + |
| 460 | + MinRelay: 1000, |
| 461 | + FeeRate: 100000, |
| 462 | + MaxFeeRate: 400000, |
| 463 | + |
| 464 | + IdentityKeyHex: "", |
| 465 | + SelfConnect: false, |
| 466 | + RequestMempool: true, |
| 467 | + |
| 468 | + DeflationHeight: 61043, |
| 469 | + TxStartHeight: 14 * blocksPerDay, |
| 470 | + } |
| 471 | + n.ensureTime() |
| 472 | + n.init() |
| 473 | + return n |
345 | 474 | } |
346 | 475 |
|
347 | 476 | func regTest() *Network { |
|
0 commit comments