This reverts commit fa940f41eaffa4b2a28c465a10a4c12d4b8976b8.
With this commit produce the following compilation error.
Making all in src
make[1]: Entering directory '/home/vincent/Github/bitcoin/src'
make[2]: Entering directory '/home/vincent/Github/bitcoin/src'
make[3]: Entering directory '/home/vincent/Github/bitcoin'
make[3]: Leaving directory '/home/vincent/Github/bitcoin'
GEN obj/build.h
CXX libbitcoin_util_a-clientversion.o
AR libbitcoin_util.a
CXXLD bitcoind
CXXLD bitcoin-cli
CXXLD bitcoin-tx
CXXLD bitcoin-wallet
CXXLD bitcoin-util
CXX test/test_bitcoin-base58_tests.o
test/base58_tests.cpp: In member function ‘void base58_tests::base58_EncodeBase58::test_method()’:
test/base58_tests.cpp:26:44: error: invalid initialization of reference of type ‘const std::string&’ {aka ‘const std::__cxx11::basic_string<char>&’} from expression of type ‘const unsigned char [1462]’
26 | UniValue tests = read_json(json_tests::base58_encode_decode);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from test/base58_tests.cpp:8:
./test/util/json.h:12:39: note: in passing argument 1 of ‘UniValue read_json(const std::string&)’
12 | UniValue read_json(const std::string& jsondata);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~
test/base58_tests.cpp: In member function ‘void base58_tests::base58_DecodeBase58::test_method()’:
test/base58_tests.cpp:46:44: error: invalid initialization of reference of type ‘const std::string&’ {aka ‘const std::__cxx11::basic_string<char>&’} from expression of type ‘const unsigned char [1462]’
46 | UniValue tests = read_json(json_tests::base58_encode_decode);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
./test/util/json.h:12:39: note: in passing argument 1 of ‘UniValue read_json(const std::string&)’
12 | UniValue read_json(const std::string& jsondata);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~
make[2]: *** [Makefile:18253: test/test_bitcoin-base58_tests.o] Error 1
make[2]: Leaving directory '/home/vincent/Github/bitcoin/src'
make[1]: *** [Makefile:20006: all-recursive] Error 1
make[1]: Leaving directory '/home/vincent/Github/bitcoin/src'
make: *** [Makefile:815: all-recursive] Error 1
The main problem is that we can not auto-convert an unsigned char string to a std::string.
But why the CI did not catch this?
cc: @MarcoFalke, @stickies-v @TheCharlatan
<!-- *** Please remove the following help text before submitting: *** Pull requests without a rationale and clear improvement may be closed immediately. GUI-related pull requests should be opened against https://github.com/bitcoin-core/gui first. See CONTRIBUTING.md -->
<!-- Please provide clear motivation for your patch and explain how it improves Bitcoin Core user experience or Bitcoin Core developer experience significantly: * Any test improvements or new tests that improve coverage are always welcome. * All other changes should have accompanying unit tests (see `src/test/`) or functional tests (see `test/`). Contributors should note which tests cover modified code. If no tests exist for a region of modified code, new tests should accompany the change. * Bug fixes are most welcome when they come with steps to reproduce or an explanation of the potential issue as well as reasoning for the way the bug was fixed. * Features are welcome, but might be rejected due to design or scope issues. If a feature is based on a lot of dependencies, contributors should first consider building the system outside of Bitcoin Core, if possible. * Refactoring changes are only accepted if they are required for a feature or bug fix or otherwise improve developer experience significantly. For example, most "code style" refactoring changes require a thorough explanation why they are useful, what downsides they have and why they *significantly* improve developer experience or avoid serious programming bugs. Note that code style is often a subjective matter. Unless they are explicitly mentioned to be preferred in the [developer notes](/doc/developer-notes.md), stylistic code changes are usually rejected. -->
<!-- Bitcoin Core has a thorough review process and even the most trivial change needs to pass a lot of eyes and requires non-zero or even substantial time effort to review. There is a huge lack of active reviewers on the project, so patches often sit for a long time. -->