Skip to content

Commit

Permalink
Use get_deser_from_gettransaction() everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
kristapsk committed Jan 1, 2024
1 parent e87dccc commit fab97a0
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 @@ -912,8 +912,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(

This comment has been minimized.

Copy link
@whitslack

whitslack Mar 5, 2024

Contributor

@kristapsk: I think this should have been jm_single(), not jm_single. I am getting this exception:

Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.11/wallet-tool.py", line 6, in <module>
    jmprint(wallet_tool_main("wallets"), "success")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/jmclient/wallet_utils.py", line 1662, in wallet_tool_main
    return wallet_fetch_history(wallet_service, options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/jmclient/wallet_utils.py", line 908, in wallet_fetch_history
    wallet_tx_deser = jm_single.bc_interface(
                      ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'function' object has no attribute 'bc_interface'

This comment has been minimized.

Copy link
@kristapsk

kristapsk Mar 5, 2024

Author Member

Yes, you are definitely right, not sure how I missed this during testing.

This comment has been minimized.

Copy link
@whitslack

whitslack Mar 5, 2024

Contributor

And bc_interface() should have been bc_interface, as after fixing the above, I am now getting:

Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.11/wallet-tool.py", line 6, in <module>
    jmprint(wallet_tool_main("wallets"), "success")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/jmclient/wallet_utils.py", line 1662, in wallet_tool_main
    return wallet_fetch_history(wallet_service, options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/jmclient/wallet_utils.py", line 908, in wallet_fetch_history
    wallet_tx_deser = jm_single().bc_interface(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'BitcoinCoreInterface' object is not callable

This comment has been minimized.

Copy link
@kristapsk

kristapsk Mar 5, 2024

Author Member

This comment has been minimized.

Copy link
@kristapsk

kristapsk Mar 5, 2024

Author Member

Updated PR.

).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 fab97a0

Please sign in to comment.