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

mining: Improve block template generator test coverage #1884

Closed
sefbkn opened this issue Sep 7, 2019 · 2 comments
Closed

mining: Improve block template generator test coverage #1884

sefbkn opened this issue Sep 7, 2019 · 2 comments
Labels
test coverage Discussion and pull requests for improving test coverage.

Comments

@sefbkn
Copy link
Member

sefbkn commented Sep 7, 2019

The block template generator does not have high test coverage. As a result, making non-trivial changes to the mining strategy without breaking assumptions is more difficult than it could be. There need to be additional tests around NewBlockTemplate to anchor existing behavior and related consensus rules. Splitting this work across multiple pull requests should make changes easier to review since there are many scenarios to account for.

This issue partially blocks #1556

@davecgh
Copy link
Member

davecgh commented Sep 7, 2019

Agreed that this would be ideal. I suspect that splitting out the mining code into the the mining package would significantly help make it more testable.

@davecgh davecgh added the test coverage Discussion and pull requests for improving test coverage. label Dec 28, 2019
@rstaudt2
Copy link
Member

rstaudt2 commented Sep 8, 2021

A testing framework was added for this in #2480, and additional test coverage was added alongside the automatic ticket revocations agenda in #2720. As of #2720, this hits about 70% coverage of NewBlockTemplate:

go test -run="TestNewBlockTemplate" -coverprofile=cov.out &&
go tool cover -func=cov.out | grep -E "NewBlockTemplate"

github.com/decred/dcrd/internal/mining/mining.go:1169:    NewBlockTemplate    69.8%

Still plenty of room for further coverage, but linking work that has already been completed toward this.

@davecgh davecgh closed this as completed Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test coverage Discussion and pull requests for improving test coverage.
Projects
None yet
Development

No branches or pull requests

3 participants