coins: Raise Bitcoin version to 22.0

This commit is contained in:
tecnovert
2022-03-27 13:05:53 +02:00
parent 6b063d0582
commit 12bae95e7d
6 changed files with 57 additions and 28 deletions

View File

@@ -1,3 +1,3 @@
name = "basicswap"
__version__ = "0.0.31"
__version__ = "0.0.32"

View File

@@ -614,6 +614,11 @@ def find_vout_for_address(node, txid, addr):
"""
tx = node.getrawtransaction(txid, True)
for i in range(len(tx["vout"])):
if any([addr == a for a in tx["vout"][i]["scriptPubKey"]["addresses"]]):
return i
scriptPubKey = tx["vout"][i]["scriptPubKey"]
if "addresses" in scriptPubKey:
if any([addr == a for a in scriptPubKey["addresses"]]):
return i
elif "address" in scriptPubKey:
if addr == scriptPubKey["address"]:
return i
raise RuntimeError("Vout not found for address: txid=%s, addr=%s" % (txid, addr))

View File

@@ -97,8 +97,13 @@ def find_vout_for_address_from_txobj(tx_obj, addr):
given address. Raises runtime error exception if not found.
"""
for i in range(len(tx_obj["vout"])):
if any([addr == a for a in tx_obj["vout"][i]["scriptPubKey"]["addresses"]]):
return i
scriptPubKey = tx_obj["vout"][i]["scriptPubKey"]
if "addresses" in scriptPubKey:
if any([addr == a for a in scriptPubKey["addresses"]]):
return i
elif "address" in scriptPubKey:
if addr == scriptPubKey["address"]:
return i
raise RuntimeError("Vout not found for address: txid={}, addr={}".format(tx_obj['txid'], addr))