Skip to content

Commit

Permalink
Handle new seq address
Browse files Browse the repository at this point in the history
  • Loading branch information
moraygrieve committed Feb 6, 2025
1 parent 9e5fd8b commit ee44b2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion admin/check_tx_count/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def execute(self):
sequencer_count = web3.eth.get_transaction_count(sequencer_address)
self.log.info('Sequencer tx count %d', sequencer_count)
self.counts_db.insert_count('Sequencer', sequencer_address, self.env, current_time, sequencer_count)
entries = self.counts_db.get_last_hour('Sequencer', self.env, current_time - 7200)
entries = self.counts_db.get_last_hour('Sequencer', sequencer_address, self.env, current_time - 7200)

# make sure we have at least 2 entries recorded within the last two hours
if len(entries) >= 2:
Expand Down
12 changes: 6 additions & 6 deletions src/python/ten/test/persistence/counts.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class CountsPersistence:
"PRIMARY KEY (name, environment, time))"
SQL_INSERT = "INSERT INTO counts VALUES (?, ?, ?, ?, ?)"
SQL_DELETE = "DELETE from counts WHERE environment=?"
SQL_SELTHR = "SELECT time, count FROM counts WHERE name=? and environment=? ORDER BY time DESC LIMIT 3"
SQL_SELHOR = "SELECT time, count FROM counts WHERE name=? and environment=? and time >= ? ORDER BY time DESC"
SQL_SELTHR = "SELECT time, count FROM counts WHERE name=? AND address = ? AND environment=? ORDER BY time DESC LIMIT 3"
SQL_SELHOR = "SELECT time, count FROM counts WHERE name=? AND address = ? AND environment=? and time >= ? ORDER BY time DESC"

@classmethod
def init(cls, use_remote, user_dir, host):
Expand Down Expand Up @@ -58,12 +58,12 @@ def insert_count(self, name, address, environment, time, count):
self.cursor.execute(self.sqlins, (name, address, environment, time, str(count)))
self.dbconnection.connection.commit()

def get_last_three_counts(self, name, environment):
def get_last_three_counts(self, name, address, environment):
"""Return the transaction count with time for a particular logical account."""
self.cursor.execute(self.sqlthr, (name, environment))
self.cursor.execute(self.sqlthr, (name, address, environment))
return self.cursor.fetchall()

def get_last_hour(self, name, environment, time):
def get_last_hour(self, name, address, environment, time):
"""Return the transaction count with time for a particular logical account."""
self.cursor.execute(self.sqlhor, (name, environment, time))
self.cursor.execute(self.sqlhor, (name, address, environment, time))
return self.cursor.fetchall()

0 comments on commit ee44b2c

Please sign in to comment.