Commit 17fdbef
committed
Merge bitcoin/bitcoin#23970: Remove pointless and confusing shift in RelayAddress
fa9f455 refactor: Remove pointless and confusing shift in RelayAddress (MarcoFalke)
Pull request description:
The second argument written to the siphash is already quantized to 24 hours, so it seems confusing to quantize the first argument to 32 bits (out of 64 bits).
> The shifting is pointless, we should get rid of it. It seems to be a silly evolution of this 2010 Satoshi code: 5cbf753 (where it made sense because everything was XORed together, and the address used the high bits, while the time used the low ones).
(Copied from bitcoin/bitcoin#18642 (comment))
(The original code was `uint256 hashRand = hashSalt ^ (((int64)addr.ip)<<32) ^ ((GetTime()+addr.ip)/(24*60*60));`)
This also allows to remove a integer sanitizer suppression for the whole file.
ACKs for top commit:
laanwj:
Code review ACK fa9f455
sipa:
utACK fa9f455
promag:
Code review ACK fa9f455.
Tree-SHA512: f5fd107464ccd839d6749aed6914b4935e39ab42906546b3f3810a7339fc4633fef931a1783a287572af5ec64525626fa91d147d8ff52eb076740465bf5cf8392 files changed
+2
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1746 | 1746 | | |
1747 | 1747 | | |
1748 | 1748 | | |
1749 | | - | |
1750 | | - | |
| 1749 | + | |
| 1750 | + | |
1751 | 1751 | | |
1752 | 1752 | | |
1753 | 1753 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
109 | 108 | | |
110 | 109 | | |
0 commit comments