From 1d895f1a07a7ff6ddfc816b30a5d03aa1c687001 Mon Sep 17 00:00:00 2001 From: Paul Lange Date: Mon, 4 Oct 2021 16:21:05 +0200 Subject: [PATCH 1/2] Remove unnecessary local variables --- src/monitoring_service/handlers.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/monitoring_service/handlers.py b/src/monitoring_service/handlers.py index a386f5bf..013a0512 100644 --- a/src/monitoring_service/handlers.py +++ b/src/monitoring_service/handlers.py @@ -464,14 +464,11 @@ def action_monitoring_triggered_event_handler(event: Event, context: Context) -> ) return - latest_block = context.web3.eth.block_number - last_confirmed_block = context.latest_confirmed_block - user_address = monitor_request.non_closing_signer user_deposit = get_pessimistic_udc_balance( udc=context.user_deposit_contract, - address=user_address, - from_block=last_confirmed_block, - to_block=latest_block, + address=monitor_request.non_closing_signer, + from_block=context.latest_confirmed_block, + to_block=context.get_latest_unconfirmed_block(), ) if monitor_request.reward_amount < context.min_reward: log.info( @@ -488,7 +485,9 @@ def action_monitoring_triggered_event_handler(event: Event, context: Context) -> min_reward=context.min_reward, ) context.database.upsert_scheduled_event( - ScheduledEvent(trigger_block_number=BlockNumber(last_confirmed_block + 1), event=event) + ScheduledEvent( + trigger_block_number=BlockNumber(context.latest_confirmed_block + 1), event=event + ) ) return From 2ca88dfec87e0373fd48ceebcb3bbfdea4e42b90 Mon Sep 17 00:00:00 2001 From: Paul Lange Date: Mon, 4 Oct 2021 17:12:17 +0200 Subject: [PATCH 2/2] Remove wrong increment This was not removed when the surrroundiung `range` call was removed. As this is now the limit, we don't want to increment that here. --- src/raiden_libs/blockchain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/raiden_libs/blockchain.py b/src/raiden_libs/blockchain.py index 009b10f1..7161f4c9 100644 --- a/src/raiden_libs/blockchain.py +++ b/src/raiden_libs/blockchain.py @@ -285,7 +285,7 @@ def get_pessimistic_udc_balance( """ return min( udc.functions.effectiveBalance(address).call(block_identifier=BlockNumber(block)) - for block in [from_block, to_block + 1] + for block in (from_block, to_block) )