test: fix misleading fee unit in mempool_limit.py#22972
Merged
maflcko merged 1 commit intobitcoin:masterfrom Oct 29, 2021
Merged
Conversation
The helper `send_large_txs` in its current interface has a fee_rate parameter, implying that it would create a transaction with exactly that rate. Unfortunately, this fee rate is only passed to MiniWallet's `create_self_transfer` method, which can't know that we append several tx outputs after, increasing the tx's vsize and decreasing it's fee rate accordingly. In our case, the fee rate is off by several orders of magnitude, as the tx's vsize changes changes from 96 to 67552 vbytes (>700x), i.e. the value passed to this function is neither really a fee rate nor an absolute fee, but something in-between, which is very confusing. Clarify the interface by passing an absolute fee that is deducted in the end (and verified, via testmempoolaccept) and also describe how we come up with the value passed.
Contributor
|
Concept ACK |
michaelfolkson
left a comment
There was a problem hiding this comment.
Concept ACK
the value passed to this function is neither really a fee rate nor an absolute fee
Definitely seems optimal to exclusively use absolute fee and fee rate rather than having some hard to define third variable
| def send_large_txs(self, node, miniwallet, txouts, fee, tx_batch_size): | ||
| for _ in range(tx_batch_size): | ||
| tx = miniwallet.create_self_transfer(from_node=node, fee_rate=fee_rate)['tx'] | ||
| tx = miniwallet.create_self_transfer(from_node=node, fee_rate=0, mempool_valid=False)['tx'] |
There was a problem hiding this comment.
Should this No, fee_rate be replaced by fee here too?create_self_transfer has a fee_rate argument
stratospher
reviewed
Oct 28, 2021
Contributor
stratospher
left a comment
There was a problem hiding this comment.
ACK 2600db6.
This change clarifies the problem with the fee rates in the test.
sidhujag
pushed a commit
to syscoin/syscoin
that referenced
this pull request
Oct 29, 2021
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.
The PR is a follow-up to #22543. The helper
send_large_txsin its current interface has a fee_rate parameter, implying that it would create a transaction with exactly that rate. Unfortunately, this fee rate is only passed to MiniWallet'screate_self_transfermethod, which can't know that we append several tx outputs after, increasing the tx's vsize and decreasing it's fee rate accordingly.In our case, the fee rate is off by several orders of magnitude, as the tx's vsize changes changes from 96 to 67552 vbytes (>700x), i.e. the value passed to this function is neither really a fee rate nor an absolute fee, but something in-between, which is very confusing. It was suggested to simply in-line this helper as it's currently only used in this single test (#22543 (comment), #22543 (comment)), but I could imagine that this helper may also become useful for other tests and may be moved to a library (e.g. wallet.py) in the future.
Clarify the interface by passing an absolute fee that is deducted in the end (and also verified, via testmempoolaccept) and also describe how we come up with the value passed. On master, the comment says that the fee rate needs to increased "massively"; this word is also removed because the fee rate only needs to be higher for the test to succeed.