Browse Source

Use python-bitcointx in fidelity bond wallet sync

Code which sync'd and displayed fidelity bond wallets
was not updated to use python-bitcointx
master
chris-belcher 5 years ago
parent
commit
46281b51b8
No known key found for this signature in database
GPG Key ID: EF734EA677F31129
  1. 6
      jmclient/jmclient/wallet_service.py
  2. 13
      jmclient/jmclient/wallet_utils.py

6
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:]

13
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:

Loading…
Cancel
Save