Skip to content

Commit

Permalink
Merge #1628: Use get_deser_from_gettransaction() everywhere
Browse files Browse the repository at this point in the history
fab97a0 Use get_deser_from_gettransaction() everywhere (Kristaps Kaupe)

Pull request description:

  There's `get_deser_from_gettransaction()` method in `BlockchainInterface` which is wrapper around python-bitcointx `CMutableTransaction.deserialize()` with some error checking added. It is used in most of the code, but in `jmclient/wallet_utils.py` I found two direct calls of `CMutableTransaction.deserialize()`.

Top commit has no ACKs.

Tree-SHA512: c0fc781e37b3bc72e89805e62b594ba879d5c2b84d3417dcefeba4428d21abcf0f44f143c1b9f5cf23a896e03add26b80b9cc514842142b45432c31adf563d7a
  • Loading branch information
kristapsk committed Jan 4, 2024
2 parents 80d6ea6 + fab97a0 commit 7d49d54
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/jmclient/wallet_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ def get_tx_info(txid: str, tx_cache: Optional[dict] = None) -> Tuple[
rpctx, rpctx_deser = tx_cache[txid]
else:
rpctx = jm_single().bc_interface.get_transaction(txid)
txhex = str(rpctx['hex'])
rpctx_deser = btc.CMutableTransaction.deserialize(hextobin(txhex))
rpctx_deser = jm_single().bc_interface.get_deser_from_gettransaction(
rpctx)
if tx_cache is not None:
tx_cache[txid] = (rpctx, rpctx_deser)
output_script_values = {x.scriptPubKey: x.nValue for x in rpctx_deser.vout}
Expand Down Expand Up @@ -905,8 +905,8 @@ def print_row(index, time, tx_type, amount, delta, balance, cj_n,
wallet_tx = jm_single().bc_interface.get_transaction(
ins.prevout.hash[::-1])
if wallet_tx:
wallet_tx_deser = btc.CMutableTransaction.deserialize(
hextobin(wallet_tx['hex']))
wallet_tx_deser = jm_single.bc_interface(
).get_deser_from_gettransaction(wallet_tx)
tx_cache[ins.prevout.hash[::-1]] = (wallet_tx,
wallet_tx_deser)
if wallet_tx is None:
Expand Down

0 comments on commit 7d49d54

Please sign in to comment.