2

I'm considering writing unit tests to Bitcoin core as a first step to C++ development and Bitcoin contribution. Anyone have any suggestions about the journey I'm about to begin and possible files that are needing tests?

2 Answers 2

1

Jumping straight to writing unit test can be hard, I suggest You check the official github page for how to contribute to the bitcoin core:

https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md

If I wanted to contribute I would personally start by trying to solve some of the problems on their issues page because it is fresh, there is a lot of work, some can be easy and help is always needed:

https://github.com/bitcoin/bitcoin/issues

1

If you are learning C++ from scratch you may struggle to start writing unit tests to begin with even if you identify a particular unit test that is missing. So that is one challenge.

In terms of discovering a missing unit test to write there are various ways to do this. It is worth monitoring the good first issues on the GitHub repo though I think that would be relying on a PR author deliberately not writing a unit test and leaving it as a good first issue.

Alternatively you could check out the unit test coverage on Marco Falke's site to see what files have low unit test coverage.

A useful case study is Fabian Jahr's first contribution to Core which was a simple code change that meant MacOS users skipped a functional test that was flaky on MacOS. He did a couple of excellent talks at Bitcoin Edge Dev++ 2019 on the Bitcoin Core functional test framework and on debugging Bitcoin Core.

Probably the most productive use of your time though would be to attend the weekly Bitcoin Core PR review club set up by John Newbery. Every week a different PR is chosen and during that you can ask about the tests written for a particular PR and whether there are any unit tests that are missing. You can attend on IRC at ##bitcoin-core-pr-reviews and you can ask whatever you want. New contributors are generally the primary target audience.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.