mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-03 20:35:13 +00:00
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.
This commit is contained in:
parent
7b49832a3f
commit
72491bdf18
2 changed files with 6 additions and 5 deletions
|
@ -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
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue