Skip to content

Conversation

@jnewbery
Copy link
Contributor

@jnewbery jnewbery commented Apr 11, 2017

This PR refactors the getblocktemplate_proposals.py functional test into a more general mining test, which covers the submitblock RPC as well as the getblocktemplate propose mode.

Motivation was to add a regression test for #10146

This test removes all the manual block/transaction construction from the test case and uses the mininode classes to achieve the same tests. Result is less lines of code, and hopefully clearer and easier for people to extend/maintain since we're no longer hacking bits in a serialised block.

@gmaxwell since he wrote the fix for #10146

EDIT: there are lots of commits in this PR to aid reviewers. They can be squashed down into larger commits before merging.

Copy link
Contributor

@jimmysong jimmysong left a comment

Choose a reason for hiding this comment

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

utACK df93f6cc8d80e78eb8758a7d6b5148df9bc3afa9

Gets rid of a lot of duplicate logic. A few nits.

Copy link
Contributor

Choose a reason for hiding this comment

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

Guessing you'll want to change this comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

is tmpl['transactions'] expected to be empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I believe so

Copy link
Contributor

Choose a reason for hiding this comment

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

rename the test to MiningTest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed

Copy link
Contributor

Choose a reason for hiding this comment

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

MiningTest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

Copy link
Contributor

@jimmysong jimmysong left a comment

Choose a reason for hiding this comment

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

ACK 8d80db230b3a07680cec1c227ff84dbe0678cf45

@jnewbery jnewbery force-pushed the mining_functional_test branch from 8d80db2 to 8b8859b Compare May 3, 2017 15:27
@jnewbery
Copy link
Contributor Author

jnewbery commented May 9, 2017

@gmaxwell can I convince you to take a look at this? It adds a regression test for your fix in #10146

@gmaxwell
Copy link
Contributor

Concept ACK. I am testing the test.

@jnewbery
Copy link
Contributor Author

No great rush for this but it'd be good to get it in soonish. It includes a regression test for #10146, which was backported to 0.14.1. Other benefits:

  • tidies up test code
  • increases coverage of mining RPCs

@maflcko maflcko added this to the 0.15.0 milestone Jun 18, 2017
@jnewbery jnewbery force-pushed the mining_functional_test branch from 8b8859b to 11ba8e9 Compare June 27, 2017 15:02
@jnewbery
Copy link
Contributor Author

rebased

@jnewbery jnewbery changed the title Mining functional tests (including regression test for submitblock) [tests] mining functional tests (including regression test for submitblock) Jun 30, 2017
@laanwj
Copy link
Member

laanwj commented Jul 11, 2017

utACK 11ba8e9

@laanwj laanwj merged commit 11ba8e9 into bitcoin:master Jul 11, 2017
laanwj added a commit that referenced this pull request Jul 11, 2017
…est for submitblock)

11ba8e9 [tests] rename getblocktemplate_proposals.py to mining.py (John Newbery)
b29dd41 [tests] add test for submit block (John Newbery)
9bf0d80 [tests] run successful test in getblocktemplate first (John Newbery)
82dc597 [tests] don't build blocks manually in getblocktemplate test (John Newbery)
f82c709 [tests] clarify assertions in getblocktemplate test (John Newbery)
66c570a [tests] Don't build the coinbase manually in getblocktemplate test (John Newbery)
38b38cd [tests] getblocktemplate_proposals.py: add logging (John Newbery)
0a3a5ff [tests] Fix flake8 warnings in getblocktemplate tests (John Newbery)
32cffe6 [tests] Fix import order in getblocktemplate test (John Newbery)

Tree-SHA512: a51a57314fa1c4c4b8a7896492ec6e677b6bed12387060def34a62e9dfbee7961f71bb5553fbd70028be61ae32eccf13fd255fa9651f908e9a5e64c28f43f00e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 18, 2019
…ssion test for submitblock)

11ba8e9 [tests] rename getblocktemplate_proposals.py to mining.py (John Newbery)
b29dd41 [tests] add test for submit block (John Newbery)
9bf0d80 [tests] run successful test in getblocktemplate first (John Newbery)
82dc597 [tests] don't build blocks manually in getblocktemplate test (John Newbery)
f82c709 [tests] clarify assertions in getblocktemplate test (John Newbery)
66c570a [tests] Don't build the coinbase manually in getblocktemplate test (John Newbery)
38b38cd [tests] getblocktemplate_proposals.py: add logging (John Newbery)
0a3a5ff [tests] Fix flake8 warnings in getblocktemplate tests (John Newbery)
32cffe6 [tests] Fix import order in getblocktemplate test (John Newbery)

Tree-SHA512: a51a57314fa1c4c4b8a7896492ec6e677b6bed12387060def34a62e9dfbee7961f71bb5553fbd70028be61ae32eccf13fd255fa9651f908e9a5e64c28f43f00e
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants