Merge pull request #491 from gerlofvanek/electrum_fixes_3

Verify initiate lock-tx amount.
This commit is contained in:
tecnovert
2026-06-08 21:43:07 +00:00
committed by GitHub
6 changed files with 22 additions and 0 deletions
+12
View File
@@ -8454,6 +8454,18 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
)
index = None
if found:
if (
"value" in found
and found["value"] is not None
and found["value"] != int(bid.amount)
):
self.setBidError(
bid,
"Incorrect output amount in initiate txn {}: {} != {}.".format(
initiate_txnid_hex, found["value"], int(bid.amount)
),
)
return True
bid.initiate_tx.conf = found["depth"]
if "index" in found:
index = found["index"]
+1
View File
@@ -322,6 +322,7 @@ class BCHInterface(BTCInterface):
"depth": confirmations,
"index": found_vout,
"height": block_height,
"value": self.make_int(txout["value"]),
}
return rv
+4
View File
@@ -3006,6 +3006,8 @@ class BTCInterface(FeeValidator, Secp256k1Interface):
if find_index:
tx_obj = self.rpc("decoderawtransaction", [tx["hex"]])
rv["index"] = find_vout_for_address_from_txobj(tx_obj, dest_address)
if rv["index"] is not None and rv["index"] >= 0:
rv["value"] = self.make_int(tx_obj["vout"][rv["index"]]["value"])
if return_txid:
rv["txid"] = txid.hex()
@@ -3063,6 +3065,7 @@ class BTCInterface(FeeValidator, Secp256k1Interface):
for idx, txout in enumerate(tx.vout):
if txout.scriptPubKey == dest_script:
rv["index"] = idx
rv["value"] = txout.nValue
break
except Exception:
pass
@@ -3124,6 +3127,7 @@ class BTCInterface(FeeValidator, Secp256k1Interface):
for idx, txout in enumerate(tx.vout):
if txout.scriptPubKey == dest_script:
rv["index"] = idx
rv["value"] = txout.nValue
break
except Exception as e:
self._log.debug(
+1
View File
@@ -940,6 +940,7 @@ class DCRInterface(FeeValidator, Secp256k1Interface):
"depth": confirmations,
"index": found_vout,
"height": block_height,
"value": self.make_int(txout["value"]),
}
return rv
+2
View File
@@ -276,6 +276,8 @@ class FIROInterface(BTCInterface):
if find_index:
tx_obj = self.rpc("decoderawtransaction", [tx["hex"]])
rv["index"] = find_vout_for_address_from_txobj(tx_obj, dest_address)
if rv["index"] is not None and rv["index"] >= 0:
rv["value"] = self.make_int(tx_obj["vout"][rv["index"]]["value"])
if return_txid:
rv["txid"] = txid.hex()
+2
View File
@@ -614,6 +614,8 @@ class NAVInterface(BTCInterface):
if find_index:
tx_obj = self.rpc("decoderawtransaction", [tx["hex"]])
rv["index"] = find_vout_for_address_from_txobj(tx_obj, dest_address)
if rv["index"] is not None and rv["index"] >= 0:
rv["value"] = self.make_int(tx_obj["vout"][rv["index"]]["value"])
if return_txid:
rv["txid"] = txid.hex()