The script/bitcoinconsensus
module defines the public interface for the bitcoinconsensus
library. Even though this module is only required by the tests and the bitcoinconsensus
library, it is currently compiled into the static internal libbitcoin_consensus
library, and therefore used by a bunch of build targets that do not require it.
Since it is always part of the internal library, the HAVE_CONSENSUS_LIB
define used by the tests is essentially
meaningless, since the module is always available. This can be verified on master by removing the HAVE_CONSENSUS_LIB
checks in the tests, configuring with --with-libs=no
, and running make check
.
Improve all of this by including the bitcoinconsensus
module only where it is required and removing the HAVE_CONSENSUS_LIB
define.
An alternative to this patch was discussed in https://github.com/hebasto/bitcoin/pull/41: Actually linking the test binaries with the external consensus library if it is available. This has the disadvantage though that if the dynamic consensus library is built, it has to be available for the test binaries to load whenever and wherever they are being run.