Commit 6d859cb
committed
Merge bitcoin#24021: Rename and move PoissonNextSend functions
9b8dcb2 [net processing] Rename PoissonNextSendInbound to NextInvToInbounds (John Newbery)
ea99f5d [net processing] Move PoissonNextSendInbound to PeerManager (John Newbery)
bb06074 scripted-diff: replace PoissonNextSend with GetExponentialRand (John Newbery)
03cfa1b [refactor] Use uint64_t and std namespace in PoissonNextSend (John Newbery)
9e64d69 [move] Move PoissonNextSend to src/random and update comment (John Newbery)
Pull request description:
`PoissonNextSend` and `PoissonNextSendInbound` are used in the p2p code to obfuscate various regularly occurring processes, in order to make it harder for others to get timing-based information deterministically.
The naming of these functions has been confusing to several people (including myself, see also bitcoin#23347) because the resulting random timestamps don't follow a Poisson distribution but an exponential distribution (related to events in a Poisson process, hence the name). This PR
- moves `PoissonNextSend()` out of `net` to `random` and renames it to `GetExponentialRand()`
- moves `PoissonNextSendInbound()` out of `CConnman` to `PeerManager` and renames it to `NextInvToInbounds()`
- adds documentation for these functions
This is work by jnewbery - due to him being less active currently, I opened the PR and will address feedback.
ACKs for top commit:
jnewbery:
ACK 9b8dcb2
hebasto:
ACK 9b8dcb2, I have reviewed the code and it looks OK, I agree it can be merged.
theStack:
ACK 9b8dcb2 📊
Tree-SHA512: 85c366c994e7147f9981fe863fb9838502643fa61ffd32d55a43feef96a38b79a5daa2c4d38ce01074897cc95fa40c76779816edad53f5265b81b05c3a1f4f50File tree
6 files changed
+53
-45
lines changed- src
- test/fuzz
6 files changed
+53
-45
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1878 | 1878 | | |
1879 | 1879 | | |
1880 | 1880 | | |
1881 | | - | |
1882 | | - | |
| 1881 | + | |
| 1882 | + | |
1883 | 1883 | | |
1884 | 1884 | | |
1885 | 1885 | | |
| |||
1999 | 1999 | | |
2000 | 2000 | | |
2001 | 2001 | | |
2002 | | - | |
| 2002 | + | |
2003 | 2003 | | |
2004 | 2004 | | |
2005 | 2005 | | |
| |||
2008 | 2008 | | |
2009 | 2009 | | |
2010 | 2010 | | |
2011 | | - | |
| 2011 | + | |
2012 | 2012 | | |
2013 | 2013 | | |
2014 | | - | |
| 2014 | + | |
2015 | 2015 | | |
2016 | 2016 | | |
2017 | 2017 | | |
| |||
3058 | 3058 | | |
3059 | 3059 | | |
3060 | 3060 | | |
3061 | | - | |
3062 | | - | |
3063 | | - | |
3064 | | - | |
3065 | | - | |
3066 | | - | |
3067 | | - | |
3068 | | - | |
3069 | | - | |
3070 | | - | |
3071 | | - | |
3072 | | - | |
3073 | | - | |
3074 | | - | |
3075 | | - | |
3076 | | - | |
3077 | | - | |
3078 | 3061 | | |
3079 | 3062 | | |
3080 | 3063 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
936 | 936 | | |
937 | 937 | | |
938 | 938 | | |
939 | | - | |
940 | | - | |
941 | | - | |
942 | | - | |
943 | | - | |
944 | | - | |
945 | 939 | | |
946 | 940 | | |
947 | 941 | | |
| |||
1221 | 1215 | | |
1222 | 1216 | | |
1223 | 1217 | | |
1224 | | - | |
1225 | | - | |
1226 | 1218 | | |
1227 | 1219 | | |
1228 | 1220 | | |
| |||
1270 | 1262 | | |
1271 | 1263 | | |
1272 | 1264 | | |
1273 | | - | |
1274 | | - | |
1275 | | - | |
1276 | 1265 | | |
1277 | 1266 | | |
1278 | 1267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
| 453 | + | |
| 454 | + | |
453 | 455 | | |
454 | 456 | | |
455 | 457 | | |
| |||
524 | 526 | | |
525 | 527 | | |
526 | 528 | | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
527 | 538 | | |
528 | 539 | | |
529 | 540 | | |
| |||
825 | 836 | | |
826 | 837 | | |
827 | 838 | | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
828 | 851 | | |
829 | 852 | | |
830 | 853 | | |
| |||
4434 | 4457 | | |
4435 | 4458 | | |
4436 | 4459 | | |
4437 | | - | |
| 4460 | + | |
4438 | 4461 | | |
4439 | 4462 | | |
4440 | 4463 | | |
4441 | 4464 | | |
4442 | 4465 | | |
4443 | | - | |
| 4466 | + | |
4444 | 4467 | | |
4445 | 4468 | | |
4446 | 4469 | | |
| |||
4512 | 4535 | | |
4513 | 4536 | | |
4514 | 4537 | | |
4515 | | - | |
| 4538 | + | |
4516 | 4539 | | |
4517 | 4540 | | |
4518 | 4541 | | |
| |||
4792 | 4815 | | |
4793 | 4816 | | |
4794 | 4817 | | |
4795 | | - | |
| 4818 | + | |
4796 | 4819 | | |
4797 | | - | |
| 4820 | + | |
4798 | 4821 | | |
4799 | 4822 | | |
4800 | 4823 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
714 | 715 | | |
715 | 716 | | |
716 | 717 | | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
85 | 97 | | |
86 | 98 | | |
87 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | 100 | | |
107 | 101 | | |
108 | 102 | | |
| |||
0 commit comments