From 920cd177b4b95127c87ef19e82bf70681b29aed5 Mon Sep 17 00:00:00 2001 From: Manu NALEPA Date: Wed, 28 Jun 2023 13:40:19 +0200 Subject: [PATCH] Fix #53: Handle the case where `transaction.to` is `None` --- eth_validator_watcher/fee_recipient.py | 5 ++++- eth_validator_watcher/models.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/eth_validator_watcher/fee_recipient.py b/eth_validator_watcher/fee_recipient.py index ee9ddca..f134f8c 100644 --- a/eth_validator_watcher/fee_recipient.py +++ b/eth_validator_watcher/fee_recipient.py @@ -65,7 +65,10 @@ def process_fee_recipient( try: *_, last_transaction = transactions - if expected_fee_recipient == last_transaction.to: + if ( + last_transaction.to is not None + and expected_fee_recipient == last_transaction.to + ): # The last transaction is to the expected fee recipient return except ValueError: diff --git a/eth_validator_watcher/models.py b/eth_validator_watcher/models.py index e233b98..966fdfb 100644 --- a/eth_validator_watcher/models.py +++ b/eth_validator_watcher/models.py @@ -1,6 +1,7 @@ """Contains the models for the validator watcher.""" from enum import Enum +from typing import Optional from pydantic import BaseModel @@ -176,7 +177,7 @@ class EthGetBlockByHashRequest(BaseModel): class ExecutionBlock(BaseModel): class Result(BaseModel): class Transaction(BaseModel): - to: str + to: Optional[str] transactions: list[Transaction]