mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
fix regressions in tx verifier
This commit is contained in:
parent
1ba3008b49
commit
e9b103b283
3 changed files with 11 additions and 10 deletions
|
@ -53,7 +53,6 @@ class BlockchainVerifier(threading.Thread):
|
||||||
|
|
||||||
with self.lock:
|
with self.lock:
|
||||||
self.running = True
|
self.running = True
|
||||||
requested_merkle = []
|
|
||||||
requested_chunks = []
|
requested_chunks = []
|
||||||
requested_headers = []
|
requested_headers = []
|
||||||
all_chunks = False
|
all_chunks = False
|
||||||
|
|
|
@ -96,10 +96,12 @@ class TxVerifier(threading.Thread):
|
||||||
with self.lock: return self.running
|
with self.lock: return self.running
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
with self.lock:
|
||||||
|
self.running = True
|
||||||
|
requested_merkle = []
|
||||||
|
|
||||||
while self.is_running():
|
while self.is_running():
|
||||||
# request missing tx
|
# request missing tx
|
||||||
if all_chunks:
|
|
||||||
for tx_hash, tx_height in self.transactions.items():
|
for tx_hash, tx_height in self.transactions.items():
|
||||||
if tx_hash not in self.verified_tx:
|
if tx_hash not in self.verified_tx:
|
||||||
if self.merkle_roots.get(tx_hash) is None and tx_hash not in requested_merkle:
|
if self.merkle_roots.get(tx_hash) is None and tx_hash not in requested_merkle:
|
||||||
|
@ -136,12 +138,11 @@ class TxVerifier(threading.Thread):
|
||||||
if not header: return
|
if not header: return
|
||||||
assert header.get('merkle_root') == self.merkle_roots[tx_hash]
|
assert header.get('merkle_root') == self.merkle_roots[tx_hash]
|
||||||
# we passed all the tests
|
# we passed all the tests
|
||||||
header = self.read_header(tx_height)
|
|
||||||
timestamp = header.get('timestamp')
|
timestamp = header.get('timestamp')
|
||||||
with self.lock:
|
with self.lock:
|
||||||
self.verified_tx[tx_hash] = (tx_height, timestamp, pos)
|
self.verified_tx[tx_hash] = (tx_height, timestamp, pos)
|
||||||
print_error("verified %s"%tx_hash)
|
print_error("verified %s"%tx_hash)
|
||||||
self.storage.set_key('verified_tx3', self.verified_tx, True)
|
self.storage.put('verified_tx3', self.verified_tx, True)
|
||||||
self.interface.trigger_callback('updated')
|
self.interface.trigger_callback('updated')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1307,6 +1307,7 @@ class Wallet:
|
||||||
self.interface = interface
|
self.interface = interface
|
||||||
self.verifier = TxVerifier(interface, blockchain, self.storage)
|
self.verifier = TxVerifier(interface, blockchain, self.storage)
|
||||||
self.verifier.start()
|
self.verifier.start()
|
||||||
|
self.set_verifier(self.verifier)
|
||||||
self.synchronizer = WalletSynchronizer(self)
|
self.synchronizer = WalletSynchronizer(self)
|
||||||
self.synchronizer.start()
|
self.synchronizer.start()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue