URI: 
       tsynchronizer: request tx from server if we only have partial local tx - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 72491bdf1808e21b7ed24f3bbdad8e8df9325307
   DIR parent 7b49832a3f4f187e4718cc9d3e649c4453b7548f
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Mon, 16 Dec 2019 21:15:20 +0100
       
       synchronizer: request tx from server if we only have partial local tx
       
       Note that there is a slight distinction between
       `not tx.is_complete()` and `isinstance(tx, PartialTransaction)`,
       which is that technically you can have a PSBT that is already complete
       but was not yet converted to a standard bitcoin tx.
       
       Diffstat:
         M electrum/json_db.py                 |       4 ++--
         M electrum/synchronizer.py            |       7 ++++---
       
       2 files changed, 6 insertions(+), 5 deletions(-)
       ---
   DIR diff --git a/electrum/json_db.py b/electrum/json_db.py
       t@@ -33,7 +33,7 @@ from typing import Dict, Optional, List, Tuple, Set, Iterable, NamedTuple, Seque
        from . import util, bitcoin
        from .util import profiler, WalletFileException, multisig_type, TxMinedInfo, bfh
        from .keystore import bip44_derivation
       -from .transaction import Transaction, TxOutpoint, tx_from_any
       +from .transaction import Transaction, TxOutpoint, tx_from_any, PartialTransaction
        from .logging import Logger
        
        # seed_version is now used for the version of the wallet file
       t@@ -708,7 +708,7 @@ class JsonDB(Logger):
                    raise Exception(f"trying to add tx to db with inconsistent txid: {tx_hash} != {tx.txid()}")
                # don't allow overwriting complete tx with partial tx
                tx_we_already_have = self.transactions.get(tx_hash, None)
       -        if tx_we_already_have is None or not tx_we_already_have.is_complete():
       +        if tx_we_already_have is None or isinstance(tx_we_already_have, PartialTransaction):
                    self.transactions[tx_hash] = tx
        
            @modifier
   DIR diff --git a/electrum/synchronizer.py b/electrum/synchronizer.py
       t@@ -30,7 +30,7 @@ import logging
        
        from aiorpcx import TaskGroup, run_in_thread, RPCError
        
       -from .transaction import Transaction
       +from .transaction import Transaction, PartialTransaction
        from .util import bh2u, make_aiohttp_session, NetworkJobOnDefaultServer
        from .bitcoin import address_to_scripthash, is_address
        from .network import UntrustedServerReturnedError
       t@@ -196,8 +196,9 @@ class Synchronizer(SynchronizerBase):
                for tx_hash, tx_height in hist:
                    if tx_hash in self.requested_tx:
                        continue
       -            if self.wallet.db.get_transaction(tx_hash):
       -                continue
       +            tx = self.wallet.db.get_transaction(tx_hash)
       +            if tx and not isinstance(tx, PartialTransaction):
       +                continue  # already have complete tx
                    transaction_hashes.append(tx_hash)
                    self.requested_tx[tx_hash] = tx_height