diff --git a/README.rst b/README.rst index 2dd4238..2ea7470 100644 --- a/README.rst +++ b/README.rst @@ -18,6 +18,13 @@ This library is a local tracker of transactions for the Ethereum chain and the B It is a simple interface with the `etherscan `_ and the `bscscan `_ APIs and will save locally the results to gain time and avoid over-calling the APIs. +Announcement +------- + +If you previously used this library with a version inferior to 0.1.3, +please head `here `_ to correct a potential bug in the database. + + Quick Tour ---------- diff --git a/ScanWatch/storage/ScanDataBase.py b/ScanWatch/storage/ScanDataBase.py index b3f22d5..a8fca12 100644 --- a/ScanWatch/storage/ScanDataBase.py +++ b/ScanWatch/storage/ScanDataBase.py @@ -78,16 +78,13 @@ def get_last_block_number(self, address: str, nt_type: NETWORK, net: str, tr_typ :rtype: int """ table = get_transaction_table(address, nt_type, net, tr_type) - selection = f"MAX({table.blockNumber})" - result = self.get_conditions_rows(table, selection=selection) + selection = str(table.blockNumber) + query = self.get_conditions_rows(table, selection=selection) default = 0 try: - result = result[0][0] - except IndexError: + return max([int(e[0]) for e in query]) + except ValueError: return default - if result is None: - return default - return int(result)