test: update fee rate assertion helper in the functional test framework#23136
Merged
maflcko merged 1 commit intobitcoin:masterfrom Oct 1, 2021
Merged
test: update fee rate assertion helper in the functional test framework#23136maflcko merged 1 commit intobitcoin:masterfrom
maflcko merged 1 commit intobitcoin:masterfrom
Conversation
0881046 to
4774f84
Compare
4774f84 to
f4f0ec5
Compare
Member
Author
|
Thanks for the quick look. Fixed, simplified, and updated the description to explain the changes. |
Contributor
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
This was referenced Sep 30, 2021
- update call to round() with satoshi_round() to avoid intermittent test failures - rename fee_per_kB to feerate_BTC_kvB for precision - store division result in feerate_BTC_vB
f4f0ec5 to
b658d7d
Compare
Member
|
I think the test is correct and this is a bug that should be fixed: #22949 (comment) |
Member
Author
|
Thanks everyone. Sanity check if anyone passing by is curious: --- a/test/functional/test_framework/util.py
+++ b/test/functional/test_framework/util.py
@@ -38,6 +38,12 @@ def assert_fee_amount(fee, tx_size, feerate_BTC_kvB):
"""Assert the fee is in range."""
feerate_BTC_vB = feerate_BTC_kvB / 1000
target_fee = satoshi_round(tx_size * feerate_BTC_vB)
+ target_fee_old = round(tx_size * feerate_BTC_vB, 8)
+
+ import pprint
+ pprint.pprint(f"{target_fee_old} round()")
+ pprint.pprint(f"{target_fee} satoshi_round()")
+
if fee < target_fee:
raise AssertionError("Fee of %s BTC too low! (Should be %s BTC)" % (str(fee), str(target_fee)))
# allow the wallet's estimation to be at most 2 bytes off |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to 42e1b5d (#12486).
round()with our utility functionsatoshi_round()to avoid intermittent test failuresfee_per_kBtofeerate_BTC_kvBfor precisionfeerate_BTC_vBPossibly resolves #19418.