mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
logging: some extra network-related lines
This commit is contained in:
parent
0928ac961a
commit
02c7524d75
3 changed files with 19 additions and 5 deletions
|
@ -226,6 +226,9 @@ class Blockchain(util.PrintError):
|
||||||
if truncate and offset != self._size*80:
|
if truncate and offset != self._size*80:
|
||||||
f.seek(offset)
|
f.seek(offset)
|
||||||
f.truncate()
|
f.truncate()
|
||||||
|
self.print_error(
|
||||||
|
'write. truncating to offset {}, which is around chunk {}'
|
||||||
|
.format(offset, offset//80//2016))
|
||||||
f.seek(offset)
|
f.seek(offset)
|
||||||
f.write(data)
|
f.write(data)
|
||||||
f.flush()
|
f.flush()
|
||||||
|
|
|
@ -549,7 +549,7 @@ class Network(util.DaemonThread):
|
||||||
self.donation_address = result
|
self.donation_address = result
|
||||||
elif method == 'mempool.get_fee_histogram':
|
elif method == 'mempool.get_fee_histogram':
|
||||||
if error is None:
|
if error is None:
|
||||||
self.print_error(result)
|
self.print_error('fee_histogram', result)
|
||||||
self.config.mempool_fees = result
|
self.config.mempool_fees = result
|
||||||
self.notify('fee_histogram')
|
self.notify('fee_histogram')
|
||||||
elif method == 'blockchain.estimatefee':
|
elif method == 'blockchain.estimatefee':
|
||||||
|
@ -784,7 +784,10 @@ class Network(util.DaemonThread):
|
||||||
index = params[0]
|
index = params[0]
|
||||||
# Ignore unsolicited chunks
|
# Ignore unsolicited chunks
|
||||||
if index not in self.requested_chunks:
|
if index not in self.requested_chunks:
|
||||||
|
interface.print_error("received chunk %d (unsolicited)" % index)
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
interface.print_error("received chunk %d" % index)
|
||||||
self.requested_chunks.remove(index)
|
self.requested_chunks.remove(index)
|
||||||
connect = blockchain.connect_chunk(index, result)
|
connect = blockchain.connect_chunk(index, result)
|
||||||
if not connect:
|
if not connect:
|
||||||
|
|
|
@ -74,10 +74,18 @@ class SPV(ThreadJob):
|
||||||
pos = merkle.get('pos')
|
pos = merkle.get('pos')
|
||||||
merkle_root = self.hash_merkle_root(merkle['merkle'], tx_hash, pos)
|
merkle_root = self.hash_merkle_root(merkle['merkle'], tx_hash, pos)
|
||||||
header = self.network.blockchain().read_header(tx_height)
|
header = self.network.blockchain().read_header(tx_height)
|
||||||
if not header or header.get('merkle_root') != merkle_root:
|
# FIXME: if verification fails below,
|
||||||
# FIXME: we should make a fresh connection to a server to
|
# we should make a fresh connection to a server to
|
||||||
# recover from this, as this TX will now never verify
|
# recover from this, as this TX will now never verify
|
||||||
self.print_error("merkle verification failed for", tx_hash)
|
if not header:
|
||||||
|
self.print_error(
|
||||||
|
"merkle verification failed for {} (missing header {})"
|
||||||
|
.format(tx_hash, tx_height))
|
||||||
|
return
|
||||||
|
if header.get('merkle_root') != merkle_root:
|
||||||
|
self.print_error(
|
||||||
|
"merkle verification failed for {} (merkle root mismatch {} != {})"
|
||||||
|
.format(tx_hash, header.get('merkle_root'), merkle_root))
|
||||||
return
|
return
|
||||||
# we passed all the tests
|
# we passed all the tests
|
||||||
self.merkle_roots[tx_hash] = merkle_root
|
self.merkle_roots[tx_hash] = merkle_root
|
||||||
|
|
Loading…
Add table
Reference in a new issue