Skip to content

Commit bfd29da

Browse files
committed
uint256_to_str
1 parent 08ed5b2 commit bfd29da

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

bitcoin/core/serialize.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,12 @@ def compact_from_uint256(v):
336336

337337
return compact | nbytes << 24
338338

339+
def uint256_to_str(u):
340+
r = ""
341+
for i in range(8):
342+
r += struct.pack('<I', u >> (i * 32) & 0xffff)
343+
return r
344+
339345
def uint256_to_shortstr(u):
340346
s = "%064x" % (u,)
341347
return s[:16]

0 commit comments

Comments
 (0)