From 2740493bef93b88f225ee97d16e9d73faee1b8e7 Mon Sep 17 00:00:00 2001 From: fubuloubu <3859395+fubuloubu@users.noreply.github.com> Date: Sun, 24 Nov 2024 13:59:30 -0500 Subject: [PATCH] fix: encode transaction hash correctly --- silverback/middlewares.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/silverback/middlewares.py b/silverback/middlewares.py index ef97206c..37fe5f09 100644 --- a/silverback/middlewares.py +++ b/silverback/middlewares.py @@ -24,12 +24,15 @@ def compute_block_time() -> int: self.block_time = self.chain_manager.provider.network.block_time or compute_block_time() def pre_send(self, message: TaskiqMessage) -> TaskiqMessage: - # TODO: Necessary because bytes/HexBytes doesn't encode/deocde well for some reason + # TODO: Necessary because bytes/HexBytes doesn't encode/decode well for some reason def fix_dict(data: dict, recurse_count: int = 0) -> dict: fixed_data: dict[str, Any] = {} for name, value in data.items(): if isinstance(value, bytes): fixed_data[name] = to_hex(value) + elif name == "transaction_hash" and isinstance(value, list): + # TODO: Why is it a list now? (as of Ape v0.8.19ish) + fixed_data[name] = to_hex(bytearray(value)) elif isinstance(value, dict): if recurse_count > 3: raise RecursionError("Event object is too deep")