fixed natural_to_string's encoding of 0
[p2pool.git] / p2pool / util / math.py
index c13494f..c45d1ec 100644 (file)
@@ -179,7 +179,7 @@ def natural_to_string(n, alphabet=None):
     if n < 0:
         raise TypeError('n must be a natural')
     if alphabet is None:
-        s = '%x' % (n,)
+        s = ('%x' % (n,)).lstrip('0')
         if len(s) % 2:
             s = '0' + s
         return s.decode('hex')