Skip to content

Commit

Permalink
Remove aliased address type functions to resolve the correct network (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
wizz-wallet-dev authored Jun 21, 2024
1 parent e107bdf commit 747eb85
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions electrumx/lib/script2addr.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,19 +220,19 @@ def hash_160(x: bytes) -> bytes:


def hash160_to_p2pkh(h160: bytes) -> str:
return hash160_to_b58_address(h160, ADDRTYPE_P2PKH)
return hash160_to_b58_address(h160, get_addr_type_p2pkh())


def hash160_to_p2sh(h160: bytes) -> str:
return hash160_to_b58_address(h160, ADDRTYPE_P2SH)
return hash160_to_b58_address(h160, get_addr_type_p2sh())


def public_key_to_p2pkh(public_key: bytes) -> str:
return hash160_to_p2pkh(hash_160(public_key))


def hash_to_segwit_addr(h: bytes, witver: int) -> str:
addr = segwit_addr.encode(SEGWIT_HRP, witver, h)
addr = segwit_addr.encode(get_segwit_hrp(), witver, h)
assert addr is not None
return addr

Expand Down Expand Up @@ -273,11 +273,6 @@ def get_segwit_hrp():
return value


ADDRTYPE_P2PKH = get_addr_type_p2pkh()
ADDRTYPE_P2SH = get_addr_type_p2sh()
SEGWIT_HRP = get_segwit_hrp()


def get_address_from_output_script(_bytes: bytes) -> Optional[str]:
try:
decoded = [x for x in script_GetOp(_bytes)]
Expand Down

0 comments on commit 747eb85

Please sign in to comment.