Merge bitcoin/bitcoin#28727: test: replace random_bytes with random.randbytes

fe3ac3700d test: replace random_bytes with randbytes #28720 (ns-xvrn)

Pull request description:

  With Python upgraded to 3.9 replaced the `random_bytes` function in util of functional tests and replaced it's usage with `random.randbytes`.

  Closes #28720.

ACKs for top commit:
  maflcko:
    lgtm ACK fe3ac3700d
  BrandonOdiwuor:
    ACK fe3ac3700d
  stickies-v:
    ACK fe3ac3700d, thanks for picking this up
  kristapsk:
    utACK fe3ac3700d

Tree-SHA512: f65a75e73ebd840c2936eb133d42bccd552f25b717c8ca25c18d06e0593e12f292389cfcc0a0b0759004b67a46ea0c8ac237973ef90f246139778230be1e64e1
This commit is contained in:
fanquake
2023-10-29 10:11:24 +01:00
5 changed files with 35 additions and 44 deletions

View File

@ -13,7 +13,6 @@ import json
import logging
import os
import pathlib
import random
import re
import sys
import time
@ -287,12 +286,6 @@ def sha256sum_file(filename):
return h.digest()
# TODO: Remove and use random.randbytes(n) directly
def random_bytes(n):
"""Return a random bytes object of length n."""
return random.randbytes(n)
# RPC/P2P connection constants and functions
############################################