tx dialog: fix confirmation time estimate
This commit is contained in:
parent
b94a7920af
commit
7f7aa97e2e
|
@ -104,17 +104,24 @@ class TxDialog(Factory.Popup):
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
self.tx_hash, self.status_str, self.description, self.can_broadcast, amount, fee, height, conf, timestamp = self.wallet.get_tx_info(self.tx)
|
format_amount = self.app.format_amount_and_units
|
||||||
self.date_str = datetime.fromtimestamp(timestamp).isoformat(' ')[:-3] if timestamp else ''
|
self.tx_hash, self.status_str, self.description, self.can_broadcast, amount, fee, height, conf, timestamp, exp_n = self.wallet.get_tx_info(self.tx)
|
||||||
|
if timestamp:
|
||||||
|
self.date_str = datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]
|
||||||
|
elif exp_n:
|
||||||
|
self.date_str = _('Within %d blocks') % exp_n
|
||||||
|
else:
|
||||||
|
self.date_str = ''
|
||||||
|
|
||||||
if amount is None:
|
if amount is None:
|
||||||
self.amount_str = _("Transaction unrelated to your wallet")
|
self.amount_str = _("Transaction unrelated to your wallet")
|
||||||
elif amount > 0:
|
elif amount > 0:
|
||||||
self.is_mine = False
|
self.is_mine = False
|
||||||
self.amount_str = self.app.format_amount_and_units(amount)
|
self.amount_str = format_amount(amount)
|
||||||
else:
|
else:
|
||||||
self.is_mine = True
|
self.is_mine = True
|
||||||
self.amount_str = self.app.format_amount_and_units(-amount)
|
self.amount_str = format_amount(-amount)
|
||||||
self.fee_str = self.app.format_amount_and_units(fee) if fee is not None else _('unknown')
|
self.fee_str = format_amount(fee) if fee is not None else _('unknown')
|
||||||
self.can_sign = self.wallet.can_sign(self.tx)
|
self.can_sign = self.wallet.can_sign(self.tx)
|
||||||
self.ids.output_list.update(self.tx.outputs())
|
self.ids.output_list.update(self.tx.outputs())
|
||||||
|
|
||||||
|
|
|
@ -178,13 +178,10 @@ class TxDialog(QDialog, MessageBoxMixin):
|
||||||
desc = self.desc
|
desc = self.desc
|
||||||
base_unit = self.main_window.base_unit()
|
base_unit = self.main_window.base_unit()
|
||||||
format_amount = self.main_window.format_amount
|
format_amount = self.main_window.format_amount
|
||||||
tx_hash, status, label, can_broadcast, amount, fee, height, conf, timestamp = self.wallet.get_tx_info(self.tx)
|
tx_hash, status, label, can_broadcast, amount, fee, height, conf, timestamp, exp_n = self.wallet.get_tx_info(self.tx)
|
||||||
|
|
||||||
if can_broadcast:
|
if can_broadcast:
|
||||||
self.broadcast_button.show()
|
self.broadcast_button.show()
|
||||||
# cannot broadcast when offline
|
|
||||||
if self.main_window.network is None:
|
|
||||||
self.broadcast_button.setEnabled(False)
|
|
||||||
else:
|
else:
|
||||||
self.broadcast_button.hide()
|
self.broadcast_button.hide()
|
||||||
|
|
||||||
|
@ -201,12 +198,12 @@ class TxDialog(QDialog, MessageBoxMixin):
|
||||||
self.tx_desc.show()
|
self.tx_desc.show()
|
||||||
self.status_label.setText(_('Status:') + ' ' + status)
|
self.status_label.setText(_('Status:') + ' ' + status)
|
||||||
|
|
||||||
if timestamp is not None:
|
if timestamp:
|
||||||
time_str = datetime.datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]
|
time_str = datetime.datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]
|
||||||
self.date_label.setText(_("Date: %s")%time_str)
|
self.date_label.setText(_("Date: %s")%time_str)
|
||||||
self.date_label.show()
|
self.date_label.show()
|
||||||
elif exp_n:
|
elif exp_n:
|
||||||
self.date_label.setText(_('Expected confirmation time: %d blocks (%s)'%(exp_n, format_amount(fee_per_kb) + ' ' + base_unit + '/kb')))
|
self.date_label.setText(_('Expected confirmation time: %d blocks'%(exp_n)))
|
||||||
self.date_label.show()
|
self.date_label.show()
|
||||||
else:
|
else:
|
||||||
self.date_label.hide()
|
self.date_label.hide()
|
||||||
|
|
|
@ -643,7 +643,7 @@ class Abstract_Wallet(PrintError):
|
||||||
else:
|
else:
|
||||||
amount = None
|
amount = None
|
||||||
|
|
||||||
return tx_hash, status, label, can_broadcast, amount, fee, height, conf, timestamp
|
return tx_hash, status, label, can_broadcast, amount, fee, height, conf, timestamp, exp_n
|
||||||
|
|
||||||
|
|
||||||
def get_addr_io(self, address):
|
def get_addr_io(self, address):
|
||||||
|
|
Loading…
Reference in New Issue