Skip to content

Commit afd29f1

Browse files
authored
Merge pull request #90 from singnet/fix-duplicate-channels
Fixed duplicating channels in the cache
2 parents 748b021 + f2da5db commit afd29f1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

snet/sdk/mpe/payment_channel_provider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, w3, mpe_contract):
2525

2626
def update_cache(self):
2727
channels = []
28-
last_read_block = self.deployment_block
28+
last_read_block = self.deployment_block - 1
2929

3030
if not self.channels_file.exists():
3131
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):
4545
current_block_number = self.web3.eth.block_number
4646

4747
if last_read_block < current_block_number:
48-
new_channels = self._get_all_channels_from_blockchain_logs_to_dicts(last_read_block, current_block_number)
48+
new_channels = self._get_all_channels_from_blockchain_logs_to_dicts(last_read_block + 1, current_block_number)
4949
channels = channels + new_channels
5050
last_read_block = current_block_number
5151

0 commit comments

Comments
 (0)