This commit is contained in:
ThomasV 2018-02-23 11:30:59 +01:00
parent 24054ac399
commit aaf89d2325
1 changed files with 6 additions and 3 deletions

View File

@ -36,11 +36,14 @@ class SPV(ThreadJob):
self.merkle_roots = {}
def run(self):
if not self.network.interface:
interface = self.network.interface
if not interface:
return
blockchain = interface.blockchain
if not blockchain:
return
lh = self.network.get_local_height()
unverified = self.wallet.get_unverified_txs()
blockchain = self.network.blockchain()
for tx_hash, tx_height in unverified.items():
# do not request merkle branch before headers are available
if (tx_height > 0) and (tx_height <= lh):
@ -48,7 +51,7 @@ class SPV(ThreadJob):
if header is None:
index = tx_height // 2016
if index < len(blockchain.checkpoints):
self.network.request_chunk(self.network.interface, index)
self.network.request_chunk(interface, index)
else:
if tx_hash not in self.merkle_roots:
request = ('blockchain.transaction.get_merkle',