From f2da5dbf262f9acd1c84a98053cb6a4b831471de Mon Sep 17 00:00:00 2001 From: Arondondon Date: Thu, 6 Mar 2025 16:19:23 +0300 Subject: [PATCH] Fixed duplicating channels in the cache --- snet/sdk/mpe/payment_channel_provider.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snet/sdk/mpe/payment_channel_provider.py b/snet/sdk/mpe/payment_channel_provider.py index 48ff5e6..1948abd 100644 --- a/snet/sdk/mpe/payment_channel_provider.py +++ b/snet/sdk/mpe/payment_channel_provider.py @@ -25,7 +25,7 @@ def __init__(self, w3, mpe_contract): def update_cache(self): channels = [] - last_read_block = self.deployment_block + last_read_block = self.deployment_block - 1 if not self.channels_file.exists(): print(f"Channels cache is empty. Caching may take some time when first accessing channels.\nCaching in progress...") @@ -45,7 +45,7 @@ def update_cache(self): current_block_number = self.web3.eth.block_number if last_read_block < current_block_number: - new_channels = self._get_all_channels_from_blockchain_logs_to_dicts(last_read_block, current_block_number) + new_channels = self._get_all_channels_from_blockchain_logs_to_dicts(last_read_block + 1, current_block_number) channels = channels + new_channels last_read_block = current_block_number