Skip to content

Commit 3b9b385

Browse files
committed
[tests] remove bn_bytes() function
It is one line and is called in one place.
1 parent a760aa1 commit 3b9b385

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

test/functional/test_framework/bignum.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,12 @@
99
1010
This file is copied from python-bitcoinlib.
1111
"""
12-
def bn_bytes(v):
13-
"""Return number of bytes in integer representation of v."""
14-
return (v.bit_length() + 7) // 8
15-
1612
def bn2bin(v):
1713
"""Convert a number to a byte array."""
1814
s = bytearray()
19-
i = bn_bytes(v)
20-
while i > 0:
15+
bytes_len = (v.bit_length() + 7) // 8
16+
for i in range(bytes_len, 0, -1):
2117
s.append((v >> ((i - 1) * 8)) & 0xff)
22-
i -= 1
2318
return s
2419

2520
def bn2mpi(v):

0 commit comments

Comments
 (0)