Commit c274f51a authored by Jakob Moser's avatar Jakob Moser
Browse files

Correctly represent hex ids

parent e855f120
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -12,7 +12,12 @@ from poolpay.model.Person import Person

def to_chunked_hex(i: int) -> str:
    i_hex = hex(i).removeprefix("0x")
    chunks = re.findall(r"..", i_hex)

    # We want to pad the hex string to even length, so we can extract chunks of 2
    nearest_even_length = len(i_hex) + len(i_hex) % 2
    i_hex_padded = i_hex.rjust(nearest_even_length, "0")

    chunks = re.findall(r"..", i_hex_padded)
    return ":".join(chunks)