From f02085e988ac7f87170d0939c41514f3d9ec0b26 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com> Date: Tue, 2 Aug 2022 22:05:18 +0530 Subject: [PATCH] revert dash#1432: Rename consensus source library and API It's a shared library, so we should keep its name and API distinguishable from Bitcoin's and avoid pkgconfig confusion Co-authored-by: UdjinM6 --- Makefile.am | 2 +- configure.ac | 4 ++-- doc/shared-libraries.md | 8 +------- libdashconsensus.pc.in | 2 +- src/Makefile.am | 18 +++++++++--------- src/compat/endian.h | 2 +- ...{dashconsensus.cpp => bitcoinconsensus.cpp} | 2 +- .../{dashconsensus.h => bitcoinconsensus.h} | 0 src/test/script_tests.cpp | 2 +- 9 files changed, 17 insertions(+), 23 deletions(-) rename src/script/{dashconsensus.cpp => bitcoinconsensus.cpp} (98%) rename src/script/{dashconsensus.h => bitcoinconsensus.h} (100%) diff --git a/Makefile.am b/Makefile.am index 78fcf544e9..5a8d5ee1af 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,7 +19,7 @@ export PYTHONPATH if BUILD_BITCOIN_LIBS pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libbitcoinconsensus.pc +pkgconfig_DATA = libdashconsensus.pc endif BITCOIND_BIN=$(top_builddir)/src/$(BITCOIN_DAEMON_NAME)$(EXEEXT) diff --git a/configure.ac b/configure.ac index 1e71ad97b2..e826f544c9 100644 --- a/configure.ac +++ b/configure.ac @@ -1331,7 +1331,7 @@ define(MINIMUM_REQUIRED_BOOST, 1.47.0) dnl Check for boost libs AX_BOOST_BASE([MINIMUM_REQUIRED_BOOST]) if test x$want_boost = xno; then - AC_MSG_ERROR([[only libbitcoinconsensus can be built without boost]]) + AC_MSG_ERROR([[only libdashconsensus can be built without boost]]) fi AX_BOOST_FILESYSTEM AX_BOOST_THREAD @@ -1537,7 +1537,7 @@ AC_MSG_CHECKING([whether to build libraries]) AM_CONDITIONAL([BUILD_BITCOIN_LIBS], [test x$build_bitcoin_libs = xyes]) if test x$build_bitcoin_libs = xyes; then AC_DEFINE(HAVE_CONSENSUS_LIB, 1, [Define this symbol if the consensus lib has been built]) - AC_CONFIG_FILES([libbitcoinconsensus.pc:libbitcoinconsensus.pc.in]) + AC_CONFIG_FILES([libdashconsensus.pc:libdashconsensus.pc.in]) fi AC_MSG_RESULT($build_bitcoin_libs) diff --git a/doc/shared-libraries.md b/doc/shared-libraries.md index 6db5f8d14b..0447e44623 100644 --- a/doc/shared-libraries.md +++ b/doc/shared-libraries.md @@ -7,7 +7,7 @@ The purpose of this library is to make the verification functionality that is cr ### API -The interface is defined in the C header `dashconsensus.h` located in `src/script/dashconsensus.h`. +The interface is defined in the C header `bitcoinconsensus.h` located in `src/script/bitcoinconsensus.h`. #### Version @@ -39,9 +39,3 @@ The interface is defined in the C header `dashconsensus.h` located in `src/scri - `dashconsensus_ERR_TX_INDEX` - An invalid index for `txTo` - `dashconsensus_ERR_TX_SIZE_MISMATCH` - `txToLen` did not match with the size of `txTo` - `dashconsensus_ERR_DESERIALIZE` - An error deserializing `txTo` - -### Example Implementations -- [NBitcoin](https://github.com/NicolasDorier/NBitcoin/blob/master/NBitcoin/Script.cs#L814) (.NET Bindings) -- [node-libbitcoinconsensus](https://github.com/bitpay/node-libbitcoinconsensus) (Node.js Bindings) -- [java-libbitcoinconsensus](https://github.com/dexX7/java-libbitcoinconsensus) (Java Bindings) -- [bitcoinconsensus-php](https://github.com/Bit-Wasp/bitcoinconsensus-php) (PHP Bindings) diff --git a/libdashconsensus.pc.in b/libdashconsensus.pc.in index 31d38aa865..71a7d50ab1 100644 --- a/libdashconsensus.pc.in +++ b/libdashconsensus.pc.in @@ -4,7 +4,7 @@ libdir=@libdir@ includedir=@includedir@ Name: @PACKAGE_NAME@ consensus library -Description: Library for the Bitcoin consensus protocol. +Description: Library for the Dash consensus protocol. Version: @PACKAGE_VERSION@ Libs: -L${libdir} -ldashconsensus Cflags: -I${includedir} diff --git a/src/Makefile.am b/src/Makefile.am index 657c91c478..75100555bc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -48,7 +48,7 @@ if ENABLE_ZMQ LIBBITCOIN_ZMQ=libbitcoin_zmq.a endif if BUILD_BITCOIN_LIBS -LIBBITCOINCONSENSUS=libbitcoinconsensus.la +LIBBITCOINCONSENSUS=libdashconsensus.la endif if ENABLE_WALLET LIBBITCOIN_WALLET=libbitcoin_wallet.a @@ -622,7 +622,7 @@ libbitcoin_consensus_a_SOURCES = \ primitives/transaction.h \ pubkey.cpp \ pubkey.h \ - script/dashconsensus.cpp \ + script/bitcoinconsensus.cpp \ script/interpreter.cpp \ script/interpreter.h \ script/script.cpp \ @@ -838,17 +838,17 @@ dash_wallet_LDADD += $(BACKTRACE_LIB) $(BOOST_LIBS) $(BDB_LIBS) $(EVENT_PTHREADS # dashconsensus library # if BUILD_BITCOIN_LIBS -include_HEADERS = script/dashconsensus.h -libbitcoinconsensus_la_SOURCES = support/cleanse.cpp $(crypto_libbitcoin_crypto_base_a_SOURCES) $(libbitcoin_consensus_a_SOURCES) +include_HEADERS = script/bitcoinconsensus.h +libdashconsensus_la_SOURCES = support/cleanse.cpp $(crypto_libbitcoin_crypto_base_a_SOURCES) $(libbitcoin_consensus_a_SOURCES) if GLIBC_BACK_COMPAT - libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp + libdashconsensus_la_SOURCES += compat/glibc_compat.cpp endif -libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS) -libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1) $(BLS_LIBS) $(GMP_LIBS) -libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL -libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) +libdashconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS) +libdashconsensus_la_LIBADD = $(LIBSECP256K1) $(BLS_LIBS) $(GMP_LIBS) +libdashconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL +libdashconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) endif # diff --git a/src/compat/endian.h b/src/compat/endian.h index c547d09bde..26955a057d 100644 --- a/src/compat/endian.h +++ b/src/compat/endian.h @@ -22,7 +22,7 @@ #ifndef HAVE_CONFIG_H // While not technically a supported configuration, defaulting to defining these // DECLs when we were compiled without autotools makes it easier for other build -// systems to build things like libbitcoinconsensus for strange targets. +// systems to build things like libdashconsensus for strange targets. #ifdef htobe16 #define HAVE_DECL_HTOBE16 1 #endif diff --git a/src/script/dashconsensus.cpp b/src/script/bitcoinconsensus.cpp similarity index 98% rename from src/script/dashconsensus.cpp rename to src/script/bitcoinconsensus.cpp index b6c1a1f518..98dae13672 100644 --- a/src/script/dashconsensus.cpp +++ b/src/script/bitcoinconsensus.cpp @@ -3,7 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include