Make output of manage_clvm more readable on failure (#15658)
This commit is contained in:
parent
424c51072d
commit
4b77fb3dd1
|
@ -13,6 +13,8 @@ import typing
|
|||
import click
|
||||
import typing_extensions
|
||||
|
||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||
|
||||
here = pathlib.Path(__file__).parent.resolve()
|
||||
root = here.parent
|
||||
cache_path = root.joinpath(".chia_cache", "manage_clvm.json")
|
||||
|
@ -99,7 +101,7 @@ def dump_cache(cache: Cache, file: typing.IO[str]) -> None:
|
|||
json.dump(cache, file, indent=4)
|
||||
|
||||
|
||||
def generate_hash_bytes(hex_bytes: bytes) -> bytes:
|
||||
def generate_hash_bytes(hex_bytes: bytes) -> bytes32:
|
||||
cleaned_blob = bytes.fromhex(hex_bytes.decode("utf-8"))
|
||||
serialize_program = SerializedProgram.from_bytes(cleaned_blob)
|
||||
return serialize_program.get_tree_hash()
|
||||
|
@ -141,7 +143,7 @@ class ClvmBytes:
|
|||
hex_bytes = paths.hex.read_bytes()
|
||||
return cls(
|
||||
hex=hex_bytes,
|
||||
hash=bytes.fromhex(hash_dict[paths.hash])
|
||||
hash=bytes32(bytes.fromhex(hash_dict[paths.hash]))
|
||||
if paths.hash in hash_dict
|
||||
else generate_hash_bytes(hex_bytes=hex_bytes),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue