HomePhabricator

Rename and move PoissonNextSend functions

Description

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

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D14771

Details

Provenance
John Newbery <john@johnnewbery.com>Authored on Dec 14 2021, 10:15
PiRKCommitted on Nov 13 2023, 09:17
PiRKPushed on Nov 13 2023, 09:17
Reviewer
Restricted Project
Differential Revision
D14771: Rename and move PoissonNextSend functions
Parents
rABC31adc3630ad3: fix OSX build failure related to Span deduction guide in macro
Branches
Unknown
Tags
Unknown