get_history: return empty history if balance check fails
This commit is contained in:
parent
7f3fc232a0
commit
065145e557
|
@ -737,8 +737,7 @@ class Abstract_Wallet(object):
|
|||
delta = self.get_tx_delta(tx_hash, addr)
|
||||
hh.append([addr, tx_hash, height, delta])
|
||||
|
||||
# 2. merge
|
||||
# the delta of a tx on the domain is the sum of its deltas on addresses
|
||||
# 2. merge: the delta of a tx on the domain is the sum of its deltas on addresses
|
||||
merged = {}
|
||||
for addr, tx_hash, height, delta in hh:
|
||||
if tx_hash not in merged:
|
||||
|
@ -749,15 +748,13 @@ class Abstract_Wallet(object):
|
|||
|
||||
# 3. create sorted list
|
||||
history = []
|
||||
#balance = 0
|
||||
for tx_hash, v in merged.items():
|
||||
height, value = v
|
||||
#balance += value
|
||||
conf, timestamp = self.verifier.get_confirmations(tx_hash) if self.verifier else (None, None)
|
||||
history.append((tx_hash, conf, value, timestamp))
|
||||
if self.verifier:
|
||||
history.sort(key = lambda x: self.verifier.get_txpos(x[0]))
|
||||
|
||||
# 4. add balance
|
||||
c, u = self.get_balance(domain)
|
||||
balance = c + u
|
||||
h2 = []
|
||||
|
@ -769,11 +766,10 @@ class Abstract_Wallet(object):
|
|||
else:
|
||||
balance = None
|
||||
|
||||
assert balance in [None, 0]
|
||||
#if balance not in [None, 0]:
|
||||
# print_error("history error")
|
||||
# self.clear_history()
|
||||
# self.update()
|
||||
# fixme: this may happen if history is incomplete
|
||||
if balance not in [None, 0]:
|
||||
print_error("Error: history not synchronized")
|
||||
return []
|
||||
|
||||
return h2
|
||||
|
||||
|
|
Loading…
Reference in New Issue