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

test: modify weight estimate in functional tests #29502

Merged
merged 2 commits into from Mar 5, 2024

Conversation

m3dwards
Copy link
Contributor

@m3dwards m3dwards commented Feb 28, 2024

Fixes: #25164

The wallet_send functional test has been flaky due to a slightly overestimated weight calculation. This PR makes the weight calculation more accurate, although occasionally, due to how ECDSA signatures can be different lengths it might slightly over estimate. The assertion in the test can handle this slight variation and so should continue passing.

Update:

Because the signature can be shorter that is used in the weight estimation or the final transaction the estimate could be both slightly smaller or slightly larger.

@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 28, 2024

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

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK achow101, S3RK

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #29278 (Wallet: Add maxfeerate wallet startup option by ismaelsadeeq)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@DrahtBot
Copy link
Contributor

🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the
documentation.

Possibly this is due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.

Leave a comment here, if you need help tracking down a confusing failure.

Debug: https://github.com/bitcoin/bitcoin/runs/22070837167

@achow101 achow101 added this to the 27.0 milestone Feb 28, 2024
Copy link
Member

@achow101 achow101 left a comment

Choose a reason for hiding this comment

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

There is a test in rpc_psbt.py that does basically the same thing. Any changes made here should probably be made to that test as well since it tests the same feature in the psbt workflow.

test/functional/wallet_send.py Outdated Show resolved Hide resolved
Updates the weight estimate to be more accurate by removing byte buffers and calculating the length of the count of scriptWitnesses rather than just using the count itself.
Rather than asserting that the exact fees are the same, check the fee rate rounded to nearest interger. This will account for small differences in fees caused by variability in ECDSA signature lengths.
@m3dwards m3dwards changed the title test: modify weight estimate in wallet_send test: modify weight estimate in functional tests Mar 1, 2024
@m3dwards
Copy link
Contributor Author

m3dwards commented Mar 1, 2024

Force pushed new version addressing @achow101 's comments.

Switched the assertion in wallet_send.py to calculate the fee rate to the nearest satoshi rather than the precise fee.

@achow101
Copy link
Member

achow101 commented Mar 1, 2024

ACK e67ab17

@S3RK
Copy link
Contributor

S3RK commented Mar 5, 2024

Code review ACK e67ab17

@fanquake fanquake merged commit 2b260ea into bitcoin:master Mar 5, 2024
16 checks passed
@m3dwards m3dwards deleted the weight-calc-wallet-send branch March 8, 2024 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Intermittent CI failure "fee too high" in wallet_send.py
5 participants