Skip to content

Reject duplicate inputs_set UTXOs#3428

Open
caydyan wants to merge 1 commit into
CounterpartyXCP:developfrom
caydyan:fix-duplicate-inputs-set-validation-develop
Open

Reject duplicate inputs_set UTXOs#3428
caydyan wants to merge 1 commit into
CounterpartyXCP:developfrom
caydyan:fix-duplicate-inputs-set-validation-develop

Conversation

@caydyan

@caydyan caydyan commented Jun 10, 2026

Copy link
Copy Markdown

Supersedes #3386 with the same fix rebased onto the current develop branch.

prepare_inputs_set() accepted duplicate UTXOs in the caller-provided inputs_set list. The duplicated entries are returned as separate inputs, so later input selection can count the same UTXO value more than once and build a transaction with duplicate outpoints.

This PR rejects duplicate UTXOs while parsing inputs_set.

Changes:

  • Tracks seen <txid>:<vout> identifiers while parsing inputs_set.
  • Rejects repeated UTXOs with a clear ComposeError.
  • Adds regression coverage for duplicate explicit inputs.

Tests:

  • python -m pytest counterpartycore/test/units/api/composer_test.py::test_prepare_inputs_set -q
  • python -m pytest counterpartycore/test/units/api/composer_test.py -q
  • python -m ruff check counterpartycore/lib/api/composer.py counterpartycore/test/units/api/composer_test.py
  • python -m ruff format --check counterpartycore/lib/api/composer.py counterpartycore/test/units/api/composer_test.py
  • git diff --check

Bounty payment address (BTC): bc1qev5ant33v5y89qqjvcf4mh9hlax5svqf5xd7gc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant