mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Merge bitcoin/bitcoin#24976: netgroup: Follow-up for #22910
e5d183151709ab59d2fa6fe9e0243000e8d6abbe [netgroup] Use nStartByte as offset for the last byte of the group (dergoegge) Pull request description: This addresses my review [comments](https://github.com/bitcoin/bitcoin/pull/22910#discussion_r856095896) 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 e5d183151709ab59d2fa6fe9e0243000e8d6abbe theStack: Concept and code-review ACK e5d183151709ab59d2fa6fe9e0243000e8d6abbe Tree-SHA512: 4c08c7d6cb38b553e998798b3e3b790177aaa2141a48e277dfd538e01a7fccadf644329e93c5b0fb5e7e4037494c8dfe061b94eb52c6b31dc21bdf99eb0e311a
This commit is contained in:
parent
656f525855
commit
1288494d4a
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user