mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-03 02:35:20 +00:00
verifier: trivial clean-up
This commit is contained in:
parent
4f2aa53a76
commit
ecefa47b40
1 changed files with 3 additions and 8 deletions
|
@ -102,8 +102,7 @@ class SPV(NetworkJobOnDefaultServer):
|
||||||
raise
|
raise
|
||||||
self.print_error('tx {} not at height {}'.format(tx_hash, tx_height))
|
self.print_error('tx {} not at height {}'.format(tx_hash, tx_height))
|
||||||
self.wallet.remove_unverified_tx(tx_hash, tx_height)
|
self.wallet.remove_unverified_tx(tx_hash, tx_height)
|
||||||
try: self.requested_merkle.remove(tx_hash)
|
self.requested_merkle.discard(tx_hash)
|
||||||
except KeyError: pass
|
|
||||||
return
|
return
|
||||||
# Verify the hash of the server-provided merkle branch to a
|
# Verify the hash of the server-provided merkle branch to a
|
||||||
# transaction matches the merkle root of its block
|
# transaction matches the merkle root of its block
|
||||||
|
@ -126,8 +125,7 @@ class SPV(NetworkJobOnDefaultServer):
|
||||||
raise GracefulDisconnect(e)
|
raise GracefulDisconnect(e)
|
||||||
# we passed all the tests
|
# we passed all the tests
|
||||||
self.merkle_roots[tx_hash] = header.get('merkle_root')
|
self.merkle_roots[tx_hash] = header.get('merkle_root')
|
||||||
try: self.requested_merkle.remove(tx_hash)
|
self.requested_merkle.discard(tx_hash)
|
||||||
except KeyError: pass
|
|
||||||
self.print_error("verified %s" % tx_hash)
|
self.print_error("verified %s" % tx_hash)
|
||||||
header_hash = hash_header(header)
|
header_hash = hash_header(header)
|
||||||
tx_info = TxMinedInfo(height=tx_height,
|
tx_info = TxMinedInfo(height=tx_height,
|
||||||
|
@ -181,10 +179,7 @@ class SPV(NetworkJobOnDefaultServer):
|
||||||
|
|
||||||
def remove_spv_proof_for_tx(self, tx_hash):
|
def remove_spv_proof_for_tx(self, tx_hash):
|
||||||
self.merkle_roots.pop(tx_hash, None)
|
self.merkle_roots.pop(tx_hash, None)
|
||||||
try:
|
self.requested_merkle.discard(tx_hash)
|
||||||
self.requested_merkle.remove(tx_hash)
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def is_up_to_date(self):
|
def is_up_to_date(self):
|
||||||
return not self.requested_merkle
|
return not self.requested_merkle
|
||||||
|
|
Loading…
Add table
Reference in a new issue