adb: change API of util.TxMinedInfo: height() is now always SPV-ed
This commit is contained in:
@@ -196,7 +196,7 @@ class QETransactionListModel(QAbstractListModel, QtEventListener):
|
||||
def _tx_mined_info_from_tx_item(tx_item: Dict[str, Any]) -> TxMinedInfo:
|
||||
# FIXME a bit hackish to have to reconstruct the TxMinedInfo... same thing in qt-gui
|
||||
tx_mined_info = TxMinedInfo(
|
||||
height=tx_item['height'],
|
||||
_height=tx_item['height'],
|
||||
conf=tx_item['confirmations'],
|
||||
timestamp=tx_item['timestamp'],
|
||||
wanted_height=tx_item.get('wanted_height', None),
|
||||
@@ -229,10 +229,10 @@ class QETransactionListModel(QAbstractListModel, QtEventListener):
|
||||
|
||||
self._dirty = False
|
||||
|
||||
def on_tx_verified(self, txid, info):
|
||||
def on_tx_verified(self, txid: str, info: TxMinedInfo):
|
||||
for i, tx in enumerate(self.tx_history):
|
||||
if 'txid' in tx and tx['txid'] == txid:
|
||||
tx['height'] = info.height
|
||||
tx['height'] = info.height()
|
||||
tx['confirmations'] = info.conf
|
||||
tx['timestamp'] = info.timestamp
|
||||
tx['section'] = self.get_section_by_timestamp(info.timestamp)
|
||||
@@ -255,7 +255,7 @@ class QETransactionListModel(QAbstractListModel, QtEventListener):
|
||||
status, status_str = self.wallet.get_tx_status(txid, txinfo.tx_mined_status)
|
||||
tx_item['date'] = status_str
|
||||
# note: if the height changes, that might affect the history order, but we won't re-sort now.
|
||||
tx_item['height'] = self.wallet.adb.get_tx_height(txid).height
|
||||
tx_item['height'] = self.wallet.adb.get_tx_height(txid).height()
|
||||
index = self.index(tx_item_idx, 0)
|
||||
roles = [self._ROLE_RMAP[x] for x in ['height', 'date']]
|
||||
self.dataChanged.emit(index, index, roles)
|
||||
|
||||
@@ -352,14 +352,14 @@ class QETxDetails(QObject, QtEventListener):
|
||||
|
||||
self._lock_delay = 0
|
||||
self._in_mempool = False
|
||||
self._is_mined = False if not txinfo.tx_mined_status else txinfo.tx_mined_status.height > 0
|
||||
self._is_mined = False if not txinfo.tx_mined_status else txinfo.tx_mined_status.height() > 0
|
||||
if self._is_mined:
|
||||
self.update_mined_status(txinfo.tx_mined_status)
|
||||
else:
|
||||
if txinfo.tx_mined_status.height in [TX_HEIGHT_UNCONFIRMED, TX_HEIGHT_UNCONF_PARENT]:
|
||||
if txinfo.tx_mined_status.height() in [TX_HEIGHT_UNCONFIRMED, TX_HEIGHT_UNCONF_PARENT]:
|
||||
self._mempool_depth = FeePolicy.depth_tooltip(txinfo.mempool_depth_bytes)
|
||||
self._in_mempool = True
|
||||
elif txinfo.tx_mined_status.height == TX_HEIGHT_FUTURE:
|
||||
elif txinfo.tx_mined_status.height() == TX_HEIGHT_FUTURE:
|
||||
self._lock_delay = txinfo.tx_mined_status.wanted_height - self._wallet.wallet.adb.get_local_height()
|
||||
if isinstance(self._tx, PartialTransaction):
|
||||
self._sighash_danger = self._wallet.wallet.check_sighash(self._tx)
|
||||
|
||||
@@ -439,7 +439,7 @@ class HistoryModel(CustomModel, Logger):
|
||||
def _tx_mined_info_from_tx_item(tx_item: Dict[str, Any]) -> TxMinedInfo:
|
||||
# FIXME a bit hackish to have to reconstruct the TxMinedInfo... same thing in qml-gui
|
||||
tx_mined_info = TxMinedInfo(
|
||||
height=tx_item['height'],
|
||||
_height=tx_item['height'],
|
||||
conf=tx_item['confirmations'],
|
||||
timestamp=tx_item['timestamp'],
|
||||
wanted_height=tx_item.get('wanted_height', None),
|
||||
@@ -764,7 +764,7 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
|
||||
return
|
||||
tx_URL = block_explorer_URL(self.config, 'tx', tx_hash)
|
||||
tx_details = self.wallet.get_tx_info(tx)
|
||||
is_unconfirmed = tx_details.tx_mined_status.height <= 0
|
||||
is_unconfirmed = tx_details.tx_mined_status.height() <= 0
|
||||
menu = QMenu()
|
||||
menu.addAction(_("Details"), lambda: self.main_window.show_transaction(tx))
|
||||
if tx_details.can_remove:
|
||||
|
||||
@@ -282,7 +282,7 @@ class TxInOutWidget(QWidget):
|
||||
tx_hash = self.tx.txid()
|
||||
if tx_hash:
|
||||
tx_mined_info = self.wallet.adb.get_tx_height(tx_hash)
|
||||
tx_height = tx_mined_info.height
|
||||
tx_height = tx_mined_info.height()
|
||||
tx_pos = tx_mined_info.txpos
|
||||
cursor = o_text.textCursor()
|
||||
for txout_idx, o in enumerate(self.tx.outputs()):
|
||||
@@ -915,7 +915,7 @@ class TxDialog(QDialog, MessageBoxMixin):
|
||||
self.rbf_label.setText(_('Replace by fee: {}').format(_('True') if self.tx.is_rbf_enabled() else _('False')))
|
||||
|
||||
if tx_mined_status.header_hash:
|
||||
self.block_height_label.setText(_("At block height: {}").format(tx_mined_status.height))
|
||||
self.block_height_label.setText(_("At block height: {}").format(tx_mined_status.height()))
|
||||
else:
|
||||
self.block_height_label.hide()
|
||||
if amount is None and ln_amount is None:
|
||||
|
||||
@@ -108,7 +108,7 @@ class UTXODialog(WindowModalDialog):
|
||||
if _txid not in parents:
|
||||
return
|
||||
tx_mined_info = self.wallet.adb.get_tx_height(_txid)
|
||||
tx_height = tx_mined_info.height
|
||||
tx_height = tx_mined_info.height()
|
||||
tx_pos = tx_mined_info.txpos
|
||||
key = "%dx%d"%(tx_height, tx_pos) if tx_pos is not None else _txid[0:8]
|
||||
label = self.wallet.get_label_for_txid(_txid) or ""
|
||||
|
||||
Reference in New Issue
Block a user