mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-08 11:39:53 +00:00
do not request merkle root for unconfirmed transactions
This commit is contained in:
parent
ea7dabe640
commit
cdb52c30d2
3 changed files with 11 additions and 9 deletions
|
@ -437,7 +437,9 @@ class ElectrumWindow(QMainWindow):
|
||||||
if tx['height']:
|
if tx['height']:
|
||||||
conf = self.wallet.verifier.get_confirmations(tx_hash)
|
conf = self.wallet.verifier.get_confirmations(tx_hash)
|
||||||
time_str = datetime.datetime.fromtimestamp( tx['timestamp']).isoformat(' ')[:-3]
|
time_str = datetime.datetime.fromtimestamp( tx['timestamp']).isoformat(' ')[:-3]
|
||||||
if conf < 6:
|
if conf == 0:
|
||||||
|
icon = QIcon(":icons/unconfirmed.png")
|
||||||
|
elif conf < 6:
|
||||||
icon = QIcon(":icons/clock%d.png"%conf)
|
icon = QIcon(":icons/clock%d.png"%conf)
|
||||||
else:
|
else:
|
||||||
icon = QIcon(":icons/confirmed.png")
|
icon = QIcon(":icons/confirmed.png")
|
||||||
|
|
|
@ -46,8 +46,10 @@ class WalletVerifier(threading.Thread):
|
||||||
def get_confirmations(self, tx):
|
def get_confirmations(self, tx):
|
||||||
""" return the number of confirmations of a monitored transaction. """
|
""" return the number of confirmations of a monitored transaction. """
|
||||||
with self.lock:
|
with self.lock:
|
||||||
assert tx in self.transactions
|
if tx in self.transactions:
|
||||||
return (self.local_height - self.verified_tx[tx] + 1) if tx in self.verified_tx else 0
|
return (self.local_height - self.verified_tx[tx] + 1) if tx in self.verified_tx else 0
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
def add(self, tx):
|
def add(self, tx):
|
||||||
""" add a transaction to the list of monitored transactions. """
|
""" add a transaction to the list of monitored transactions. """
|
||||||
|
|
|
@ -519,13 +519,15 @@ class Wallet:
|
||||||
tx_hash = tx['tx_hash']
|
tx_hash = tx['tx_hash']
|
||||||
line = self.tx_history.get(tx_hash)
|
line = self.tx_history.get(tx_hash)
|
||||||
if not line:
|
if not line:
|
||||||
if self.verifier: self.verifier.add(tx_hash)
|
|
||||||
self.tx_history[tx_hash] = copy.copy(tx)
|
self.tx_history[tx_hash] = copy.copy(tx)
|
||||||
line = self.tx_history.get(tx_hash)
|
line = self.tx_history.get(tx_hash)
|
||||||
else:
|
else:
|
||||||
line['value'] += tx['value']
|
line['value'] += tx['value']
|
||||||
if line['height'] == 0:
|
if line['height'] == 0:
|
||||||
line['timestamp'] = 1e12
|
line['timestamp'] = 1e12
|
||||||
|
else:
|
||||||
|
if self.verifier: self.verifier.add(tx_hash)
|
||||||
|
|
||||||
self.update_tx_labels()
|
self.update_tx_labels()
|
||||||
|
|
||||||
def update_tx_labels(self):
|
def update_tx_labels(self):
|
||||||
|
@ -816,11 +818,7 @@ class Wallet:
|
||||||
|
|
||||||
def set_verifier(self, verifier):
|
def set_verifier(self, verifier):
|
||||||
self.verifier = verifier
|
self.verifier = verifier
|
||||||
with self.lock:
|
self.update_tx_history()
|
||||||
for tx in self.tx_history.keys():
|
|
||||||
self.verifier.add(tx)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue