Skip to content

Commit 33aaf43

Browse files
committed
Merge bitcoin/bitcoin#24976: netgroup: Follow-up for #22910
e5d1831 [netgroup] Use nStartByte as offset for the last byte of the group (dergoegge) Pull request description: This addresses my review [comments](bitcoin/bitcoin#22910 (comment)) I left on #22910. This has no effect on the current logic as `nStartByte` is only used for internal addresses which only ever add 10 whole bytes to the returned group. However to avoid future bugs, I think we should use `nStartByte` as offset for the last byte as well, in case we ever add a new address type that makes makes use of `nStartByte` and adds fractional bytes to the group. ACKs for top commit: jnewbery: Code review ACK e5d1831 theStack: Concept and code-review ACK e5d1831 Tree-SHA512: 4c08c7d6cb38b553e998798b3e3b790177aaa2141a48e277dfd538e01a7fccadf644329e93c5b0fb5e7e4037494c8dfe061b94eb52c6b31dc21bdf99eb0e311a
2 parents 0047d9b + e5d1831 commit 33aaf43

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/netgroup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ std::vector<unsigned char> NetGroupManager::GetGroup(const CNetAddr& address) co
7171
// ...for the last byte, push nBits and for the rest of the byte push 1's
7272
if (nBits > 0) {
7373
assert(num_bytes < addr_bytes.size());
74-
vchRet.push_back(addr_bytes[num_bytes] | ((1 << (8 - nBits)) - 1));
74+
vchRet.push_back(addr_bytes[num_bytes + nStartByte] | ((1 << (8 - nBits)) - 1));
7575
}
7676

7777
return vchRet;

0 commit comments

Comments
 (0)