X-Git-Url: https://git.novaco.in/?p=stratum-mining.git;a=blobdiff_plain;f=lib%2Futil.py;fp=lib%2Futil.py;h=45da424f72895accbf35feaa5b9abb111cc1d2c5;hp=3e88fd8be0c37948c11bd0cf384d358443197c09;hb=96e8e7e2937ea62757627350c3ea83f5bbae9772;hpb=fa88ef8cb19bf006cacb988a0ce42a86f72bcb23 diff --git a/lib/util.py b/lib/util.py index 3e88fd8..45da424 100644 --- a/lib/util.py +++ b/lib/util.py @@ -188,11 +188,16 @@ def deser_uint256_be(f): r += t << (i * 32) return r -def ser_number(num): +def ser_number(n): # For encoding nHeight into coinbase - d = struct.pack(" 127: + s[0] += 1 + s.append(n % 256) + n //= 256 + s.append(n) + return bytes(s) + def script_to_address(addr): d = address_to_pubkeyhash(addr) if not d: