qml: txdetails: add lockDelay property when height is TX_HEIGHT_FUTURE and add mempool depth for height TX_HEIGHT_UNCONF_PARENT
This commit is contained in:
@@ -58,7 +58,9 @@ Pane {
|
||||
text: txdetails.isUnrelated
|
||||
? qsTr('Transaction is unrelated to this wallet')
|
||||
: txdetails.canRemove
|
||||
? qsTr('This transaction is local to your wallet. It has not been published yet.')
|
||||
? txdetails.lockDelay
|
||||
? qsTr('This transaction is local to your wallet and locked for the next %1 blocks.').arg(txdetails.lockDelay)
|
||||
: qsTr('This transaction is local to your wallet. It has not been published yet.')
|
||||
: qsTr('This transaction is still unconfirmed.') + '\n' + (txdetails.canCancel
|
||||
? qsTr('You can bump its fee to speed up its confirmation, or cancel this transaction')
|
||||
: qsTr('You can bump its fee to speed up its confirmation'))
|
||||
@@ -343,6 +345,7 @@ Pane {
|
||||
icon.source: '../../icons/microphone.png'
|
||||
text: qsTr('Broadcast')
|
||||
visible: txdetails.canBroadcast
|
||||
enabled: !txdetails.lockDelay
|
||||
onClicked: txdetails.broadcast()
|
||||
}
|
||||
|
||||
@@ -356,9 +359,13 @@ Pane {
|
||||
var msg = ''
|
||||
if (txdetails.isComplete) {
|
||||
if (!txdetails.isMined && !txdetails.mempoolDepth) // local
|
||||
// TODO: iff offline wallet?
|
||||
// TODO: or also if just temporarily offline?
|
||||
msg = qsTr('This transaction is complete. Please share it with an online device')
|
||||
if (txdetails.lockDelay) {
|
||||
msg = qsTr('This transaction is fully signed, but can only be broadcast after %1 blocks.').arg(txdetails.lockDelay)
|
||||
} else {
|
||||
// TODO: iff offline wallet?
|
||||
// TODO: or also if just temporarily offline?
|
||||
msg = qsTr('This transaction is fully signed, but has not been broadcast yet.')
|
||||
}
|
||||
} else if (txdetails.wallet.isWatchOnly) {
|
||||
msg = qsTr('This transaction should be signed. Present this QR code to the signing device')
|
||||
} else if (txdetails.wallet.isMultisig && txdetails.wallet.walletType != '2fa') {
|
||||
|
||||
@@ -7,6 +7,7 @@ from electrum.logging import get_logger
|
||||
from electrum.util import format_time, TxMinedInfo
|
||||
from electrum.transaction import tx_from_any, Transaction
|
||||
from electrum.network import Network
|
||||
from electrum.address_synchronizer import TX_HEIGHT_UNCONF_PARENT, TX_HEIGHT_UNCONFIRMED, TX_HEIGHT_FUTURE
|
||||
|
||||
from .qewallet import QEWallet
|
||||
from .qetypes import QEAmount
|
||||
@@ -54,6 +55,7 @@ class QETxDetails(QObject, QtEventListener):
|
||||
self._is_complete = False
|
||||
self._is_mined = False
|
||||
self._is_final = False
|
||||
self._lock_delay = 0
|
||||
|
||||
self._mempool_depth = ''
|
||||
|
||||
@@ -234,6 +236,10 @@ class QETxDetails(QObject, QtEventListener):
|
||||
def isFinal(self):
|
||||
return self._is_final
|
||||
|
||||
@pyqtProperty(int, notify=detailsChanged)
|
||||
def lockDelay(self):
|
||||
return self._lock_delay
|
||||
|
||||
def update(self, from_txid: bool = False):
|
||||
assert self._wallet
|
||||
|
||||
@@ -278,11 +284,15 @@ class QETxDetails(QObject, QtEventListener):
|
||||
fee_per_kb = txinfo.fee / size * 1000
|
||||
self._feerate_str = self._wallet.wallet.config.format_fee_rate(fee_per_kb)
|
||||
|
||||
self._lock_delay = 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)
|
||||
elif txinfo.tx_mined_status.height == 0:
|
||||
self._mempool_depth = self._wallet.wallet.config.depth_tooltip(txinfo.mempool_depth_bytes)
|
||||
else:
|
||||
if txinfo.tx_mined_status.height in [TX_HEIGHT_UNCONFIRMED, TX_HEIGHT_UNCONF_PARENT]:
|
||||
self._mempool_depth = self._wallet.wallet.config.depth_tooltip(txinfo.mempool_depth_bytes)
|
||||
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 self._wallet.wallet.lnworker:
|
||||
# Calling lnworker.get_onchain_history and wallet.get_full_history here
|
||||
|
||||
Reference in New Issue
Block a user