Skip to content
Snippets Groups Projects
Commit a915499a authored by inso's avatar inso
Browse files

Refreshing block depending on averageGenTime parameter

parent 66c0adeb
Branches
Tags
No related merge requests found
......@@ -31,6 +31,7 @@ class BlockchainWatcher(QObject):
super().__init__()
self.account = account
self.community = community
self.time_to_wait = int(self.community.get_parameters()['avgGenTime'] / 10)
self.exiting = False
blockid = self.community.current_blockid()
self.last_block = blockid['number']
......@@ -38,7 +39,7 @@ class BlockchainWatcher(QObject):
@pyqtSlot()
def watch(self):
while not self.exiting:
time.sleep(10)
time.sleep(self.time_to_wait)
try:
blockid = self.community.current_blockid()
block_number = blockid['number']
......@@ -150,7 +151,7 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
QModelIndex(),
QModelIndex(),
[])
if self.tablcommunitye_history.model():
if self.table_history.model():
self.table_history.model().dataChanged.emit(
QModelIndex(),
QModelIndex(),
......
......@@ -36,8 +36,10 @@ class MembersFilterProxyModel(QSortFilterProxyModel):
expiration_index = self.sourceModel().index(source_index.row(), expiration_col)
expiration_data = self.sourceModel().data(expiration_index, Qt.DisplayRole)
current_time = QDateTime().currentDateTime().toMSecsSinceEpoch()
sig_validity = self.community.get_parameters()['sigValidity']
warning_expiration_time = int(sig_validity / 3)
#logging.debug("{0} > {1}".format(current_time, expiration_data))
will_expire_soon = (current_time > expiration_data *1000 - 15*24*3600*1000)
will_expire_soon = (current_time > expiration_data*1000 - warning_expiration_time*1000)
if role == Qt.DisplayRole:
if source_index.column() == self.sourceModel().columns.index('Join date'):
date = QDateTime.fromTime_t(source_data)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment