mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
distinction between unconfirmed and unverified transactions
This commit is contained in:
parent
827e29c1dc
commit
c95c80163d
4 changed files with 35 additions and 14 deletions
|
@ -606,22 +606,22 @@ class ElectrumWindow(QMainWindow):
|
||||||
self.history_list.clear()
|
self.history_list.clear()
|
||||||
for item in self.wallet.get_tx_history(self.current_account):
|
for item in self.wallet.get_tx_history(self.current_account):
|
||||||
tx_hash, conf, is_mine, value, fee, balance, timestamp = item
|
tx_hash, conf, is_mine, value, fee, balance, timestamp = item
|
||||||
if conf:
|
if conf > 0:
|
||||||
try:
|
try:
|
||||||
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
||||||
except:
|
except:
|
||||||
time_str = "unknown"
|
time_str = "unknown"
|
||||||
if conf == -1:
|
|
||||||
icon = None
|
if conf == -1:
|
||||||
if conf == 0:
|
time_str = 'unverified'
|
||||||
icon = QIcon(":icons/unconfirmed.png")
|
icon = None
|
||||||
elif conf < 6:
|
elif conf == 0:
|
||||||
icon = QIcon(":icons/clock%d.png"%conf)
|
|
||||||
else:
|
|
||||||
icon = QIcon(":icons/confirmed.png")
|
|
||||||
else:
|
|
||||||
time_str = 'pending'
|
time_str = 'pending'
|
||||||
icon = QIcon(":icons/unconfirmed.png")
|
icon = QIcon(":icons/unconfirmed.png")
|
||||||
|
elif conf < 6:
|
||||||
|
icon = QIcon(":icons/clock%d.png"%conf)
|
||||||
|
else:
|
||||||
|
icon = QIcon(":icons/confirmed.png")
|
||||||
|
|
||||||
if value is not None:
|
if value is not None:
|
||||||
v_str = self.format_amount(value, True)
|
v_str = self.format_amount(value, True)
|
||||||
|
|
|
@ -1167,12 +1167,15 @@ class ElectrumWindow:
|
||||||
|
|
||||||
for item in self.wallet.get_tx_history():
|
for item in self.wallet.get_tx_history():
|
||||||
tx_hash, conf, is_mine, value, fee, balance, timestamp = item
|
tx_hash, conf, is_mine, value, fee, balance, timestamp = item
|
||||||
if conf:
|
if conf > 0:
|
||||||
try:
|
try:
|
||||||
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
|
||||||
except:
|
except:
|
||||||
time_str = "------"
|
time_str = "------"
|
||||||
conf_icon = gtk.STOCK_APPLY
|
conf_icon = gtk.STOCK_APPLY
|
||||||
|
elif conf == -1:
|
||||||
|
time_str = 'unverified'
|
||||||
|
conf_icon = None
|
||||||
else:
|
else:
|
||||||
time_str = 'pending'
|
time_str = 'pending'
|
||||||
conf_icon = gtk.STOCK_EXECUTE
|
conf_icon = gtk.STOCK_EXECUTE
|
||||||
|
|
|
@ -52,15 +52,33 @@ class WalletVerifier(threading.Thread):
|
||||||
if tx in self.verified_tx:
|
if tx in self.verified_tx:
|
||||||
height, timestamp, pos = self.verified_tx[tx]
|
height, timestamp, pos = self.verified_tx[tx]
|
||||||
conf = (self.local_height - height + 1)
|
conf = (self.local_height - height + 1)
|
||||||
|
if conf <= 0: timestamp = None
|
||||||
|
|
||||||
|
elif tx in self.transactions:
|
||||||
|
conf = -1
|
||||||
|
timestamp = None
|
||||||
|
|
||||||
else:
|
else:
|
||||||
conf = 0
|
conf = 0
|
||||||
|
|
||||||
if conf <= 0:
|
|
||||||
timestamp = None
|
timestamp = None
|
||||||
|
|
||||||
return conf, timestamp
|
return conf, timestamp
|
||||||
|
|
||||||
|
|
||||||
|
def get_txpos(self, tx_hash):
|
||||||
|
"return position, even if the tx is unverified"
|
||||||
|
with self.lock:
|
||||||
|
x = self.verified_tx.get(tx_hash)
|
||||||
|
y = self.transactions.get(tx_hash)
|
||||||
|
if x:
|
||||||
|
height, timestamp, pos = x
|
||||||
|
return height, pos
|
||||||
|
elif y:
|
||||||
|
return y, 0
|
||||||
|
else:
|
||||||
|
return 1e12, 0
|
||||||
|
|
||||||
|
|
||||||
def get_height(self, tx_hash):
|
def get_height(self, tx_hash):
|
||||||
with self.lock:
|
with self.lock:
|
||||||
v = self.verified_tx.get(tx_hash)
|
v = self.verified_tx.get(tx_hash)
|
||||||
|
|
|
@ -670,7 +670,7 @@ class Wallet:
|
||||||
def get_tx_history(self, account=None):
|
def get_tx_history(self, account=None):
|
||||||
with self.transaction_lock:
|
with self.transaction_lock:
|
||||||
history = self.transactions.items()
|
history = self.transactions.items()
|
||||||
history.sort(key = lambda x: self.verifier.verified_tx.get(x[0]) if self.verifier.verified_tx.get(x[0]) else (1e12,0,0))
|
history.sort(key = lambda x: self.verifier.get_txpos(x[0]))
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
balance = 0
|
balance = 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue