Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

random: port some upstream changes #2696

Merged
merged 8 commits into from
Aug 20, 2023

Commits on Aug 6, 2023

  1. [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.
    jnewbery authored and div72 committed Aug 6, 2023
    Configuration menu
    Copy the full SHA
    28303b6 View commit details
    Browse the repository at this point in the history
  2. [refactor] Use uint64_t and std namespace in PoissonNextSend

    Co-authored-by: Martin Zumsande <mzumsande@gmail.com>
    2 people authored and div72 committed Aug 6, 2023
    Configuration menu
    Copy the full SHA
    e5dc985 View commit details
    Browse the repository at this point in the history
  3. 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-
    jnewbery authored and div72 committed Aug 6, 2023
    Configuration menu
    Copy the full SHA
    0094a0b View commit details
    Browse the repository at this point in the history
  4. random: use arc4random on OpenBSD

    Following best practices on OpenBSD. The getentropy(2) man page states:
    "getentropy() is not intended for regular code;
     please use the arc4random(3) family of functions instead."
    theStack authored and div72 committed Aug 6, 2023
    Configuration menu
    Copy the full SHA
    f2589ba View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ce75abc View commit details
    Browse the repository at this point in the history
  6. refactor: use Span in random.*

    PastaPastaPasta authored and div72 committed Aug 6, 2023
    Configuration menu
    Copy the full SHA
    8d784b2 View commit details
    Browse the repository at this point in the history
  7. refactor: make GetRand a template, remove GetRandInt

    Co-authored-by: div72 <noreply@div72.xyz>
    PastaPastaPasta and div72 committed Aug 6, 2023
    Configuration menu
    Copy the full SHA
    7191dfd View commit details
    Browse the repository at this point in the history
  8. util: remove unneeded GetPerformanceCounter

    Rationale:
        This duplicate of GetPerformanceCounter was only used in
        src/addrdb.cpp, with 7191dfd
        removing this we can safely remove this function.
    div72 committed Aug 6, 2023
    Configuration menu
    Copy the full SHA
    46f29ab View commit details
    Browse the repository at this point in the history