Skip to content

Commit b40f8f3

Browse files
OlegGirkoschinzelh
authored andcommitted
Rename bitcoinconsensus library to dashconsensus. (#1432)
All names containing bitcoinconsensus remaned to contain dashconsensus. This is needed to avoid conflicts with real bitcoinconsensus library shipped with Bitcoin Core. Signed-off-by: Oleg Girko <ol@infoserver.lv>
1 parent 98990b6 commit b40f8f3

File tree

10 files changed

+63
-63
lines changed

10 files changed

+63
-63
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ share/BitcoindComparisonTool.jar
123123
.autotools
124124
/doc/doxygen/
125125

126-
libbitcoinconsensus.pc
126+
libdashconsensus.pc
127127
src/qt/dash-qt.bash
128128
qa/pull-tester/tests-config.sh
129129

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ GZIP_ENV="-9n"
66

77
if BUILD_BITCOIN_LIBS
88
pkgconfigdir = $(libdir)/pkgconfig
9-
pkgconfig_DATA = libbitcoinconsensus.pc
9+
pkgconfig_DATA = libdashconsensus.pc
1010
endif
1111

1212
BITCOIND_BIN=$(top_builddir)/src/dashd$(EXEEXT)

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ AC_MSG_CHECKING([whether to build libraries])
789789
AM_CONDITIONAL([BUILD_BITCOIN_LIBS], [test x$build_bitcoin_libs = xyes])
790790
if test x$build_bitcoin_libs = xyes; then
791791
AC_DEFINE(HAVE_CONSENSUS_LIB, 1, [Define this symbol if the consensus lib has been built])
792-
AC_CONFIG_FILES([libbitcoinconsensus.pc:libbitcoinconsensus.pc.in])
792+
AC_CONFIG_FILES([libdashconsensus.pc:libdashconsensus.pc.in])
793793
fi
794794
AC_MSG_RESULT($build_bitcoin_libs)
795795

doc/shared-libraries.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
Shared Libraries
22
================
33

4-
## bitcoinconsensus
4+
## dashconsensus
55

6-
The purpose of this library is to make the verification functionality that is critical to Bitcoin's consensus available to other applications, e.g. to language bindings.
6+
The purpose of this library is to make the verification functionality that is critical to Dash's consensus available to other applications, e.g. to language bindings.
77

88
### API
99

10-
The interface is defined in the C header `bitcoinconsensus.h` located in `src/script/bitcoinconsensus.h`.
10+
The interface is defined in the C header `dashconsensus.h` located in `src/script/dashconsensus.h`.
1111

1212
#### Version
1313

14-
`bitcoinconsensus_version` returns an `unsigned int` with the the API version *(currently at an experimental `0`)*.
14+
`dashconsensus_version` returns an `unsigned int` with the the API version *(currently at an experimental `0`)*.
1515

1616
#### Script Validation
1717

18-
`bitcoinconsensus_verify_script` returns an `int` with the status of the verification. It will be `1` if the input script correctly spends the previous output `scriptPubKey`.
18+
`dashconsensus_verify_script` returns an `int` with the status of the verification. It will be `1` if the input script correctly spends the previous output `scriptPubKey`.
1919

2020
##### Parameters
2121
- `const unsigned char *scriptPubKey` - The previous output script that encumbers spending.
@@ -24,18 +24,18 @@ The interface is defined in the C header `bitcoinconsensus.h` located in `src/s
2424
- `unsigned int txToLen` - The number of bytes for the `txTo`.
2525
- `unsigned int nIn` - The index of the input in `txTo` that spends the `scriptPubKey`.
2626
- `unsigned int flags` - The script validation flags *(see below)*.
27-
- `bitcoinconsensus_error* err` - Will have the error/success code for the operation *(see below)*.
27+
- `dashconsensus_error* err` - Will have the error/success code for the operation *(see below)*.
2828

2929
##### Script Flags
30-
- `bitcoinconsensus_SCRIPT_FLAGS_VERIFY_NONE`
31-
- `bitcoinconsensus_SCRIPT_FLAGS_VERIFY_P2SH` - Evaluate P2SH ([BIP16](https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki)) subscripts
32-
- `bitcoinconsensus_SCRIPT_FLAGS_VERIFY_DERSIG` - Enforce strict DER ([BIP66](https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki)) compliance
30+
- `dashconsensus_SCRIPT_FLAGS_VERIFY_NONE`
31+
- `dashconsensus_SCRIPT_FLAGS_VERIFY_P2SH` - Evaluate P2SH ([BIP16](https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki)) subscripts
32+
- `dashconsensus_SCRIPT_FLAGS_VERIFY_DERSIG` - Enforce strict DER ([BIP66](https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki)) compliance
3333

3434
##### Errors
35-
- `bitcoinconsensus_ERR_OK` - No errors with input parameters *(see the return value of `bitcoinconsensus_verify_script` for the verification status)*
36-
- `bitcoinconsensus_ERR_TX_INDEX` - An invalid index for `txTo`
37-
- `bitcoinconsensus_ERR_TX_SIZE_MISMATCH` - `txToLen` did not match with the size of `txTo`
38-
- `bitcoinconsensus_ERR_DESERIALIZE` - An error deserializing `txTo`
35+
- `dashconsensus_ERR_OK` - No errors with input parameters *(see the return value of `dashconsensus_verify_script` for the verification status)*
36+
- `dashconsensus_ERR_TX_INDEX` - An invalid index for `txTo`
37+
- `dashconsensus_ERR_TX_SIZE_MISMATCH` - `txToLen` did not match with the size of `txTo`
38+
- `dashconsensus_ERR_DESERIALIZE` - An error deserializing `txTo`
3939

4040
### Example Implementations
4141
- [NBitcoin](https://github.com/NicolasDorier/NBitcoin/blob/master/NBitcoin/Script.cs#L814) (.NET Bindings)

libbitcoinconsensus.pc.in renamed to libdashconsensus.pc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ includedir=@includedir@
66
Name: Bitcoin Core consensus library
77
Description: Library for the Bitcoin consensus protocol.
88
Version: @PACKAGE_VERSION@
9-
Libs: -L${libdir} -lbitcoinconsensus
9+
Libs: -L${libdir} -ldashconsensus
1010
Cflags: -I${includedir}
1111
Requires.private: libcrypto

src/Makefile.am

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ EXTRA_LIBRARIES += libbitcoin_zmq.a
4444
endif
4545

4646
if BUILD_BITCOIN_LIBS
47-
lib_LTLIBRARIES = libbitcoinconsensus.la
48-
LIBBITCOIN_CONSENSUS=libbitcoinconsensus.la
47+
lib_LTLIBRARIES = libdashconsensus.la
48+
LIBBITCOIN_CONSENSUS=libdashconsensus.la
4949
else
5050
LIBBITCOIN_CONSENSUS=
5151
endif
@@ -454,10 +454,10 @@ dash_tx_LDADD = \
454454
dash_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
455455
#
456456

457-
# bitcoinconsensus library #
457+
# dashconsensus library #
458458
if BUILD_BITCOIN_LIBS
459-
include_HEADERS = script/bitcoinconsensus.h
460-
libbitcoinconsensus_la_SOURCES = \
459+
include_HEADERS = script/dashconsensus.h
460+
libdashconsensus_la_SOURCES = \
461461
crypto/hmac_sha512.cpp \
462462
crypto/ripemd160.cpp \
463463
crypto/sha1.cpp \
@@ -466,20 +466,20 @@ libbitcoinconsensus_la_SOURCES = \
466466
hash.cpp \
467467
primitives/transaction.cpp \
468468
pubkey.cpp \
469-
script/bitcoinconsensus.cpp \
469+
script/dashconsensus.cpp \
470470
script/interpreter.cpp \
471471
script/script.cpp \
472472
uint256.cpp \
473473
utilstrencodings.cpp
474474

475475
if GLIBC_BACK_COMPAT
476-
libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
476+
libdashconsensus_la_SOURCES += compat/glibc_compat.cpp
477477
endif
478478

479-
libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
480-
libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1)
481-
libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
482-
libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
479+
libdashconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
480+
libdashconsensus_la_LIBADD = $(LIBSECP256K1)
481+
libdashconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
482+
libdashconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
483483

484484
endif
485485
#

src/Makefile.new.am

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ EXTRA_LIBRARIES += libbitcoin_zmq.a
5858
endif
5959

6060
if BUILD_BITCOIN_LIBS
61-
lib_LTLIBRARIES = libbitcoinconsensus.la
62-
LIBBITCOIN_CONSENSUS=libbitcoinconsensus.la
61+
lib_LTLIBRARIES = libdashconsensus.la
62+
LIBBITCOIN_CONSENSUS=libdashconsensus.la
6363
else
6464
LIBBITCOIN_CONSENSUS=
6565
endif
@@ -456,10 +456,10 @@ dash_tx_LDADD = \
456456
dash_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
457457
#
458458

459-
# bitcoinconsensus library #
459+
# dashconsensus library #
460460
if BUILD_BITCOIN_LIBS
461-
include_HEADERS = script/bitcoinconsensus.h
462-
libbitcoinconsensus_la_SOURCES = \
461+
include_HEADERS = script/dashconsensus.h
462+
libdashconsensus_la_SOURCES = \
463463
crypto/hmac_sha512.cpp \
464464
crypto/ripemd160.cpp \
465465
crypto/sha1.cpp \
@@ -468,20 +468,20 @@ libbitcoinconsensus_la_SOURCES = \
468468
hash.cpp \
469469
primitives/transaction.cpp \
470470
pubkey.cpp \
471-
script/bitcoinconsensus.cpp \
471+
script/dashconsensus.cpp \
472472
script/interpreter.cpp \
473473
script/script.cpp \
474474
uint256.cpp \
475475
utilstrencodings.cpp
476476

477477
if GLIBC_BACK_COMPAT
478-
libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
478+
libdashconsensus_la_SOURCES += compat/glibc_compat.cpp
479479
endif
480480

481-
libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
482-
libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1)
483-
libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
484-
libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
481+
libdashconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
482+
libdashconsensus_la_LIBADD = $(LIBSECP256K1)
483+
libdashconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
484+
libdashconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
485485

486486
endif
487487
#

src/script/bitcoinconsensus.cpp renamed to src/script/dashconsensus.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

6-
#include "bitcoinconsensus.h"
6+
#include "dashconsensus.h"
77

88
#include "primitives/transaction.h"
99
#include "pubkey.h"
@@ -54,7 +54,7 @@ class TxInputStream
5454
size_t m_remaining;
5555
};
5656

57-
inline int set_error(bitcoinconsensus_error* ret, bitcoinconsensus_error serror)
57+
inline int set_error(dashconsensus_error* ret, dashconsensus_error serror)
5858
{
5959
if (ret)
6060
*ret = serror;
@@ -69,29 +69,29 @@ struct ECCryptoClosure
6969
ECCryptoClosure instance_of_eccryptoclosure;
7070
}
7171

72-
int bitcoinconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen,
72+
int dashconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen,
7373
const unsigned char *txTo , unsigned int txToLen,
74-
unsigned int nIn, unsigned int flags, bitcoinconsensus_error* err)
74+
unsigned int nIn, unsigned int flags, dashconsensus_error* err)
7575
{
7676
try {
7777
TxInputStream stream(SER_NETWORK, PROTOCOL_VERSION, txTo, txToLen);
7878
CTransaction tx;
7979
stream >> tx;
8080
if (nIn >= tx.vin.size())
81-
return set_error(err, bitcoinconsensus_ERR_TX_INDEX);
81+
return set_error(err, dashconsensus_ERR_TX_INDEX);
8282
if (tx.GetSerializeSize(SER_NETWORK, PROTOCOL_VERSION) != txToLen)
83-
return set_error(err, bitcoinconsensus_ERR_TX_SIZE_MISMATCH);
83+
return set_error(err, dashconsensus_ERR_TX_SIZE_MISMATCH);
8484

8585
// Regardless of the verification result, the tx did not error.
86-
set_error(err, bitcoinconsensus_ERR_OK);
86+
set_error(err, dashconsensus_ERR_OK);
8787

8888
return VerifyScript(tx.vin[nIn].scriptSig, CScript(scriptPubKey, scriptPubKey + scriptPubKeyLen), flags, TransactionSignatureChecker(&tx, nIn), NULL);
8989
} catch (const std::exception&) {
90-
return set_error(err, bitcoinconsensus_ERR_TX_DESERIALIZE); // Error deserializing
90+
return set_error(err, dashconsensus_ERR_TX_DESERIALIZE); // Error deserializing
9191
}
9292
}
9393

94-
unsigned int bitcoinconsensus_version()
94+
unsigned int dashconsensus_version()
9595
{
9696
// Just use the API version for now
9797
return BITCOINCONSENSUS_API_VER;

src/script/bitcoinconsensus.h renamed to src/script/dashconsensus.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,32 @@ extern "C" {
3333

3434
#define BITCOINCONSENSUS_API_VER 0
3535

36-
typedef enum bitcoinconsensus_error_t
36+
typedef enum dashconsensus_error_t
3737
{
38-
bitcoinconsensus_ERR_OK = 0,
39-
bitcoinconsensus_ERR_TX_INDEX,
40-
bitcoinconsensus_ERR_TX_SIZE_MISMATCH,
41-
bitcoinconsensus_ERR_TX_DESERIALIZE,
42-
} bitcoinconsensus_error;
38+
dashconsensus_ERR_OK = 0,
39+
dashconsensus_ERR_TX_INDEX,
40+
dashconsensus_ERR_TX_SIZE_MISMATCH,
41+
dashconsensus_ERR_TX_DESERIALIZE,
42+
} dashconsensus_error;
4343

4444
/** Script verification flags */
4545
enum
4646
{
47-
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_NONE = 0,
48-
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_P2SH = (1U << 0), // evaluate P2SH (BIP16) subscripts
49-
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_DERSIG = (1U << 2), // enforce strict DER (BIP66) compliance
50-
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY = (1U << 9), // enable CHECKLOCKTIMEVERIFY (BIP65)
47+
dashconsensus_SCRIPT_FLAGS_VERIFY_NONE = 0,
48+
dashconsensus_SCRIPT_FLAGS_VERIFY_P2SH = (1U << 0), // evaluate P2SH (BIP16) subscripts
49+
dashconsensus_SCRIPT_FLAGS_VERIFY_DERSIG = (1U << 2), // enforce strict DER (BIP66) compliance
50+
dashconsensus_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY = (1U << 9), // enable CHECKLOCKTIMEVERIFY (BIP65)
5151
};
5252

5353
/// Returns 1 if the input nIn of the serialized transaction pointed to by
5454
/// txTo correctly spends the scriptPubKey pointed to by scriptPubKey under
5555
/// the additional constraints specified by flags.
5656
/// If not NULL, err will contain an error/success code for the operation
57-
EXPORT_SYMBOL int bitcoinconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen,
57+
EXPORT_SYMBOL int dashconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen,
5858
const unsigned char *txTo , unsigned int txToLen,
59-
unsigned int nIn, unsigned int flags, bitcoinconsensus_error* err);
59+
unsigned int nIn, unsigned int flags, dashconsensus_error* err);
6060

61-
EXPORT_SYMBOL unsigned int bitcoinconsensus_version();
61+
EXPORT_SYMBOL unsigned int dashconsensus_version();
6262

6363
#ifdef __cplusplus
6464
} // extern "C"

src/test/script_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "test/test_dash.h"
1616

1717
#if defined(HAVE_CONSENSUS_LIB)
18-
#include "script/bitcoinconsensus.h"
18+
#include "script/dashconsensus.h"
1919
#endif
2020

2121
#include <fstream>
@@ -155,7 +155,7 @@ void DoTest(const CScript& scriptPubKey, const CScript& scriptSig, int flags, co
155155
#if defined(HAVE_CONSENSUS_LIB)
156156
CDataStream stream(SER_NETWORK, PROTOCOL_VERSION);
157157
stream << tx2;
158-
BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script(begin_ptr(scriptPubKey), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size(), 0, flags, NULL) == expect,message);
158+
BOOST_CHECK_MESSAGE(dashconsensus_verify_script(begin_ptr(scriptPubKey), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size(), 0, flags, NULL) == expect,message);
159159
#endif
160160
}
161161

0 commit comments

Comments
 (0)