URI: 
       tverifier: need to wait for reorg - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 819044221b5e8090d36de5c5f9d5245f49c2988e
   DIR parent 78e9152723ad3c4f35f6e82f8be045be35a2afa4
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Thu, 13 Sep 2018 19:00:21 +0200
       
       verifier: need to wait for reorg
       
       fixes race between verifier and block header download.
       scenario: client starts, connects to server. while client was offline,
       tthere was a reorg. txn A was not mined in the old chain, but is mined
       after reorg. client subscribes to addresses and starts downloading headers,
       concurrently. server tells client txn A is mined at height H >= reorg height.
       client sees it has block header at height H, asks for SPV proof for txn A.
       but the header the client has is still the old one, the verifier was faster
       tthan the block header download (race...). client receives proof. proof is
       incorrect for old header. client disconnects.
       
       Diffstat:
         M electrum/verifier.py                |       4 +++-
       
       1 file changed, 3 insertions(+), 1 deletion(-)
       ---
   DIR diff --git a/electrum/verifier.py b/electrum/verifier.py
       t@@ -90,7 +90,9 @@ class SPV(ThreadJob):
                tx_height = merkle.get('block_height')
                pos = merkle.get('pos')
                merkle_branch = merkle.get('merkle')
       -        header = self.network.blockchain().read_header(tx_height)
       +        # we need to wait if header sync/reorg is still ongoing, hence lock:
       +        async with self.network.bhi_lock:
       +            header = self.network.blockchain().read_header(tx_height)
                try:
                    verify_tx_is_in_block(tx_hash, merkle_branch, pos, header, tx_height)
                except MerkleVerificationFailure as e: