0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-10 10:52:31 -05:00

[netgroup] Use nStartByte as offset for the last byte of the group

Should we ever introduce a new address type that makes use of
`nStartByte` and adds fractional bytes to the group, then nStartByte
should be used as the offset for the last byte.
This commit is contained in:
dergoegge 2022-04-25 15:08:38 +02:00
parent 10a626a1d6
commit e5d1831517

View file

@ -71,7 +71,7 @@ std::vector<unsigned char> NetGroupManager::GetGroup(const CNetAddr& address) co
// ...for the last byte, push nBits and for the rest of the byte push 1's // ...for the last byte, push nBits and for the rest of the byte push 1's
if (nBits > 0) { if (nBits > 0) {
assert(num_bytes < addr_bytes.size()); assert(num_bytes < addr_bytes.size());
vchRet.push_back(addr_bytes[num_bytes] | ((1 << (8 - nBits)) - 1)); vchRet.push_back(addr_bytes[num_bytes + nStartByte] | ((1 << (8 - nBits)) - 1));
} }
return vchRet; return vchRet;