1
0
This commit is contained in:
ThomasV
2018-01-13 17:09:25 +01:00
parent cc9032c9ea
commit c8e67e2bd0
3 changed files with 18 additions and 23 deletions

View File

@@ -34,7 +34,6 @@ class SPV(ThreadJob):
# Keyed by tx hash. Value is None if the merkle branch was
# requested, and the merkle root once it has been verified
self.merkle_roots = {}
self.requested_chunks = {}
def run(self):
lh = self.network.get_local_height()
@@ -43,15 +42,9 @@ class SPV(ThreadJob):
# do not request merkle branch before headers are available
if (tx_height > 0) and (tx_height <= lh):
header = self.network.blockchain().read_header(tx_height)
index = tx_height // 2016
#print(index, header)
if header is None:
if index not in self.requested_chunks and self.network.interface:
print("requesting chunk", index)
#request = ('blockchain.block.get_chunk', [index])
#self.network.send([request], self.verify_merkle)
self.requested_chunks[index] = None
self.network.request_chunk(self.network.interface, index)
if header is None and self.network.interface:
index = tx_height // 2016
self.network.request_chunk(self.network.interface, index)
else:
if tx_hash not in self.merkle_roots:
request = ('blockchain.transaction.get_merkle',