From 4dbaa7cc65b9546d07f1f9bfc8fb912b6fb20a5e Mon Sep 17 00:00:00 2001 From: rkrux Date: Tue, 16 Jun 2026 18:36:14 +0530 Subject: [PATCH] test: generalise byte_to_base58 utility function to allow more version types Passing a version in the byte form is allowed now in addition to the integral version type. This will be helpful in the next commit. --- test/functional/test_framework/address.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/functional/test_framework/address.py b/test/functional/test_framework/address.py index d4aa26e58a3..7fb6ddf987d 100644 --- a/test/functional/test_framework/address.py +++ b/test/functional/test_framework/address.py @@ -56,10 +56,12 @@ def create_deterministic_address_bcrt1_p2tr_op_true(explicit_internal_key=None): def byte_to_base58(b, version): - result = '' - b = bytes([version]) + b # prepend version + if isinstance(version, int): + version = bytes([version]) + b = version + b # prepend version b += hash256(b)[:4] # append checksum value = int.from_bytes(b, 'big') + result = '' while value > 0: result = b58chars[value % 58] + result value //= 58