slightly better notifications. at least, it fixes #652
This commit is contained in:
parent
696766c370
commit
80a988e337
|
@ -409,12 +409,12 @@ class ElectrumWindow(QMainWindow):
|
||||||
return
|
return
|
||||||
|
|
||||||
print_error("Notifying GUI")
|
print_error("Notifying GUI")
|
||||||
if len(self.network.interface.pending_transactions_for_notifications) > 0:
|
if len(self.network.pending_transactions_for_notifications) > 0:
|
||||||
# Combine the transactions if there are more then three
|
# Combine the transactions if there are more then three
|
||||||
tx_amount = len(self.network.interface.pending_transactions_for_notifications)
|
tx_amount = len(self.network.pending_transactions_for_notifications)
|
||||||
if(tx_amount >= 3):
|
if(tx_amount >= 3):
|
||||||
total_amount = 0
|
total_amount = 0
|
||||||
for tx in self.network.interface.pending_transactions_for_notifications:
|
for tx in self.network.pending_transactions_for_notifications:
|
||||||
is_relevant, is_mine, v, fee = self.wallet.get_tx_value(tx)
|
is_relevant, is_mine, v, fee = self.wallet.get_tx_value(tx)
|
||||||
if(v > 0):
|
if(v > 0):
|
||||||
total_amount += v
|
total_amount += v
|
||||||
|
@ -422,11 +422,11 @@ class ElectrumWindow(QMainWindow):
|
||||||
self.notify(_("%(txs)s new transactions received. Total amount received in the new transactions %(amount)s %(unit)s") \
|
self.notify(_("%(txs)s new transactions received. Total amount received in the new transactions %(amount)s %(unit)s") \
|
||||||
% { 'txs' : tx_amount, 'amount' : self.format_amount(total_amount), 'unit' : self.base_unit()})
|
% { 'txs' : tx_amount, 'amount' : self.format_amount(total_amount), 'unit' : self.base_unit()})
|
||||||
|
|
||||||
self.network.interface.pending_transactions_for_notifications = []
|
self.network.pending_transactions_for_notifications = []
|
||||||
else:
|
else:
|
||||||
for tx in self.network.interface.pending_transactions_for_notifications:
|
for tx in self.network.pending_transactions_for_notifications:
|
||||||
if tx:
|
if tx:
|
||||||
self.network.interface.pending_transactions_for_notifications.remove(tx)
|
self.network.pending_transactions_for_notifications.remove(tx)
|
||||||
is_relevant, is_mine, v, fee = self.wallet.get_tx_value(tx)
|
is_relevant, is_mine, v, fee = self.wallet.get_tx_value(tx)
|
||||||
if(v > 0):
|
if(v > 0):
|
||||||
self.notify(_("New transaction received. %(amount)s %(unit)s") % { 'amount' : self.format_amount(v), 'unit' : self.base_unit()})
|
self.notify(_("New transaction received. %(amount)s %(unit)s") % { 'amount' : self.format_amount(v), 'unit' : self.base_unit()})
|
||||||
|
|
|
@ -45,6 +45,7 @@ class NetworkProxy(threading.Thread):
|
||||||
self.subscriptions = {}
|
self.subscriptions = {}
|
||||||
self.debug = False
|
self.debug = False
|
||||||
self.lock = threading.Lock()
|
self.lock = threading.Lock()
|
||||||
|
self.pending_transactions_for_notifications = []
|
||||||
|
|
||||||
|
|
||||||
def start(self, start_daemon=False):
|
def start(self, start_daemon=False):
|
||||||
|
|
|
@ -105,7 +105,6 @@ class Interface(threading.Thread):
|
||||||
#json
|
#json
|
||||||
self.message_id = 0
|
self.message_id = 0
|
||||||
self.unanswered_requests = {}
|
self.unanswered_requests = {}
|
||||||
self.pending_transactions_for_notifications= []
|
|
||||||
|
|
||||||
# parse server
|
# parse server
|
||||||
self.server = server
|
self.server = server
|
||||||
|
|
|
@ -111,6 +111,7 @@ class Network(threading.Thread):
|
||||||
self.subscriptions = {}
|
self.subscriptions = {}
|
||||||
self.subscriptions[self.on_banner] = [('server.banner',[])]
|
self.subscriptions[self.on_banner] = [('server.banner',[])]
|
||||||
self.subscriptions[self.on_peers] = [('server.peers.subscribe',[])]
|
self.subscriptions[self.on_peers] = [('server.peers.subscribe',[])]
|
||||||
|
self.pending_transactions_for_notifications = []
|
||||||
|
|
||||||
|
|
||||||
def is_connected(self):
|
def is_connected(self):
|
||||||
|
|
|
@ -1103,7 +1103,7 @@ class NewWallet:
|
||||||
print_error("received transaction that is no longer referenced in history", tx_hash)
|
print_error("received transaction that is no longer referenced in history", tx_hash)
|
||||||
return
|
return
|
||||||
self.transactions[tx_hash] = tx
|
self.transactions[tx_hash] = tx
|
||||||
self.network.interface.pending_transactions_for_notifications.append(tx)
|
self.network.pending_transactions_for_notifications.append(tx)
|
||||||
self.save_transactions()
|
self.save_transactions()
|
||||||
if self.verifier and tx_height>0:
|
if self.verifier and tx_height>0:
|
||||||
self.verifier.add(tx_hash, tx_height)
|
self.verifier.add(tx_hash, tx_height)
|
||||||
|
|
Loading…
Reference in New Issue