Compare commits

...

7 Commits

Author SHA1 Message Date
tecnovert 3af05ea5c0 build, guix: update packed version 2026-06-09 02:20:08 +02:00
tecnovert 136b311dc6 build: raise black version 2026-06-09 02:14:44 +02:00
tecnovert df672d4056 build: raise min python version to 3.11 2026-06-09 02:06:22 +02:00
tecnovert f536f8962e test: raise python ci version to 3.14 2026-06-09 02:00:42 +02:00
tecnovert ce5ffe92b4 build: raise version to 0.16.4 2026-06-09 01:51:38 +02:00
tecnovert 32bdd11853 Merge pull request #493 from tecnovert/fix
fix: always require secret hash swap ITX index and value
2026-06-08 23:49:04 +00:00
tecnovert 5e7dbbb22f fix: always require secret hash swap ITX index and value 2026-06-09 01:48:28 +02:00
5 changed files with 42 additions and 28 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python-version: ["3.12"] python-version: ["3.14"]
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
+1 -1
View File
@@ -1,3 +1,3 @@
name = "basicswap" name = "basicswap"
__version__ = "0.16.3" __version__ = "0.16.4"
+35 -21
View File
@@ -8421,12 +8421,10 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
# Verify amount # Verify amount
vout = getVoutByAddress(initiate_txn, p2sh) vout = getVoutByAddress(initiate_txn, p2sh)
out_value = make_int(initiate_txn["vout"][vout]["value"]) out_value: int = make_int(initiate_txn["vout"][vout]["value"])
ensure( ensure(
out_value == int(bid.amount), out_value == int(bid.amount),
"Incorrect output amount in initiate txn {}: {} != {}.".format( f"Incorrect output amount in initiate txn {self.logIDT(initiate_txnid_hex)}: {out_value} != {bid.amount}",
initiate_txnid_hex, out_value, int(bid.amount)
),
) )
bid.initiate_tx.conf = initiate_txn["confirmations"] bid.initiate_tx.conf = initiate_txn["confirmations"]
@@ -8454,21 +8452,21 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
) )
index = None index = None
if found: if found:
if ( if "index" not in found:
"value" in found
and found["value"] is not None
and found["value"] != int(bid.amount)
):
self.setBidError( self.setBidError(
bid, bid,
"Incorrect output amount in initiate txn {}: {} != {}.".format( f"Swap output index not found for initiate txn {self.logIDT(initiate_txnid_hex)}",
initiate_txnid_hex, found["value"], int(bid.amount) )
), return True
txo_value: int = found.get("value", None)
if txo_value != bid.amount:
self.setBidError(
bid,
f"Incorrect output amount in initiate txn {self.logIDT(initiate_txnid_hex)}: {txo_value} != {bid.amount}",
) )
return True return True
bid.initiate_tx.conf = found["depth"] bid.initiate_tx.conf = found["depth"]
if "index" in found: index = found["index"]
index = found["index"]
tx_height = found["height"] tx_height = found["height"]
if bid.initiate_tx.conf != last_initiate_txn_conf: if bid.initiate_tx.conf != last_initiate_txn_conf:
@@ -8554,6 +8552,21 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
vout=participate_txvout, vout=participate_txvout,
) )
if found: if found:
participate_txid_hex: str = found.get(
"txid",
None if participate_txid is None else participate_txid.hex(),
)
# Double check value
txo_value: int = found.get("value", None)
if (
txo_value != bid.amount_to
and bid.debug_ind != DebugTypes.MAKE_INVALID_PTX
):
self.setBidError(
bid,
f"Incorrect output amount in participate txn {self.logIDT(participate_txid_hex)}: {txo_value} != {bid.amount_to}",
)
return True
index = found.get("index", participate_txvout) index = found.get("index", participate_txvout)
if bid.participate_tx.conf != found["depth"]: if bid.participate_tx.conf != found["depth"]:
save_bid = True save_bid = True
@@ -8561,15 +8574,16 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
bid.participate_tx.conf is None bid.participate_tx.conf is None
and bid.participate_tx.state != TxStates.TX_SENT and bid.participate_tx.state != TxStates.TX_SENT
): ):
txid = found.get(
"txid",
None if participate_txid is None else participate_txid.hex(),
)
self.log.debug( self.log.debug(
f"Found bid {self.log.id(bid_id)} participate txn {self.log.id(txid)} in chain {ci_to.coin_name()}." f"Found bid {self.log.id(bid_id)} participate txn {self.logIDT(participate_txid_hex)} in chain {ci_to.coin_name()}."
) )
self.addParticipateTxn( self.addParticipateTxn(
bid_id, bid, coin_to, txid, index, found["height"] bid_id,
bid,
coin_to,
participate_txid_hex,
index,
found["height"],
) )
# Only update tx state if tx hasn't already been seen # Only update tx state if tx hasn't already been seen
@@ -8587,7 +8601,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
if bid.participate_tx.conf is not None: if bid.participate_tx.conf is not None:
self.log.debug( self.log.debug(
f"participate txid {self.log.id(bid.participate_tx.txid)} confirms {bid.participate_tx.conf}." f"Participate txid {self.logIDT(bid.participate_tx.txid)} confirms {bid.participate_tx.conf}."
) )
if ( if (
bid.participate_tx.conf bid.participate_tx.conf
+3 -3
View File
@@ -135,15 +135,15 @@
(define-public basicswap (define-public basicswap
(package (package
(name "basicswap") (name "basicswap")
(version "0.16.2") (version "0.16.4")
(source (origin (source (origin
(method git-fetch) (method git-fetch)
(uri (git-reference (uri (git-reference
(url "https://github.com/basicswap/basicswap") (url "https://github.com/basicswap/basicswap")
(commit "ced017ab3a3234c68d3d8f773cf9ceb187a39adb"))) (commit "136b311dc68f11b9c12ebd6877c5f718d705603a")))
(sha256 (sha256
(base32 (base32
"0manck3zlf05by08b825ynqk7q1byzgy7p3i8chpg413mqkx7q5r")) "0ikr8ik9rklvafd1j8zj0y38vric02qhmj7pvp3kvzbmd2fxx95p"))
(file-name (git-file-name name version)))) (file-name (git-file-name name version))))
(build-system pyproject-build-system) (build-system pyproject-build-system)
+2 -2
View File
@@ -8,7 +8,7 @@ description = "Simple atomic swap system"
keywords = ["crypto", "cryptocurrency", "particl", "bitcoin", "monero", "wownero"] keywords = ["crypto", "cryptocurrency", "particl", "bitcoin", "monero", "wownero"]
readme = "README.md" readme = "README.md"
license = {file = "LICENSE"} license = {file = "LICENSE"}
requires-python = ">=3.9" requires-python = ">=3.11"
classifiers = [ classifiers = [
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License", "License :: OSI Approved :: MIT License",
@@ -36,7 +36,7 @@ dev = [
"pre-commit", "pre-commit",
"pytest", "pytest",
"ruff", "ruff",
"black==25.11.0", "black==26.3.1",
"selenium", "selenium",
] ]