Skip to content

Commit 4aec935

Browse files
committed
net: Deserialize hardcoded seeds from BIP155 blob
Switch from IPv6 slot-based format to more compact and flexible BIP155 format.
1 parent a245b2f commit 4aec935

File tree

4 files changed

+355
-180
lines changed

4 files changed

+355
-180
lines changed

src/chainparams.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class CMainParams : public CChainParams
243243
// BIP44 coin type is from https://github.com/satoshilabs/slips/blob/master/slip-0044.md
244244
base58Prefixes[EXT_COIN_TYPE] = {0x80, 0x00, 0x00, 0x77};
245245

246-
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
246+
vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_main), std::end(chainparams_seed_main));
247247

248248
// Reject non-standard transactions by default
249249
fRequireStandard = true;
@@ -372,7 +372,7 @@ class CTestNetParams : public CChainParams
372372
// Testnet pivx BIP44 coin type is '1' (All coin's testnet default)
373373
base58Prefixes[EXT_COIN_TYPE] = {0x80, 0x00, 0x00, 0x01};
374374

375-
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));
375+
vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_test), std::end(chainparams_seed_test));
376376

377377
fRequireStandard = false;
378378

src/chainparams.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ struct CDNSSeedData {
2424
CDNSSeedData(const std::string& strHost, bool supportsServiceBitsFilteringIn = false) : host(strHost), supportsServiceBitsFiltering(supportsServiceBitsFilteringIn) {}
2525
};
2626

27-
struct SeedSpec6 {
28-
uint8_t addr[16];
29-
uint16_t port;
30-
};
31-
3227
/**
3328
* CChainParams defines various tweakable parameters of a given instance of the
3429
* PIVX system. There are three: the main network on which people trade goods
@@ -83,7 +78,7 @@ class CChainParams
8378
const std::vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; }
8479
const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
8580
const std::string& Bech32HRP(Bech32Type type) const { return bech32HRPs[type]; }
86-
const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
81+
const std::vector<uint8_t>& FixedSeeds() const { return vFixedSeeds; }
8782
virtual const Checkpoints::CCheckpointData& Checkpoints() const = 0;
8883

8984
bool IsRegTestNet() const { return NetworkIDString() == CBaseChainParams::REGTEST; }
@@ -101,7 +96,7 @@ class CChainParams
10196
std::vector<CDNSSeedData> vSeeds;
10297
std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
10398
std::string bech32HRPs[MAX_BECH32_TYPES];
104-
std::vector<SeedSpec6> vFixedSeeds;
99+
std::vector<uint8_t> vFixedSeeds;
105100
bool fRequireStandard;
106101
};
107102

0 commit comments

Comments
 (0)