aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordergoegge <n.goeggi@gmail.com>2022-04-25 15:08:38 +0200
committerdergoegge <n.goeggi@gmail.com>2022-04-25 15:09:14 +0200
commite5d183151709ab59d2fa6fe9e0243000e8d6abbe (patch)
treef2cc2ad51916e9ff00ffb541dc78c5d4f948a551
parent10a626a1d6776447525f50d3e1a97b3c5bbad7d6 (diff)
downloadbitcoin-e5d183151709ab59d2fa6fe9e0243000e8d6abbe.tar.xz
[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.
-rw-r--r--src/netgroup.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/netgroup.cpp b/src/netgroup.cpp
index 5f42d6c719..96b5e29684 100644
--- a/src/netgroup.cpp
+++ b/src/netgroup.cpp
@@ -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
if (nBits > 0) {
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;