diff options
author | John Newbery <john@johnnewbery.com> | 2019-10-30 10:13:17 -0400 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2019-10-30 10:52:33 -0400 |
commit | f31fc0e92efae793af840c9a46e765c20e0899b4 (patch) | |
tree | bdf2f3b80fb980e78397866e0520d2bd9de46e8a /test/functional/test_framework/bignum.py | |
parent | 6a97e8a060f7632bbaee27d3de8035dc6ebe3895 (diff) |
[tests] fix flake8 warnings in script.py and bignum.py
Diffstat (limited to 'test/functional/test_framework/bignum.py')
-rw-r--r-- | test/functional/test_framework/bignum.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/test/functional/test_framework/bignum.py b/test/functional/test_framework/bignum.py index db5ccd62c2..0dd4ea4b42 100644 --- a/test/functional/test_framework/bignum.py +++ b/test/functional/test_framework/bignum.py @@ -4,25 +4,24 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Big number routines. +Functions for converting numbers to MPI format and Bitcoin-specific little +endian format. + This file is copied from python-bitcoinlib. """ - import struct - -# generic big endian MPI format - def bn_bytes(v, have_ext=False): ext = 0 if have_ext: ext = 1 - return ((v.bit_length()+7)//8) + ext + return (v.bit_length() + 7) // 8 + ext def bn2bin(v): s = bytearray() i = bn_bytes(v) while i > 0: - s.append((v >> ((i-1) * 8)) & 0xff) + s.append((v >> ((i - 1) * 8)) & 0xff) i -= 1 return s |