aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2019-10-30 10:30:36 -0400
committerJohn Newbery <john@johnnewbery.com>2019-10-30 10:53:19 -0400
commit3b9b38579c59d5b31bd75103618776eafc05c132 (patch)
tree1651d52bbbb690c6b857494be2f4c17d5ec03a1b
parenta760aa14a974cc18fa70a91f87a96a3db395a624 (diff)
downloadbitcoin-3b9b38579c59d5b31bd75103618776eafc05c132.tar.xz
[tests] remove bn_bytes() function
It is one line and is called in one place.
-rw-r--r--test/functional/test_framework/bignum.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/test/functional/test_framework/bignum.py b/test/functional/test_framework/bignum.py
index ed440a2cd8..c34704aa0c 100644
--- a/test/functional/test_framework/bignum.py
+++ b/test/functional/test_framework/bignum.py
@@ -9,17 +9,12 @@ endian format.
This file is copied from python-bitcoinlib.
"""
-def bn_bytes(v):
- """Return number of bytes in integer representation of v."""
- return (v.bit_length() + 7) // 8
-
def bn2bin(v):
"""Convert a number to a byte array."""
s = bytearray()
- i = bn_bytes(v)
- while i > 0:
+ bytes_len = (v.bit_length() + 7) // 8
+ for i in range(bytes_len, 0, -1):
s.append((v >> ((i - 1) * 8)) & 0xff)
- i -= 1
return s
def bn2mpi(v):