Skip to content

Commit 2cb4cf7

Browse files
committed
Rename b58_digits -> B58_DIGITS
Is a constant
1 parent ad72884 commit 2cb4cf7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

bitcoin/base58.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
import bitcoin.core
2828

29-
b58_digits = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
29+
B58_DIGITS = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
3030

3131
class Base58Error(Exception):
3232
pass
@@ -48,7 +48,7 @@ def encode(b):
4848
res = []
4949
while n > 0:
5050
n, r = divmod(n, 58)
51-
res.append(b58_digits[r])
51+
res.append(B58_DIGITS[r])
5252
res = ''.join(res[::-1])
5353

5454
# Encode leading zeros as base58 zeros
@@ -62,7 +62,7 @@ def encode(b):
6262
pad += 1
6363
else:
6464
break
65-
return b58_digits[0] * pad + res
65+
return B58_DIGITS[0] * pad + res
6666

6767
def decode(s):
6868
"""Decode a base58-encoding string, returning bytes"""
@@ -73,9 +73,9 @@ def decode(s):
7373
n = 0
7474
for c in s:
7575
n *= 58
76-
if c not in b58_digits:
76+
if c not in B58_DIGITS:
7777
raise InvalidBase58Error('Character %r is not a valid base58 character' % c)
78-
digit = b58_digits.index(c)
78+
digit = B58_DIGITS.index(c)
7979
n += digit
8080

8181
# Convert the integer to bytes
@@ -87,7 +87,7 @@ def decode(s):
8787
# Add padding back.
8888
pad = 0
8989
for c in s[:-1]:
90-
if c == b58_digits[0]: pad += 1
90+
if c == B58_DIGITS[0]: pad += 1
9191
else: break
9292
return b'\x00' * pad + res
9393

0 commit comments

Comments
 (0)