Skip to content

test: various converttopsbt check cleanups in rpc_psbt.py - #27325

Merged
achow101 merged 1 commit into
bitcoin:masterfrom
theStack:test_psbt_cleanups
May 4, 2023
Merged

achow101 merged 1 commit into
bitcoin:masterfrom
theStack:test_psbt_cleanups

Conversation

@theStack

@theStack theStack commented Mar 24, 2023 •

Copy link
Copy Markdown
Contributor

In the functional test rpc_psbt.py, some comments around the converttopsbt RPC checks are wrong or outdated and can be removed:

Error could be either "TX decode failed" (segwit inputs causes
parsing to fail) or "Inputs must not have scriptSigs and
scriptWitnesses"

Decoding a valid TX with at least one input always succeeds with the heuristic, i.e. this comment is not right and we can assert for the error string "Inputs must not have scriptSigs and scriptWitnesses" on the calls below.

We must set iswitness=True because the serialized transaction has
inputs and is therefore a witness transaction

This is also unneeded (and confusing, w.r.t. "is therefore a witness transaction"?), for a TX with one input there is no need to set the iswitness parameter. For sake of completeness, we still keep one variant where iswitness is explicitly set to true.

Lastly, there is a superflous converttopsbt call on the raw tx which is the same as just about ~10 lines above, so it can be removed.

In the functional test rpc_psbt.py, some comments around the
`converttopsbt` RPC checks are wrong or outdated and can be
removed:

> Error could be either "TX decode failed" (segwit inputs causes
> parsing to fail) or "Inputs must not have scriptSigs and
> scriptWitnesses"

Decoding a valid TX with at least one input always succeeds with the
heuristic, i.e. this comment is not right and we can assert for the
error string "Inputs must not have scriptSigs and scriptWitnesses"
on the calls below.

> We must set iswitness=True because the serialized transaction has
> inputs and is therefore a witness transaction

This is also unneeded (and confusing, w.r.t. "is therefore a witness
transaction"?), for a TX with one input there is no need to set the
`iswitness` parameter. For sake of completeness, we still keep one
variant where iswitness is explicitly set to true.

Lastly, there is a superflous `converttopsbt` call on the raw tx which
is the same as just about ~10 lines above, so it can be removed.
@DrahtBot

DrahtBot commented Mar 24, 2023 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK ismaelsadeeq, achow101

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@DrahtBot DrahtBot added the Tests label Mar 24, 2023
@fanquake
fanquake requested a review from instagibbs March 24, 2023 17:03
@ismaelsadeeq

Copy link
Copy Markdown
Member

tested ACK afc2dd5

I ran the test and it passed.

@achow101

achow101 commented May 4, 2023

Copy link
Copy Markdown
Member

ACK afc2dd5

@achow101
achow101 merged commit 30bf70c into bitcoin:master May 4, 2023
@theStack
theStack deleted the test_psbt_cleanups branch May 4, 2023 15:11
@bitcoin bitcoin locked and limited conversation to collaborators May 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants