Browse Source

Merge JoinMarket-Org/joinmarket-clientserver#1628: Use `get_deser_from_gettransaction()` everywhere

fab97a003b 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
master
Kristaps Kaupe 2 years ago
parent
commit
7d49d5457c
No known key found for this signature in database
GPG Key ID: 33E472FE870C7E5D
  1. 8
      src/jmclient/wallet_utils.py

8
src/jmclient/wallet_utils.py

@ -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}
@ -905,8 +905,8 @@ def wallet_fetch_history(wallet, options):
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:

Loading…
Cancel
Save