Skip to content

Commit

Permalink
Merge #1631: Cache None in tx_cache for non-wallet transactions
Browse files Browse the repository at this point in the history
f0b0e55 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
  • Loading branch information
kristapsk committed Feb 22, 2024
2 parents eb97ed1 + f0b0e55 commit eaae8d8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/jmclient/wallet_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,8 @@ def print_row(index, time, tx_type, amount, delta, balance, cj_n,
).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]
Expand Down

0 comments on commit eaae8d8

Please sign in to comment.