Skip to content

Validate compose fee parameters#3423

Open
caydyan wants to merge 1 commit into
CounterpartyXCP:developfrom
caydyan:fix-compose-fee-param-validation-develop
Open

Validate compose fee parameters#3423
caydyan wants to merge 1 commit into
CounterpartyXCP:developfrom
caydyan:fix-compose-fee-param-validation-develop

Conversation

@caydyan

@caydyan caydyan commented Jun 10, 2026

Copy link
Copy Markdown

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

prepare_fee_parameters() accepted negative fee inputs. Negative exact_fee, sat_per_vbyte, or max_fee can flow into input selection and change calculation, producing impossible negative-fee compose results or change outputs larger than the selected inputs.

This PR rejects negative compose fee parameters up front with a clear ComposeError.

Changes:

  • Rejects negative exact_fee.
  • Rejects negative sat_per_vbyte.
  • Rejects negative max_fee.
  • Adds regression coverage for all three fee parameters.

Tests:

  • python -m pytest counterpartycore/test/units/api/composer_test.py::test_prepare_fee_parameters -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