Browse Source

Merge JoinMarket-Org/joinmarket-clientserver#1631: Cache `None` in `tx_cache` for non-wallet transactions

f0b0e55431 Cache None in tx_cache for non-wallet transactions (Kristaps Kaupe)

Pull request description:

  `wallet_fetch_history()` calls `BlockchainInterface.get_transaction()` for each input of wallet transactions to figure out which of the inputs are ours and which aren't. It will return `None` for non-wallet transactions and that weren't cached, so, if the same non-wallet transaction appears in inputs of wallet transactions multiple times, unnecessary `gettransaction` RPCs to Bitcoin Core were made.

Top commit has no ACKs.

Tree-SHA512: 43b7166f2cfb1ed02fa46d78333c045cab8b8a94765dba44a3190c8e67ec353bf9e0a0c9fec8386ab489b1ea1448188ee3078c5a37de9140f99199b3a5a066f6
master
Kristaps Kaupe 2 years ago
parent
commit
eaae8d84bd
No known key found for this signature in database
GPG Key ID: 33E472FE870C7E5D
  1. 2
      src/jmclient/wallet_utils.py

2
src/jmclient/wallet_utils.py

@ -909,6 +909,8 @@ def wallet_fetch_history(wallet, options):
).get_deser_from_gettransaction(wallet_tx)
tx_cache[ins.prevout.hash[::-1]] = (wallet_tx,
wallet_tx_deser)
else:
tx_cache[ins.prevout.hash[::-1]] = (None, None)
if wallet_tx is None:
continue
inp = wallet_tx_deser.vout[ins.prevout.n]

Loading…
Cancel
Save