Page MenuHomePhabricator

Rename and move PoissonNextSend functions
ClosedPublic

Authored by PiRK on Nov 10 2023, 16:24.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC5bdaba6ce8ee: Rename and move PoissonNextSend functions
Summary

[move] Move PoissonNextSend to src/random and update comment

PoissonNextSend is used by net and net_processing and is stateless, so
place it in the utility random.cpp translation unit.

[refactor] Use uint64_t and std namespace in PoissonNextSend

Co-authored-by: Martin Zumsande <mzumsande@gmail.com>

scripted-diff: replace PoissonNextSend with GetExponentialRand

This distribution is used for more than just the next inv send, so make
the name more generic.

Also rename to "exponential" to avoid the confusion that this is a
poisson distribution.

-BEGIN VERIFY SCRIPT-
ren() { sed -i "s/\<$1\>/$2/g" $(git grep -l "$1" ./src) ; }

ren PoissonNextSend GetExponentialRand
ren "a poisson timer" "an exponential timer"
-END VERIFY SCRIPT-

[net processing] Move PoissonNextSendInbound to PeerManager

[net processing] Rename PoissonNextSendInbound to NextInvToInbounds

This is a backport of core#24021

Test Plan

ninja all check-all bitcoin-fuzzers