mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
net: take the first 4 random bits from CJDNS addresses in GetGroup()
CJDNS addresses start with constant 8 bits, so in order to account for the first 4 random ones, we must take the first 12. Otherwise the entire CJDNS network will belong to one group.
This commit is contained in:
parent
29ff79c0a2
commit
f9c28330a0
1 changed files with 7 additions and 1 deletions
|
@ -794,8 +794,14 @@ std::vector<unsigned char> CNetAddr::GetGroup(const std::vector<bool> &asmap) co
|
||||||
vchRet.push_back((ipv4 >> 24) & 0xFF);
|
vchRet.push_back((ipv4 >> 24) & 0xFF);
|
||||||
vchRet.push_back((ipv4 >> 16) & 0xFF);
|
vchRet.push_back((ipv4 >> 16) & 0xFF);
|
||||||
return vchRet;
|
return vchRet;
|
||||||
} else if (IsTor() || IsI2P() || IsCJDNS()) {
|
} else if (IsTor() || IsI2P()) {
|
||||||
nBits = 4;
|
nBits = 4;
|
||||||
|
} else if (IsCJDNS()) {
|
||||||
|
// Treat in the same way as Tor and I2P because the address in all of
|
||||||
|
// them is "random" bytes (derived from a public key). However in CJDNS
|
||||||
|
// the first byte is a constant 0xfc, so the random bytes come after it.
|
||||||
|
// Thus skip the constant 8 bits at the start.
|
||||||
|
nBits = 12;
|
||||||
} else if (IsHeNet()) {
|
} else if (IsHeNet()) {
|
||||||
// for he.net, use /36 groups
|
// for he.net, use /36 groups
|
||||||
nBits = 36;
|
nBits = 36;
|
||||||
|
|
Loading…
Add table
Reference in a new issue