|
|
|
|
@ -55,12 +55,10 @@ class QETransactionListModel(QAbstractListModel, QtEventListener):
|
|
|
|
|
if adb != self.wallet.adb: |
|
|
|
|
return |
|
|
|
|
self._logger.debug(f'adb_set_future_tx event for txid {txid}') |
|
|
|
|
i = 0 |
|
|
|
|
for item in self.tx_history: |
|
|
|
|
for i, item in enumerate(self.tx_history): |
|
|
|
|
if 'txid' in item and item['txid'] == txid: |
|
|
|
|
self._update_future_txitem(i) |
|
|
|
|
return |
|
|
|
|
i = i + 1 |
|
|
|
|
|
|
|
|
|
def rowCount(self, index): |
|
|
|
|
return len(self.tx_history) |
|
|
|
|
@ -193,8 +191,7 @@ class QETransactionListModel(QAbstractListModel, QtEventListener):
|
|
|
|
|
self._dirty = False |
|
|
|
|
|
|
|
|
|
def on_tx_verified(self, txid, info): |
|
|
|
|
i = 0 |
|
|
|
|
for tx in self.tx_history: |
|
|
|
|
for i, tx in enumerate(self.tx_history): |
|
|
|
|
if 'txid' in tx and tx['txid'] == txid: |
|
|
|
|
tx['height'] = info.height |
|
|
|
|
tx['confirmations'] = info.conf |
|
|
|
|
@ -205,7 +202,6 @@ class QETransactionListModel(QAbstractListModel, QtEventListener):
|
|
|
|
|
roles = [self._ROLE_RMAP[x] for x in ['section','height','confirmations','timestamp','date']] |
|
|
|
|
self.dataChanged.emit(index, index, roles) |
|
|
|
|
return |
|
|
|
|
i = i + 1 |
|
|
|
|
|
|
|
|
|
def _update_future_txitem(self, tx_item_idx: int): |
|
|
|
|
tx_item = self.tx_history[tx_item_idx] |
|
|
|
|
@ -227,20 +223,17 @@ class QETransactionListModel(QAbstractListModel, QtEventListener):
|
|
|
|
|
|
|
|
|
|
@pyqtSlot(str, str) |
|
|
|
|
def update_tx_label(self, key, label): |
|
|
|
|
i = 0 |
|
|
|
|
for tx in self.tx_history: |
|
|
|
|
for i, tx in enumerate(self.tx_history): |
|
|
|
|
if tx['key'] == key: |
|
|
|
|
tx['label'] = label |
|
|
|
|
index = self.index(i,0) |
|
|
|
|
self.dataChanged.emit(index, index, [self._ROLE_RMAP['label']]) |
|
|
|
|
return |
|
|
|
|
i = i + 1 |
|
|
|
|
|
|
|
|
|
@pyqtSlot(int) |
|
|
|
|
def updateBlockchainHeight(self, height): |
|
|
|
|
self._logger.debug('updating height to %d' % height) |
|
|
|
|
i = 0 |
|
|
|
|
for tx_item in self.tx_history: |
|
|
|
|
for i, tx_item in enumerate(self.tx_history): |
|
|
|
|
if 'height' in tx_item: |
|
|
|
|
if tx_item['height'] > 0: |
|
|
|
|
tx_item['confirmations'] = height - tx_item['height'] + 1 |
|
|
|
|
@ -249,4 +242,3 @@ class QETransactionListModel(QAbstractListModel, QtEventListener):
|
|
|
|
|
self.dataChanged.emit(index, index, roles) |
|
|
|
|
elif tx_item['height'] in (TX_HEIGHT_FUTURE, TX_HEIGHT_LOCAL): |
|
|
|
|
self._update_future_txitem(i) |
|
|
|
|
i = i + 1 |
|
|
|
|
|