1
0
mirror of https://github.com/bitcoin/bips.git synced 2026-07-27 18:13:38 +00:00

bip360: much cleaner, more readable s2w function

This commit is contained in:
notmike
2026-06-26 19:51:40 -06:00
parent 9bf46b5cfe
commit ac2aa2ff7d

View File

@@ -48,7 +48,7 @@ def h2b(h: str) -> bytes:
def s2w(script: str) -> List[int]: def s2w(script: str) -> List[int]:
"""Convert a script/witprog hex string to a List[int] of its bytes""" """Convert a script/witprog hex string to a List[int] of its bytes"""
return [int(f"{script[i:i + 2]}", 16) for i in range(0, len(script), 2)] return list(h2b(script))
def get_compact_size(n: int) -> bytes: def get_compact_size(n: int) -> bytes: