mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-26 14:00:29 +01:00
refactor: move helper random_bytes to util library
Can be easily reviewed with `--color-moved=dimmed-zebra`.
This commit is contained in:
@@ -91,7 +91,11 @@ from test_framework.script_util import (
|
||||
script_to_p2wsh_script,
|
||||
)
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_raises_rpc_error, assert_equal
|
||||
from test_framework.util import (
|
||||
assert_raises_rpc_error,
|
||||
assert_equal,
|
||||
random_bytes,
|
||||
)
|
||||
from test_framework.key import generate_privkey, compute_xonly_pubkey, sign_schnorr, tweak_add_privkey, ECKey
|
||||
from test_framework.address import (
|
||||
hash160,
|
||||
@@ -566,10 +570,6 @@ def random_checksig_style(pubkey):
|
||||
ret = CScript([pubkey, opcode])
|
||||
return bytes(ret)
|
||||
|
||||
def random_bytes(n):
|
||||
"""Return a random bytes object of length n."""
|
||||
return bytes(random.getrandbits(8) for i in range(n))
|
||||
|
||||
def bitflipper(expr):
|
||||
"""Return a callable that evaluates expr and returns it with a random bitflip."""
|
||||
def fn(ctx):
|
||||
|
||||
Reference in New Issue
Block a user