Skip to content

Validate utxo_value parameters#3425

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

Validate utxo_value parameters#3425
caydyan wants to merge 1 commit into
CounterpartyXCP:developfrom
caydyan:fix-utxo-value-param-validation-develop

Conversation

@caydyan

@caydyan caydyan commented Jun 10, 2026

Copy link
Copy Markdown

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

move.compose() and attach.compose() accepted utxo_value values outside Bitcoin's valid output amount range. The parameter is converted to int and then used as a destination output amount, so negative or above-21M-BTC values can flow into transaction output construction.

This PR rejects invalid utxo_value values before they are returned as compose destinations.

Changes:

  • Rejects negative utxo_value in move.compose().
  • Rejects above-21M-BTC utxo_value in move.compose().
  • Rejects negative utxo_value in attach.compose().
  • Rejects above-21M-BTC utxo_value in attach.compose().
  • Adds regression coverage for both message types.

Tests:

  • python -m pytest counterpartycore/test/units/messages/move_test.py::test_compose counterpartycore/test/units/messages/attach_test.py::test_compose -q
  • python -m pytest counterpartycore/test/units/messages/move_test.py counterpartycore/test/units/messages/attach_test.py -q
  • python -m ruff check counterpartycore/lib/messages/move.py counterpartycore/lib/messages/attach.py counterpartycore/test/units/messages/move_test.py counterpartycore/test/units/messages/attach_test.py
  • python -m ruff format --check counterpartycore/lib/messages/move.py counterpartycore/lib/messages/attach.py counterpartycore/test/units/messages/move_test.py counterpartycore/test/units/messages/attach_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