Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bitcoin-tx: Require that input amount is provided for witness transactions #23784

Merged

Conversation

theStack
Copy link
Contributor

@theStack theStack commented Dec 15, 2021

This PR picks up the obviously abandoned PR #13608 (last activity was three and a half years ago) by rebasing it on master and adding missing tests. Original PR description: "Applies fix from #12458 / #13547 to bitcoin-tx."

The private key is the compressed version of the one used in most other util tests (5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf, corresponds to the scalar value k=1 in big endian), since segwit signing refuses uncompressed keys.

The error message from the picked up PR is changed to not include the amount, as showing any value would be just confusing.

Copy link
Member

@josibake josibake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

+1 for adding the tests! I don't think printing nValue=21000000.00000000 is a great idea, so I left a suggestion inline

src/bitcoin-tx.cpp Outdated Show resolved Hide resolved
@josibake
Copy link
Member

One other suggestion: add a test with a 0 amount as that is a good (edge?) case to have tested.

Empact and others added 2 commits December 29, 2021 21:12
@theStack theStack force-pushed the bitcoin-tx_check_witness_input_amount branch from 8dc5fa1 to 8bd34dc Compare December 29, 2021 20:26
@theStack
Copy link
Contributor Author

Thanks for the valuable review @josibake! Rebased on master and force-pushed with the following adaptions:

(git range-diff 8dc5fa1...8bd34dc)

@josibake
Copy link
Member

ACK 8bd34dc

@maflcko
Copy link
Member

maflcko commented Jan 3, 2022

Needs OP adjusted before merge?

@theStack
Copy link
Contributor Author

theStack commented Jan 3, 2022

Needs OP adjusted before merge?

Thanks, done.

@maflcko maflcko merged commit 34118bf into bitcoin:master Jan 5, 2022
@theStack theStack deleted the bitcoin-tx_check_witness_input_amount branch January 5, 2022 16:51
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jan 6, 2022
…d for witness transactions

8bd34dc test: check that bitcoin-tx detects missing input amount for segwit transactions (Sebastian Falbesoner)
c337b27 Require that input amount is provided for bitcoin-tx witness transactions (Ben Woosley)

Pull request description:

  This PR picks up the obviously abandoned PR bitcoin#13608 (last activity was three and a half years ago) by rebasing it on master and adding missing tests. Original PR description: "_Applies fix from bitcoin#12458 / bitcoin#13547 to bitcoin-tx._"

  The private key is the compressed version of the one used in most other util tests (5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf, corresponds to the scalar value k=1 in big endian), since segwit signing refuses uncompressed keys.

  The error message from the picked up PR is changed to not include the amount, as showing any value would be just confusing.

ACKs for top commit:
  josibake:
    ACK bitcoin@8bd34dc

Tree-SHA512: 334b418f89527363ad7e3326b4126e86a05fd64876c49a8280de38e64cfac52cb62c4b24b83603dd68b6bcebbe57c64161832edffb1cac7e9c68426f6b6eae1f
@bitcoin bitcoin locked and limited conversation to collaborators Jan 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants