Fix masking of irrelevant bits in address groups.#6556
Conversation
|
Nice catch. Changing the | into an & seems simpler, though. |
|
Agreed, the |
|
I thought about |
|
Good point, we shouldn't change the existing behaviour. ACK |
|
utACK. |
|
utACK. |
|
Ok writing unit test. I have a question about |
|
Yes, that check seems to be redundant. But let's leave removing it for another pull. Thanks for adding tests. |
5d7887e add unit test for CNetAddr::GetGroup. (Alex Morcos) f0e0aca Fix masking of irrelevant bits in address groups. (Alex Morcos) Pull request description: Backport of bitcoin#6556 Original description: > If I'm reading this right, I believe the intent is to keep the high order nBits and mask away the others with 1's. But before this fix it was keeping the high order (8 - nBits). I don't think there was any effect, because the only time this was used was in the case of he.net /36 IPv6 groups so nBits was 4. ACKs for top commit: random-zebra: utACK 5d7887e furszy: utACK 5d7887e Tree-SHA512: 8cc095561918c838b46dd7b957ab5a7acc8788fa568b760157f026e012bada4d6dc5b7f6c4b2dfc58dc3f05382237bb265c61cc4c76175aff9341dafeea567e8
If I'm reading this right, I believe the intent is to keep the high order nBits and mask away the others with 1's. But before this fix it was keeping the high order (8 - nBits). I don't think there was any effect, because the only time this was used was in the case of he.net /36 IPv6 groups so nBits was 4.