Auto merge of #1567 - str4d:rename-binaries, r=daira
Rename binaries This ensures that our installs don't clash with existing Bitcoin binaries and libraries. Closes #1563 and #1565
This commit is contained in:
commit
10ad093bbb
|
@ -5,7 +5,7 @@ src/bitcoin
|
||||||
src/zcashd
|
src/zcashd
|
||||||
src/zcash-cli
|
src/zcash-cli
|
||||||
src/zcash-gtest
|
src/zcash-gtest
|
||||||
src/bitcoin-tx
|
src/zcash-tx
|
||||||
src/test/test_bitcoin
|
src/test/test_bitcoin
|
||||||
src/qt/test/test_bitcoin-qt
|
src/qt/test/test_bitcoin-qt
|
||||||
|
|
||||||
|
@ -120,4 +120,4 @@ qa/pull-tester/test.*/*
|
||||||
|
|
||||||
/doc/doxygen/
|
/doc/doxygen/
|
||||||
|
|
||||||
libbitcoinconsensus.pc
|
libzcashconsensus.pc
|
||||||
|
|
|
@ -6,7 +6,7 @@ GZIP_ENV="-9n"
|
||||||
|
|
||||||
if BUILD_BITCOIN_LIBS
|
if BUILD_BITCOIN_LIBS
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
pkgconfig_DATA = libbitcoinconsensus.pc
|
pkgconfig_DATA = libzcashconsensus.pc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BITCOIND_BIN=$(top_builddir)/src/zcashd$(EXEEXT)
|
BITCOIND_BIN=$(top_builddir)/src/zcashd$(EXEEXT)
|
||||||
|
|
|
@ -179,7 +179,7 @@ CPPFLAGS="$CPPFLAGS -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_
|
||||||
|
|
||||||
AC_ARG_WITH([utils],
|
AC_ARG_WITH([utils],
|
||||||
[AS_HELP_STRING([--with-utils],
|
[AS_HELP_STRING([--with-utils],
|
||||||
[build bitcoin-cli bitcoin-tx (default=yes)])],
|
[build zcash-cli zcash-tx (default=yes)])],
|
||||||
[build_bitcoin_utils=$withval],
|
[build_bitcoin_utils=$withval],
|
||||||
[build_bitcoin_utils=yes])
|
[build_bitcoin_utils=yes])
|
||||||
|
|
||||||
|
@ -746,7 +746,7 @@ AC_MSG_CHECKING([whether to build bitcoind])
|
||||||
AM_CONDITIONAL([BUILD_BITCOIND], [test x$build_bitcoind = xyes])
|
AM_CONDITIONAL([BUILD_BITCOIND], [test x$build_bitcoind = xyes])
|
||||||
AC_MSG_RESULT($build_bitcoind)
|
AC_MSG_RESULT($build_bitcoind)
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to build utils (bitcoin-cli bitcoin-tx)])
|
AC_MSG_CHECKING([whether to build utils (zcash-cli zcash-tx)])
|
||||||
AM_CONDITIONAL([BUILD_BITCOIN_UTILS], [test x$build_bitcoin_utils = xyes])
|
AM_CONDITIONAL([BUILD_BITCOIN_UTILS], [test x$build_bitcoin_utils = xyes])
|
||||||
AC_MSG_RESULT($build_bitcoin_utils)
|
AC_MSG_RESULT($build_bitcoin_utils)
|
||||||
|
|
||||||
|
@ -754,7 +754,7 @@ AC_MSG_CHECKING([whether to build libraries])
|
||||||
AM_CONDITIONAL([BUILD_BITCOIN_LIBS], [test x$build_bitcoin_libs = xyes])
|
AM_CONDITIONAL([BUILD_BITCOIN_LIBS], [test x$build_bitcoin_libs = xyes])
|
||||||
if test x$build_bitcoin_libs = xyes; then
|
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_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([libzcashconsensus.pc:libzcashconsensus.pc.in])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_RESULT($build_bitcoin_libs)
|
AC_MSG_RESULT($build_bitcoin_libs)
|
||||||
|
|
|
@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@
|
||||||
libdir=@libdir@
|
libdir=@libdir@
|
||||||
includedir=@includedir@
|
includedir=@includedir@
|
||||||
|
|
||||||
Name: Bitcoin Core consensus library
|
Name: Zcash consensus library
|
||||||
Description: Library for the Bitcoin consensus protocol.
|
Description: Library for the Zcash consensus protocol.
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Libs: -L${libdir} -lbitcoinconsensus
|
Libs: -L${libdir} -lzcashconsensus
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
Requires.private: libcrypto
|
Requires.private: libcrypto
|
|
@ -32,7 +32,7 @@ make -C "$REPOROOT/src" check-security
|
||||||
test_rpath_runpath "${REPOROOT}/src/zcashd"
|
test_rpath_runpath "${REPOROOT}/src/zcashd"
|
||||||
test_rpath_runpath "${REPOROOT}/src/zcash-cli"
|
test_rpath_runpath "${REPOROOT}/src/zcash-cli"
|
||||||
test_rpath_runpath "${REPOROOT}/src/zcash-gtest"
|
test_rpath_runpath "${REPOROOT}/src/zcash-gtest"
|
||||||
test_rpath_runpath "${REPOROOT}/src/bitcoin-tx"
|
test_rpath_runpath "${REPOROOT}/src/zcash-tx"
|
||||||
test_rpath_runpath "${REPOROOT}/src/test/test_bitcoin"
|
test_rpath_runpath "${REPOROOT}/src/test/test_bitcoin"
|
||||||
test_rpath_runpath "${REPOROOT}/src/zcash/GenerateParams"
|
test_rpath_runpath "${REPOROOT}/src/zcash/GenerateParams"
|
||||||
|
|
||||||
|
@ -41,6 +41,6 @@ test_rpath_runpath "${REPOROOT}/src/zcash/GenerateParams"
|
||||||
test_fortify_source "${REPOROOT}/src/zcashd"
|
test_fortify_source "${REPOROOT}/src/zcashd"
|
||||||
test_fortify_source "${REPOROOT}/src/zcash-cli"
|
test_fortify_source "${REPOROOT}/src/zcash-cli"
|
||||||
test_fortify_source "${REPOROOT}/src/zcash-gtest"
|
test_fortify_source "${REPOROOT}/src/zcash-gtest"
|
||||||
test_fortify_source "${REPOROOT}/src/bitcoin-tx"
|
test_fortify_source "${REPOROOT}/src/zcash-tx"
|
||||||
test_fortify_source "${REPOROOT}/src/test/test_bitcoin"
|
test_fortify_source "${REPOROOT}/src/test/test_bitcoin"
|
||||||
test_fortify_source "${REPOROOT}/src/zcash/GenerateParams"
|
test_fortify_source "${REPOROOT}/src/zcash/GenerateParams"
|
||||||
|
|
|
@ -52,10 +52,10 @@ EXTRA_LIBRARIES += libbitcoin_wallet.a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BUILD_BITCOIN_LIBS
|
if BUILD_BITCOIN_LIBS
|
||||||
lib_LTLIBRARIES = libbitcoinconsensus.la
|
lib_LTLIBRARIES = libzcashconsensus.la
|
||||||
LIBBITCOIN_CONSENSUS=libbitcoinconsensus.la
|
LIBZCASH_CONSENSUS=libzcashconsensus.la
|
||||||
else
|
else
|
||||||
LIBBITCOIN_CONSENSUS=
|
LIBZCASH_CONSENSUS=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
bin_PROGRAMS =
|
bin_PROGRAMS =
|
||||||
|
@ -66,7 +66,7 @@ if BUILD_BITCOIND
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BUILD_BITCOIN_UTILS
|
if BUILD_BITCOIN_UTILS
|
||||||
bin_PROGRAMS += zcash-cli bitcoin-tx
|
bin_PROGRAMS += zcash-cli zcash-tx
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LIBZCASH_H = \
|
LIBZCASH_H = \
|
||||||
|
@ -399,17 +399,17 @@ zcash_cli_LDADD = \
|
||||||
$(LIBZCASH_LIBS)
|
$(LIBZCASH_LIBS)
|
||||||
#
|
#
|
||||||
|
|
||||||
# bitcoin-tx binary #
|
# zcash-tx binary #
|
||||||
bitcoin_tx_SOURCES = bitcoin-tx.cpp
|
zcash_tx_SOURCES = bitcoin-tx.cpp
|
||||||
bitcoin_tx_CPPFLAGS = $(BITCOIN_INCLUDES)
|
zcash_tx_CPPFLAGS = $(BITCOIN_INCLUDES)
|
||||||
bitcoin_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
zcash_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||||
|
|
||||||
if TARGET_WINDOWS
|
if TARGET_WINDOWS
|
||||||
bitcoin_tx_SOURCES += bitcoin-tx-res.rc
|
zcash_tx_SOURCES += bitcoin-tx-res.rc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# FIXME: Is libzcash needed for bitcoin_tx?
|
# FIXME: Is libzcash needed for zcash_tx?
|
||||||
bitcoin_tx_LDADD = \
|
zcash_tx_LDADD = \
|
||||||
$(LIBBITCOIN_UNIVALUE) \
|
$(LIBBITCOIN_UNIVALUE) \
|
||||||
$(LIBBITCOIN_COMMON) \
|
$(LIBBITCOIN_COMMON) \
|
||||||
$(LIBBITCOIN_UTIL) \
|
$(LIBBITCOIN_UTIL) \
|
||||||
|
@ -418,7 +418,7 @@ bitcoin_tx_LDADD = \
|
||||||
$(LIBBITCOIN_CRYPTO) \
|
$(LIBBITCOIN_CRYPTO) \
|
||||||
$(LIBZCASH_LIBS)
|
$(LIBZCASH_LIBS)
|
||||||
|
|
||||||
bitcoin_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
|
zcash_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
|
||||||
#
|
#
|
||||||
|
|
||||||
# zcash protocol primitives #
|
# zcash protocol primitives #
|
||||||
|
@ -446,10 +446,10 @@ libzcash_a_LDFLAGS = $(HARDENED_LDFLAGS)
|
||||||
|
|
||||||
libzcash_a_CPPFLAGS += -DMONTGOMERY_OUTPUT
|
libzcash_a_CPPFLAGS += -DMONTGOMERY_OUTPUT
|
||||||
|
|
||||||
# bitcoinconsensus library #
|
# zcashconsensus library #
|
||||||
if BUILD_BITCOIN_LIBS
|
if BUILD_BITCOIN_LIBS
|
||||||
include_HEADERS = script/bitcoinconsensus.h
|
include_HEADERS = script/zcashconsensus.h
|
||||||
libbitcoinconsensus_la_SOURCES = \
|
libzcashconsensus_la_SOURCES = \
|
||||||
crypto/equihash.cpp \
|
crypto/equihash.cpp \
|
||||||
crypto/hmac_sha512.cpp \
|
crypto/hmac_sha512.cpp \
|
||||||
crypto/ripemd160.cpp \
|
crypto/ripemd160.cpp \
|
||||||
|
@ -461,19 +461,19 @@ libbitcoinconsensus_la_SOURCES = \
|
||||||
hash.cpp \
|
hash.cpp \
|
||||||
primitives/transaction.cpp \
|
primitives/transaction.cpp \
|
||||||
pubkey.cpp \
|
pubkey.cpp \
|
||||||
script/bitcoinconsensus.cpp \
|
script/zcashconsensus.cpp \
|
||||||
script/interpreter.cpp \
|
script/interpreter.cpp \
|
||||||
script/script.cpp \
|
script/script.cpp \
|
||||||
uint256.cpp \
|
uint256.cpp \
|
||||||
utilstrencodings.cpp
|
utilstrencodings.cpp
|
||||||
|
|
||||||
if GLIBC_BACK_COMPAT
|
if GLIBC_BACK_COMPAT
|
||||||
libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
|
libzcashconsensus_la_SOURCES += compat/glibc_compat.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
libbitcoinconsensus_la_LDFLAGS = -no-undefined $(RELDFLAGS)
|
libzcashconsensus_la_LDFLAGS = -no-undefined $(RELDFLAGS)
|
||||||
libbitcoinconsensus_la_LIBADD = $(CRYPTO_LIBS)
|
libzcashconsensus_la_LIBADD = $(CRYPTO_LIBS)
|
||||||
libbitcoinconsensus_la_CPPFLAGS = $(CRYPTO_CFLAGS) -I$(builddir)/obj -DBUILD_BITCOIN_INTERNAL
|
libzcashconsensus_la_CPPFLAGS = $(CRYPTO_CFLAGS) -I$(builddir)/obj -DBUILD_BITCOIN_INTERNAL
|
||||||
|
|
||||||
endif
|
endif
|
||||||
#
|
#
|
||||||
|
|
|
@ -35,7 +35,7 @@ if ENABLE_WALLET
|
||||||
zcash_gtest_LDADD += $(LIBBITCOIN_WALLET)
|
zcash_gtest_LDADD += $(LIBBITCOIN_WALLET)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
zcash_gtest_LDADD += $(LIBBITCOIN_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBZCASH) $(LIBZCASH_LIBS)
|
zcash_gtest_LDADD += $(LIBZCASH_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBZCASH) $(LIBZCASH_LIBS)
|
||||||
|
|
||||||
zcash_gtest_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static
|
zcash_gtest_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ if ENABLE_WALLET
|
||||||
test_test_bitcoin_LDADD += $(LIBBITCOIN_WALLET)
|
test_test_bitcoin_LDADD += $(LIBBITCOIN_WALLET)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
test_test_bitcoin_LDADD += $(LIBBITCOIN_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBZCASH) $(LIBZCASH_LIBS)
|
test_test_bitcoin_LDADD += $(LIBZCASH_CONSENSUS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBZCASH) $(LIBZCASH_LIBS)
|
||||||
test_test_bitcoin_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static
|
test_test_bitcoin_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -static
|
||||||
|
|
||||||
nodist_test_test_bitcoin_SOURCES = $(GENERATED_TEST_FILES)
|
nodist_test_test_bitcoin_SOURCES = $(GENERATED_TEST_FILES)
|
||||||
|
|
|
@ -16,14 +16,14 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
BLOCK "040904E4" // U.S. English - multilingual (hex)
|
BLOCK "040904E4" // U.S. English - multilingual (hex)
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Bitcoin"
|
VALUE "CompanyName", "Zcash"
|
||||||
VALUE "FileDescription", "bitcoin-tx (CLI Bitcoin transaction editor utility)"
|
VALUE "FileDescription", "zcash-tx (CLI Zcash transaction editor utility)"
|
||||||
VALUE "FileVersion", VER_FILEVERSION_STR
|
VALUE "FileVersion", VER_FILEVERSION_STR
|
||||||
VALUE "InternalName", "bitcoin-tx"
|
VALUE "InternalName", "zcash-tx"
|
||||||
VALUE "LegalCopyright", COPYRIGHT_STR
|
VALUE "LegalCopyright", COPYRIGHT_STR
|
||||||
VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php."
|
VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php."
|
||||||
VALUE "OriginalFilename", "bitcoin-tx.exe"
|
VALUE "OriginalFilename", "zcash-tx.exe"
|
||||||
VALUE "ProductName", "bitcoin-tx"
|
VALUE "ProductName", "zcash-tx"
|
||||||
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
|
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
|
@ -44,10 +44,10 @@ static bool AppInitRawTx(int argc, char* argv[])
|
||||||
if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help"))
|
if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help"))
|
||||||
{
|
{
|
||||||
// First part of help message is specific to this utility
|
// First part of help message is specific to this utility
|
||||||
std::string strUsage = _("Bitcoin Core bitcoin-tx utility version") + " " + FormatFullVersion() + "\n\n" +
|
std::string strUsage = _("Zcash zcash-tx utility version") + " " + FormatFullVersion() + "\n\n" +
|
||||||
_("Usage:") + "\n" +
|
_("Usage:") + "\n" +
|
||||||
" bitcoin-tx [options] <hex-tx> [commands] " + _("Update hex-encoded bitcoin transaction") + "\n" +
|
" zcash-tx [options] <hex-tx> [commands] " + _("Update hex-encoded zcash transaction") + "\n" +
|
||||||
" bitcoin-tx [options] -create [commands] " + _("Create hex-encoded bitcoin transaction") + "\n" +
|
" zcash-tx [options] -create [commands] " + _("Create hex-encoded zcash transaction") + "\n" +
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
fprintf(stdout, "%s", strUsage.c_str());
|
fprintf(stdout, "%s", strUsage.c_str());
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include "bitcoinconsensus.h"
|
#include "zcashconsensus.h"
|
||||||
|
|
||||||
#include "primitives/transaction.h"
|
#include "primitives/transaction.h"
|
||||||
#include "script/interpreter.h"
|
#include "script/interpreter.h"
|
||||||
|
@ -53,7 +53,7 @@ private:
|
||||||
size_t m_remaining;
|
size_t m_remaining;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline int set_error(bitcoinconsensus_error* ret, bitcoinconsensus_error serror)
|
inline int set_error(zcashconsensus_error* ret, zcashconsensus_error serror)
|
||||||
{
|
{
|
||||||
if (ret)
|
if (ret)
|
||||||
*ret = serror;
|
*ret = serror;
|
||||||
|
@ -62,30 +62,30 @@ inline int set_error(bitcoinconsensus_error* ret, bitcoinconsensus_error serror)
|
||||||
|
|
||||||
} // anon namespace
|
} // anon namespace
|
||||||
|
|
||||||
int bitcoinconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen,
|
int zcashconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen,
|
||||||
const unsigned char *txTo , unsigned int txToLen,
|
const unsigned char *txTo , unsigned int txToLen,
|
||||||
unsigned int nIn, unsigned int flags, bitcoinconsensus_error* err)
|
unsigned int nIn, unsigned int flags, zcashconsensus_error* err)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
TxInputStream stream(SER_NETWORK, PROTOCOL_VERSION, txTo, txToLen);
|
TxInputStream stream(SER_NETWORK, PROTOCOL_VERSION, txTo, txToLen);
|
||||||
CTransaction tx;
|
CTransaction tx;
|
||||||
stream >> tx;
|
stream >> tx;
|
||||||
if (nIn >= tx.vin.size())
|
if (nIn >= tx.vin.size())
|
||||||
return set_error(err, bitcoinconsensus_ERR_TX_INDEX);
|
return set_error(err, zcashconsensus_ERR_TX_INDEX);
|
||||||
if (tx.GetSerializeSize(SER_NETWORK, PROTOCOL_VERSION) != txToLen)
|
if (tx.GetSerializeSize(SER_NETWORK, PROTOCOL_VERSION) != txToLen)
|
||||||
return set_error(err, bitcoinconsensus_ERR_TX_SIZE_MISMATCH);
|
return set_error(err, zcashconsensus_ERR_TX_SIZE_MISMATCH);
|
||||||
|
|
||||||
// Regardless of the verification result, the tx did not error.
|
// Regardless of the verification result, the tx did not error.
|
||||||
set_error(err, bitcoinconsensus_ERR_OK);
|
set_error(err, zcashconsensus_ERR_OK);
|
||||||
|
|
||||||
return VerifyScript(tx.vin[nIn].scriptSig, CScript(scriptPubKey, scriptPubKey + scriptPubKeyLen), flags, TransactionSignatureChecker(&tx, nIn), NULL);
|
return VerifyScript(tx.vin[nIn].scriptSig, CScript(scriptPubKey, scriptPubKey + scriptPubKeyLen), flags, TransactionSignatureChecker(&tx, nIn), NULL);
|
||||||
} catch (const std::exception&) {
|
} catch (const std::exception&) {
|
||||||
return set_error(err, bitcoinconsensus_ERR_TX_DESERIALIZE); // Error deserializing
|
return set_error(err, zcashconsensus_ERR_TX_DESERIALIZE); // Error deserializing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int bitcoinconsensus_version()
|
unsigned int zcashconsensus_version()
|
||||||
{
|
{
|
||||||
// Just use the API version for now
|
// Just use the API version for now
|
||||||
return BITCOINCONSENSUS_API_VER;
|
return ZCASHCONSENSUS_API_VER;
|
||||||
}
|
}
|
|
@ -3,8 +3,8 @@
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#ifndef BITCOIN_BITCOINCONSENSUS_H
|
#ifndef BITCOIN_ZCASHCONSENSUS_H
|
||||||
#define BITCOIN_BITCOINCONSENSUS_H
|
#define BITCOIN_ZCASHCONSENSUS_H
|
||||||
|
|
||||||
#if defined(BUILD_BITCOIN_INTERNAL) && defined(HAVE_CONFIG_H)
|
#if defined(BUILD_BITCOIN_INTERNAL) && defined(HAVE_CONFIG_H)
|
||||||
#include "config/bitcoin-config.h"
|
#include "config/bitcoin-config.h"
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
#elif defined(HAVE_FUNC_ATTRIBUTE_VISIBILITY)
|
#elif defined(HAVE_FUNC_ATTRIBUTE_VISIBILITY)
|
||||||
#define EXPORT_SYMBOL __attribute__ ((visibility ("default")))
|
#define EXPORT_SYMBOL __attribute__ ((visibility ("default")))
|
||||||
#endif
|
#endif
|
||||||
#elif defined(MSC_VER) && !defined(STATIC_LIBBITCOINCONSENSUS)
|
#elif defined(MSC_VER) && !defined(STATIC_LIBZCASHCONSENSUS)
|
||||||
#define EXPORT_SYMBOL __declspec(dllimport)
|
#define EXPORT_SYMBOL __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -31,34 +31,34 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BITCOINCONSENSUS_API_VER 0
|
#define ZCASHCONSENSUS_API_VER 0
|
||||||
|
|
||||||
typedef enum bitcoinconsensus_error_t
|
typedef enum zcashconsensus_error_t
|
||||||
{
|
{
|
||||||
bitcoinconsensus_ERR_OK = 0,
|
zcashconsensus_ERR_OK = 0,
|
||||||
bitcoinconsensus_ERR_TX_INDEX,
|
zcashconsensus_ERR_TX_INDEX,
|
||||||
bitcoinconsensus_ERR_TX_SIZE_MISMATCH,
|
zcashconsensus_ERR_TX_SIZE_MISMATCH,
|
||||||
bitcoinconsensus_ERR_TX_DESERIALIZE,
|
zcashconsensus_ERR_TX_DESERIALIZE,
|
||||||
} bitcoinconsensus_error;
|
} zcashconsensus_error;
|
||||||
|
|
||||||
/** Script verification flags */
|
/** Script verification flags */
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_NONE = 0,
|
zcashconsensus_SCRIPT_FLAGS_VERIFY_NONE = 0,
|
||||||
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_P2SH = (1U << 0), // evaluate P2SH (BIP16) subscripts
|
zcashconsensus_SCRIPT_FLAGS_VERIFY_P2SH = (1U << 0), // evaluate P2SH (BIP16) subscripts
|
||||||
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_DERSIG = (1U << 2), // enforce strict DER (BIP66) compliance
|
zcashconsensus_SCRIPT_FLAGS_VERIFY_DERSIG = (1U << 2), // enforce strict DER (BIP66) compliance
|
||||||
bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY = (1U << 9), // enable CHECKLOCKTIMEVERIFY (BIP65)
|
zcashconsensus_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY = (1U << 9), // enable CHECKLOCKTIMEVERIFY (BIP65)
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Returns 1 if the input nIn of the serialized transaction pointed to by
|
/// Returns 1 if the input nIn of the serialized transaction pointed to by
|
||||||
/// txTo correctly spends the scriptPubKey pointed to by scriptPubKey under
|
/// txTo correctly spends the scriptPubKey pointed to by scriptPubKey under
|
||||||
/// the additional constraints specified by flags.
|
/// the additional constraints specified by flags.
|
||||||
/// If not NULL, err will contain an error/success code for the operation
|
/// If not NULL, err will contain an error/success code for the operation
|
||||||
EXPORT_SYMBOL int bitcoinconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen,
|
EXPORT_SYMBOL int zcashconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen,
|
||||||
const unsigned char *txTo , unsigned int txToLen,
|
const unsigned char *txTo , unsigned int txToLen,
|
||||||
unsigned int nIn, unsigned int flags, bitcoinconsensus_error* err);
|
unsigned int nIn, unsigned int flags, zcashconsensus_error* err);
|
||||||
|
|
||||||
EXPORT_SYMBOL unsigned int bitcoinconsensus_version();
|
EXPORT_SYMBOL unsigned int zcashconsensus_version();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
@ -66,4 +66,4 @@ EXPORT_SYMBOL unsigned int bitcoinconsensus_version();
|
||||||
|
|
||||||
#undef EXPORT_SYMBOL
|
#undef EXPORT_SYMBOL
|
||||||
|
|
||||||
#endif // BITCOIN_BITCOINCONSENSUS_H
|
#endif // BITCOIN_ZCASHCONSENSUS_H
|
|
@ -1,39 +1,39 @@
|
||||||
[
|
[
|
||||||
{ "exec": "././bitcoin-tx",
|
{ "exec": "././zcash-tx",
|
||||||
"args": ["-create"],
|
"args": ["-create"],
|
||||||
"output_cmp": "blanktx.hex"
|
"output_cmp": "blanktx.hex"
|
||||||
},
|
},
|
||||||
{ "exec": "./bitcoin-tx",
|
{ "exec": "./zcash-tx",
|
||||||
"args": ["-"],
|
"args": ["-"],
|
||||||
"input": "blanktx.hex",
|
"input": "blanktx.hex",
|
||||||
"output_cmp": "blanktx.hex"
|
"output_cmp": "blanktx.hex"
|
||||||
},
|
},
|
||||||
{ "exec": "./bitcoin-tx",
|
{ "exec": "./zcash-tx",
|
||||||
"args": ["-", "delin=1"],
|
"args": ["-", "delin=1"],
|
||||||
"input": "tx394b54bb.hex",
|
"input": "tx394b54bb.hex",
|
||||||
"output_cmp": "tt-delin1-out.hex"
|
"output_cmp": "tt-delin1-out.hex"
|
||||||
},
|
},
|
||||||
{ "exec": "./bitcoin-tx",
|
{ "exec": "./zcash-tx",
|
||||||
"args": ["-", "delin=31"],
|
"args": ["-", "delin=31"],
|
||||||
"input": "tx394b54bb.hex",
|
"input": "tx394b54bb.hex",
|
||||||
"return_code": 1
|
"return_code": 1
|
||||||
},
|
},
|
||||||
{ "exec": "./bitcoin-tx",
|
{ "exec": "./zcash-tx",
|
||||||
"args": ["-", "delout=1"],
|
"args": ["-", "delout=1"],
|
||||||
"input": "tx394b54bb.hex",
|
"input": "tx394b54bb.hex",
|
||||||
"output_cmp": "tt-delout1-out.hex"
|
"output_cmp": "tt-delout1-out.hex"
|
||||||
},
|
},
|
||||||
{ "exec": "./bitcoin-tx",
|
{ "exec": "./zcash-tx",
|
||||||
"args": ["-", "delout=2"],
|
"args": ["-", "delout=2"],
|
||||||
"input": "tx394b54bb.hex",
|
"input": "tx394b54bb.hex",
|
||||||
"return_code": 1
|
"return_code": 1
|
||||||
},
|
},
|
||||||
{ "exec": "./bitcoin-tx",
|
{ "exec": "./zcash-tx",
|
||||||
"args": ["-", "locktime=317000"],
|
"args": ["-", "locktime=317000"],
|
||||||
"input": "tx394b54bb.hex",
|
"input": "tx394b54bb.hex",
|
||||||
"output_cmp": "tt-locktime317000-out.hex"
|
"output_cmp": "tt-locktime317000-out.hex"
|
||||||
},
|
},
|
||||||
{ "exec": "./bitcoin-tx",
|
{ "exec": "./zcash-tx",
|
||||||
"args":
|
"args":
|
||||||
["-create",
|
["-create",
|
||||||
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
|
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
|
||||||
|
@ -43,11 +43,11 @@
|
||||||
"outaddr=4:t1g1aXFye74HKJ24VviTxo3AW4BZbyCni5H"],
|
"outaddr=4:t1g1aXFye74HKJ24VviTxo3AW4BZbyCni5H"],
|
||||||
"output_cmp": "txcreate1.hex"
|
"output_cmp": "txcreate1.hex"
|
||||||
},
|
},
|
||||||
{ "exec": "./bitcoin-tx",
|
{ "exec": "./zcash-tx",
|
||||||
"args": ["-create", "outscript=0:"],
|
"args": ["-create", "outscript=0:"],
|
||||||
"output_cmp": "txcreate2.hex"
|
"output_cmp": "txcreate2.hex"
|
||||||
},
|
},
|
||||||
{ "exec": "./bitcoin-tx",
|
{ "exec": "./zcash-tx",
|
||||||
"args":
|
"args":
|
||||||
["-create",
|
["-create",
|
||||||
"in=4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485:0",
|
"in=4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485:0",
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "test/test_bitcoin.h"
|
#include "test/test_bitcoin.h"
|
||||||
|
|
||||||
#if defined(HAVE_CONSENSUS_LIB)
|
#if defined(HAVE_CONSENSUS_LIB)
|
||||||
#include "script/bitcoinconsensus.h"
|
#include "script/zcashconsensus.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -99,7 +99,7 @@ void DoTest(const CScript& scriptPubKey, const CScript& scriptSig, int flags, bo
|
||||||
#if defined(HAVE_CONSENSUS_LIB)
|
#if defined(HAVE_CONSENSUS_LIB)
|
||||||
CDataStream stream(SER_NETWORK, PROTOCOL_VERSION);
|
CDataStream stream(SER_NETWORK, PROTOCOL_VERSION);
|
||||||
stream << tx2;
|
stream << tx2;
|
||||||
BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script(begin_ptr(scriptPubKey), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size(), 0, flags, NULL) == expect,message);
|
BOOST_CHECK_MESSAGE(zcashconsensus_verify_script(begin_ptr(scriptPubKey), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size(), 0, flags, NULL) == expect,message);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue