Skip to content

test: miner: add coverage for -blockmintxfee setting - #27620

Merged
fanquake merged 1 commit into
bitcoin:masterfrom
theStack:202305-test-add_blockmintxfee_coverage
Jul 20, 2023
Merged

fanquake merged 1 commit into
bitcoin:masterfrom
theStack:202305-test-add_blockmintxfee_coverage

Conversation

@theStack

Copy link
Copy Markdown
Contributor

This PR adds missing test coverage for the -blockmintxfee option, which can be used by miners to specify the lowest fee-rate for transactions to be included in blocks. The setting was introduced in PR #9380 (commit daec955), with the rationale to decouple different minimum fees from -minrelaytxfee. According to the PR description it "should be set by miners to reflect their marginal cost of transmitting extra bytes.".

On each iteration, the test creates and submits two txs using MiniWallet: one with the the minimum fee-rate as specified for -blockmintxfee and a second one with a fee-rate a little below that (-0.01 sats/vbyte). Then it checks that only the first one is picked for the block template and accordingly also only exists in the block that is mined after. This is repeatedly done for a fixed (but obviously somewhat arbitrary) list of different -blockmintxfee settings on a single node, including the default and zero (i.e. no minimum fee a.k.a. "include even zero-fee txs") settings.

@DrahtBot

DrahtBot commented May 10, 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 ryanofsky, brunoerg, glozow

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 May 10, 2023
@brunoerg

Copy link
Copy Markdown
Contributor

Concept ACK

@glozow
glozow requested a review from brunoerg June 2, 2023 13:23
Comment thread test/functional/mining_basic.py Resolved

@brunoerg brunoerg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

crACK 989fa37670cbb386873a765799fd6db8ea6986f7

Nice test coverage!

Just a thought that came to my mind while reviewing it:

  • Seems like these test coverage uses just 1 node, if we'd stop node1 right before line 81, it wouldn't make the test to fail. So, it seems that -minrelaytxfee=0 is just to make send_self_transfer - which calls sendrawtransaction - not fail (even if we might not have any connection).

@theStack
theStack force-pushed the 202305-test-add_blockmintxfee_coverage branch from 989fa37 to 7286efe Compare June 4, 2023 17:19
@theStack

theStack commented Jun 4, 2023

Copy link
Copy Markdown
Contributor Author

Thanks for reviewing! Addressed the nit.

Just a thought that came to my mind while reviewing it:

  • Seems like these test coverage uses just 1 node, if we'd stop node1 right before line 81, it wouldn't make the test to fail. So, it seems that -minrelaytxfee=0 is just to make send_self_transfer - which calls sendrawtransaction - not fail (even if we might not have any connection).

Yes indeed, this sub-test works with a single node (it follows the design of previously introduced tests mempool_dust.py and mempool_sigoplimit.py, see #26631, #27171), i.e. with a self.stop_node(1) call at the beginning it would still succeed -- just verified that. Decided to not stop node1 though, as I think it makes sense to keep all nodes alive for potential future sub-tests. Note that the -minrelaytxfee=0 setting is needed in any case, in order to get low/zero-fee-rate txs into the mempool.

Comment thread test/functional/mining_basic.py Resolved
@glozow
glozow requested a review from brunoerg July 5, 2023 09:39

@brunoerg brunoerg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

reACK 7286efece4442c5afe4e19fa6a7d2420444c904c

Comment thread test/functional/mining_basic.py Resolved
Comment thread test/functional/mining_basic.py Resolved
Comment thread test/functional/mining_basic.py Resolved
Comment thread test/functional/mining_basic.py Resolved
Comment thread test/functional/mining_basic.py Resolved
@theStack
theStack force-pushed the 202305-test-add_blockmintxfee_coverage branch from 7286efe to 95465cd Compare July 7, 2023 13:50
Comment thread test/functional/mining_basic.py Resolved
@theStack
theStack force-pushed the 202305-test-add_blockmintxfee_coverage branch from 95465cd to bbbb89d Compare July 7, 2023 13:56

@ryanofsky ryanofsky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code review ACK bbbb89d, nice test

@DrahtBot
DrahtBot requested a review from brunoerg July 20, 2023 13:53

@brunoerg brunoerg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

reACK bbbb89d

changes since my last review looks good!

@glozow glozow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK bbbb89d, sorry for the late re-review!

@fanquake
fanquake merged commit 7995490 into bitcoin:master Jul 20, 2023
@theStack
theStack deleted the 202305-test-add_blockmintxfee_coverage branch July 20, 2023 18:09
@bitcoin bitcoin locked and limited conversation to collaborators Jul 19, 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.

7 participants