Skip to content

Commit

Permalink
Use embit to decode the raw transaction
Browse files Browse the repository at this point in the history
Because the decoderawtransaction RPC is not available in Spectrum and
the tools to decode the raw transaction are already there.
  • Loading branch information
leon-costa committed Aug 22, 2024
1 parent ec5e1b2 commit 301fc08
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/cryptoadvance/specter/wallet/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,14 +735,10 @@ def check_utxo(self):
raw_transaction = self.rpc.decoderawtransaction(
raw_transaction_hex
)
searched_raw_vout = [
_output
for _output in raw_transaction["vout"]
if _output["n"] == utxo_vout
][0]
tx_copy["amount"] = searched_raw_vout["value"]
script_pubkey = searched_raw_vout["scriptPubKey"]
tx_copy["address"] = script_pubkey["address"]
parsed_transaction = self.TxCls.from_string(raw_transaction_hex)
out = parsed_transaction.vout[utxo_vout]
tx_copy["amount"] = round(out.value * 1e-8, 8)
tx_copy["address"] = out.script_pubkey.address(self.network)

# Append the copy to the _full_utxo list
_full_utxo.append(tx_copy)
Expand Down

0 comments on commit 301fc08

Please sign in to comment.