From 6f4312cb4f8d051150c93a4cd9e850de67883988 Mon Sep 17 00:00:00 2001 From: Julien Riou Date: Sun, 7 Feb 2021 09:22:54 +0100 Subject: [PATCH] Bugfix state with zero balance Signed-off-by: Julien Riou --- main.py | 2 +- state.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 8ab3ec3..11bf80f 100644 --- a/main.py +++ b/main.py @@ -79,7 +79,7 @@ def main(): last_balance, last_transaction = handler.watch_miner(address=config['miner'], last_balance=pool_state.get('balance'), last_transaction=pool_state.get('payment')) - if last_balance: + if last_balance is not None: logger.debug(f'saving {pool} miner balance to state file') state.write(pool_name=pool, miner_balance=last_balance) if last_transaction: diff --git a/state.py b/state.py index e1a9537..423fbe8 100644 --- a/state.py +++ b/state.py @@ -22,7 +22,7 @@ class State: content[pool_name] = {} if block_number: content[pool_name]['block'] = block_number - if miner_balance: + if miner_balance is not None: content[pool_name]['balance'] = miner_balance if miner_payment: content[pool_name]['payment'] = miner_payment