> Migrates the CScriptNum decode tests into a unit test, and moved some
> changes made in [[https://github.com/bitcoin/bitcoin/pull/14816 | core#14816]]. Made possible by the integration of
> test_framework unit testing in [[https://github.com/bitcoin/bitcoin/pull/18576 | core#18576]]. Further extends the original
> test with larger ints, similar to the scriptnum_tests.cpp file. Adds
> test to blocktools.py testing fn create_coinbase() with CScriptNum
> decode.
Backport note:
The functional tests are usually executed individually via a `subprocess`.
This means the `get_srcdir()` function in cdefs.py is able to find the
the proper source directory, because the parent directory of the ppython process is
the project root that contains `src/`.
But when we run the new test_framework unit test, the process currently running
is `test_runner.py` itself which is located in the build directory.
So cdefs.py finds the wrong `src/` directory, the one located in the build
directory, which does not contain `consensus.h`.
I fixed this by setting the environment variable `SRCDIR` in `test_runner.py`
before callingSo cdefs.py finds the unittest `unittest.TestLoader().loadTestsFromName` machinerywrong `src/` directory, the one located in the build directory, which does not contain `consensus.h`.
I fixed this by setting the environment variable `SRCDIR` in `test_runner.py` before calling the unittest `unittest.TestLoader().loadTestsFromName` machinery which causes `cdefs.py` to be imported.
This is a backport of [[https://github.com/bitcoin/bitcoin/pull/19082 | core#19082]]