@ -42,29 +42,31 @@ class SPV(ThreadJob):
interface = self . network . interface
interface = self . network . interface
if not interface :
if not interface :
return
return
blockchain = interface . blockchain
blockchain = interface . blockchain
if not blockchain :
if not blockchain :
return
return
lh = self . network . get_local_height ( )
local_height = self . network . get_local_height ( )
unverified = self . wallet . get_unverified_txs ( )
unverified = self . wallet . get_unverified_txs ( )
for tx_hash , tx_height in unverified . items ( ) :
for tx_hash , tx_height in unverified . items ( ) :
# do not request merkle branch before headers are available
# do not request merkle branch before headers are available
if ( tx_height > 0 ) and ( tx_height < = lh ) :
if tx_height < = 0 or tx_height > local_height :
header = blockchain . read_header ( tx_height )
continue
if header is None :
index = tx_height / / 2016
header = blockchain . read_header ( tx_height )
if index < len ( blockchain . checkpoints ) :
if header is None :
self . network . request_chunk ( interface , index )
index = tx_height / / 2016
els e :
if ind ex < l en ( blockchain . checkpoints ) :
if ( tx_hash not in self . requested_merkle
self . network . request_chunk ( interface , index )
and tx_hash not in self . merkle_roots ) :
elif ( tx_hash not in self . requested_ merkle
and tx_hash not in self . merkle_roots ) :
self . network . get_merkle_for_transaction (
self . network . get_merkle_for_transaction (
tx_hash ,
tx_hash ,
tx_height ,
tx_height ,
self . verify_merkle )
self . verify_merkle )
self . print_error ( ' requested merkle ' , tx_hash )
self . print_error ( ' requested merkle ' , tx_hash )
self . requested_merkle . add ( tx_hash )
self . requested_merkle . add ( tx_hash )
if self . network . blockchain ( ) != self . blockchain :
if self . network . blockchain ( ) != self . blockchain :
self . blockchain = self . network . blockchain ( )
self . blockchain = self . network . blockchain ( )