From 46281b51b8ed6df984036490317396c61c66639a Mon Sep 17 00:00:00 2001 From: chris-belcher Date: Wed, 24 Mar 2021 20:04:10 +0000 Subject: [PATCH] Use python-bitcointx in fidelity bond wallet sync Code which sync'd and displayed fidelity bond wallets was not updated to use python-bitcointx --- jmclient/jmclient/wallet_service.py | 6 +++--- jmclient/jmclient/wallet_utils.py | 13 ++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/jmclient/jmclient/wallet_service.py b/jmclient/jmclient/wallet_service.py index d9fd07a..7cb5854 100644 --- a/jmclient/jmclient/wallet_service.py +++ b/jmclient/jmclient/wallet_service.py @@ -724,15 +724,15 @@ class WalletService(Service): if tx['category'] == 'receive': tx_receive.append(tx) elif tx["category"] == "send": - gettx = self.bci.get_transaction(tx["txid"]) + gettx = self.bci.get_transaction(hextobin(tx["txid"])) txd = self.bci.get_deser_from_gettransaction(gettx) - if len(txd["outs"]) > 1: + if len(txd.vout) > 1: continue #must be mined into a block to sync #otherwise there's no merkleproof or block index if gettx["confirmations"] < 1: continue - script = hextobin(txd["outs"][0]["script"]) + script = txd.vout[0].scriptPubKey if script[0] != 0x6a: #OP_RETURN continue pubkeyhash = script[2:] diff --git a/jmclient/jmclient/wallet_utils.py b/jmclient/jmclient/wallet_utils.py index d604dcf..9faf2a1 100644 --- a/jmclient/jmclient/wallet_utils.py +++ b/jmclient/jmclient/wallet_utils.py @@ -521,22 +521,21 @@ def wallet_display(wallet_service, showprivkey, displayall=False, privkey, engine = wallet_service._get_key_from_path(path) pubkey = engine.privkey_to_pubkey(privkey) - pubkeyhash = btc.bin_hash160(pubkey) + pubkeyhash = btc.Hash160(pubkey) output = "BURN-" + binascii.hexlify(pubkeyhash).decode() balance = 0 status = "no transaction" if path_repr_b in burner_outputs: txhex, blockheight, merkle_branch, blockindex = burner_outputs[path_repr_b] - txhex = binascii.hexlify(txhex).decode() - txd = btc.deserialize(txhex) - assert len(txd["outs"]) == 1 - balance = txd["outs"][0]["value"] - script = binascii.unhexlify(txd["outs"][0]["script"]) + txd = btc.CMutableTransaction.deserialize(txhex) + assert len(txd.vout) == 1 + balance = txd.vout[0].nValue + script = txd.vout[0].scriptPubKey assert script[0] == 0x6a #OP_RETURN tx_pubkeyhash = script[2:] assert tx_pubkeyhash == pubkeyhash - status = btc.txhash(txhex) + (" [NO MERKLE PROOF]" if + status = bintohex(txd.GetTxid()) + (" [NO MERKLE PROOF]" if merkle_branch == FidelityBondMixin.MERKLE_BRANCH_UNAVAILABLE else "") privkey = (wallet_service.get_wif_path(path) if showprivkey else "") if displayall or balance > 0: