Skip to content

Validate confirmation target#3426

Open
caydyan wants to merge 1 commit into
CounterpartyXCP:developfrom
caydyan:fix-confirmation-target-validation-develop
Open

Validate confirmation target#3426
caydyan wants to merge 1 commit into
CounterpartyXCP:developfrom
caydyan:fix-confirmation-target-validation-develop

Conversation

@caydyan

@caydyan caydyan commented Jun 10, 2026

Copy link
Copy Markdown

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

prepare_fee_parameters() accepted any confirmation_target value before passing it to Bitcoin Core fee estimation. The backend helper documents the valid range as 1 to 1008 blocks, but compose-time callers could pass 0, negative values, or values above 1008 and let the error surface later at the RPC layer.

This PR validates the confirmation target before calling estimatesmartfee.

Changes:

  • Adds MAX_CONFIRMATION_TARGET = 1008.
  • Rejects confirmation_target values below 1 or above 1008 when fee estimation will use the parameter.
  • Adds regression coverage for 0, negative, and above-range values.

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