set timestamps on startup
This commit is contained in:
parent
32d0f6ed27
commit
73dc533e79
|
@ -75,7 +75,7 @@ class Interface(threading.Thread):
|
||||||
def queue_json_response(self, c):
|
def queue_json_response(self, c):
|
||||||
|
|
||||||
# uncomment to debug
|
# uncomment to debug
|
||||||
print_error( "<--",c )
|
# print_error( "<--",c )
|
||||||
|
|
||||||
msg_id = c.get('id')
|
msg_id = c.get('id')
|
||||||
error = c.get('error')
|
error = c.get('error')
|
||||||
|
|
|
@ -347,7 +347,7 @@ class WalletVerifier(threading.Thread):
|
||||||
def get_timestamp(self, tx_height):
|
def get_timestamp(self, tx_height):
|
||||||
if tx_height>0:
|
if tx_height>0:
|
||||||
header = self.read_header(tx_height)
|
header = self.read_header(tx_height)
|
||||||
timestamp = header.get('timestamp')
|
timestamp = header.get('timestamp') if header else 0
|
||||||
else:
|
else:
|
||||||
timestamp = 1e12
|
timestamp = 1e12
|
||||||
return timestamp
|
return timestamp
|
||||||
|
|
|
@ -868,6 +868,17 @@ class Wallet:
|
||||||
self.verifier = verifier
|
self.verifier = verifier
|
||||||
for tx_hash in self.transactions.keys():
|
for tx_hash in self.transactions.keys():
|
||||||
self.verifier.add(tx_hash)
|
self.verifier.add(tx_hash)
|
||||||
|
|
||||||
|
# set the timestamp for transactions that need it
|
||||||
|
for l in self.history.values():
|
||||||
|
for tx_hash, tx_height in l:
|
||||||
|
tx = self.transactions.get(tx_hash)
|
||||||
|
if tx and not tx.get('timestamp'):
|
||||||
|
timestamp = self.verifier.get_timestamp(tx_height)
|
||||||
|
if timestamp:
|
||||||
|
self.set_tx_timestamp(tx_hash, timestamp)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def set_tx_timestamp(self, tx_hash, timestamp):
|
def set_tx_timestamp(self, tx_hash, timestamp):
|
||||||
|
|
Loading…
Reference in New Issue