Merge branch 'develop'

This commit is contained in:
barrystyle
2019-05-30 17:41:57 +08:00
198 changed files with 2001 additions and 2110 deletions
+24 -6
View File
@@ -8,18 +8,18 @@ define(_CLIENT_VERSION_RC, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2019)
define(_COPYRIGHT_HOLDERS,[The %s developers])
define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[Bitcoin Core]])
define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[nyc3]])
AC_INIT([Bitcoin Core],m4_join([.], _CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MINOR, _CLIENT_VERSION_REVISION, m4_if(_CLIENT_VERSION_BUILD, [0], [], _CLIENT_VERSION_BUILD))m4_if(_CLIENT_VERSION_RC, [0], [], [rc]_CLIENT_VERSION_RC),[https://github.com/bitcoin/bitcoin/issues],[bitcoin],[https://bitcoincore.org/])
AC_CONFIG_SRCDIR([src/validation.cpp])
AC_CONFIG_HEADERS([src/config/bitcoin-config.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([build-aux/m4])
BITCOIN_DAEMON_NAME=bitcoind
BITCOIN_GUI_NAME=bitcoin-qt
BITCOIN_CLI_NAME=bitcoin-cli
BITCOIN_TX_NAME=bitcoin-tx
BITCOIN_WALLET_TOOL_NAME=bitcoin-wallet
BITCOIN_DAEMON_NAME=nyc3d
BITCOIN_GUI_NAME=nyc3-qt
BITCOIN_CLI_NAME=nyc3-cli
BITCOIN_TX_NAME=nyc3-tx
BITCOIN_WALLET_TOOL_NAME=nyc3-wallet
dnl Unless the user specified ARFLAGS, force it to be cr
AC_ARG_VAR(ARFLAGS, [Flags for the archiver, defaults to <cr> if not set])
@@ -221,6 +221,12 @@ AC_ARG_ENABLE([bip70],
[enable_bip70=$enableval],
[enable_bip70=auto])
AC_ARG_ENABLE([sse2],
[AS_HELP_STRING([--enable-sse2],
[enable SSE2 instructions in the scrypt library. (default is disabled)])],
[use_sse2=$enableval],
[use_sse2=no])
AC_ARG_WITH([protoc-bindir],[AS_HELP_STRING([--with-protoc-bindir=BIN_DIR],[specify protoc bin path])], [protoc_bin_path=$withval], [])
AC_ARG_ENABLE(man,
@@ -1393,6 +1399,16 @@ else
BUILD_TEST=""
fi
AC_MSG_CHECKING([whether to enable sse2 instructions])
if test x$use_sse2 != xno; then
AC_MSG_RESULT(yes)
AC_DEFINE([USE_SSE2],[1],[Define if SSE2 support should be compiled in])
use_sse2=yes
CPPFLAGS="$CPPFLAGS -DUSE_SSE2=1"
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([whether to reduce exports])
if test x$use_reduce_exports = xyes; then
AC_MSG_RESULT([yes])
@@ -1415,6 +1431,7 @@ AM_CONDITIONAL([ENABLE_QT_TESTS],[test x$BUILD_TEST_QT = xyes])
AM_CONDITIONAL([ENABLE_BIP70],[test x$enable_bip70 = xyes])
AM_CONDITIONAL([ENABLE_BENCH],[test x$use_bench = xyes])
AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes])
AM_CONDITIONAL([USE_SSE2], [test x$use_sse2 = xyes])
AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes])
AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes])
AM_CONDITIONAL([HARDEN],[test x$use_hardening = xyes])
@@ -1472,6 +1489,7 @@ AC_SUBST(SHANI_CXXFLAGS)
AC_SUBST(LIBTOOL_APP_LDFLAGS)
AC_SUBST(USE_UPNP)
AC_SUBST(USE_QRCODE)
AC_SUBST(USE_SSE2)
AC_SUBST(BOOST_LIBS)
AC_SUBST(TESTDEFS)
AC_SUBST(LEVELDB_TARGET_FLAGS)
+125 -128
View File
@@ -24,37 +24,37 @@ BITCOIN_INCLUDES=-I$(builddir) $(BDB_CPPFLAGS) $(BOOST_CPPFLAGS) $(LEVELDB_CPPFL
BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
BITCOIN_INCLUDES += $(UNIVALUE_CFLAGS)
LIBBITCOIN_SERVER=libbitcoin_server.a
LIBBITCOIN_COMMON=libbitcoin_common.a
LIBBITCOIN_CONSENSUS=libbitcoin_consensus.a
LIBBITCOIN_CLI=libbitcoin_cli.a
LIBBITCOIN_UTIL=libbitcoin_util.a
LIBBITCOIN_CRYPTO_BASE=crypto/libbitcoin_crypto_base.a
LIBBITCOINQT=qt/libbitcoinqt.a
LIBBITCOIN_SERVER=libnyc3_server.a
LIBBITCOIN_COMMON=libnyc3_common.a
LIBBITCOIN_CONSENSUS=libnyc3_consensus.a
LIBBITCOIN_CLI=libnyc3_cli.a
LIBBITCOIN_UTIL=libnyc3_util.a
LIBBITCOIN_CRYPTO_BASE=crypto/libnyc3_crypto_base.a
LIBBITCOINQT=qt/libnyc3qt.a
LIBSECP256K1=secp256k1/libsecp256k1.la
if ENABLE_ZMQ
LIBBITCOIN_ZMQ=libbitcoin_zmq.a
LIBBITCOIN_ZMQ=libnyc3_zmq.a
endif
if BUILD_BITCOIN_LIBS
LIBBITCOINCONSENSUS=libbitcoinconsensus.la
LIBBITCOINCONSENSUS=libnyc3consensus.la
endif
if ENABLE_WALLET
LIBBITCOIN_WALLET=libbitcoin_wallet.a
LIBBITCOIN_WALLET_TOOL=libbitcoin_wallet_tool.a
LIBBITCOIN_WALLET=libnyc3_wallet.a
LIBBITCOIN_WALLET_TOOL=libnyc3_wallet_tool.a
endif
LIBBITCOIN_CRYPTO= $(LIBBITCOIN_CRYPTO_BASE)
if ENABLE_SSE41
LIBBITCOIN_CRYPTO_SSE41 = crypto/libbitcoin_crypto_sse41.a
LIBBITCOIN_CRYPTO_SSE41 = crypto/libnyc3_crypto_sse41.a
LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_SSE41)
endif
if ENABLE_AVX2
LIBBITCOIN_CRYPTO_AVX2 = crypto/libbitcoin_crypto_avx2.a
LIBBITCOIN_CRYPTO_AVX2 = crypto/libnyc3_crypto_avx2.a
LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_AVX2)
endif
if ENABLE_SHANI
LIBBITCOIN_CRYPTO_SHANI = crypto/libbitcoin_crypto_shani.a
LIBBITCOIN_CRYPTO_SHANI = crypto/libnyc3_crypto_shani.a
LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_SHANI)
endif
@@ -82,23 +82,23 @@ TESTS =
BENCHMARKS =
if BUILD_BITCOIND
bin_PROGRAMS += bitcoind
bin_PROGRAMS += nyc3d
endif
if BUILD_BITCOIN_CLI
bin_PROGRAMS += bitcoin-cli
bin_PROGRAMS += nyc3-cli
endif
if BUILD_BITCOIN_TX
bin_PROGRAMS += bitcoin-tx
bin_PROGRAMS += nyc3-tx
endif
if ENABLE_WALLET
if BUILD_BITCOIN_WALLET
bin_PROGRAMS += bitcoin-wallet
bin_PROGRAMS += nyc3-wallet
endif
endif
.PHONY: FORCE check-symbols check-security
# bitcoin core #
# nyc3 core #
BITCOIN_CORE_H = \
addrdb.h \
addrman.h \
@@ -232,12 +232,12 @@ obj/build.h: FORCE
@$(MKDIR_P) $(builddir)/obj
@$(top_srcdir)/share/genbuild.sh "$(abs_top_builddir)/src/obj/build.h" \
"$(abs_top_srcdir)"
libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
libnyc3_util_a-clientversion.$(OBJEXT): obj/build.h
# server: shared between bitcoind and bitcoin-qt
libbitcoin_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
libbitcoin_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libbitcoin_server_a_SOURCES = \
# server: shared between nyc3d and nyc3-qt
libnyc3_server_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS) $(EVENT_CFLAGS) $(EVENT_PTHREADS_CFLAGS)
libnyc3_server_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libnyc3_server_a_SOURCES = \
addrdb.cpp \
addrman.cpp \
banman.cpp \
@@ -288,13 +288,13 @@ libbitcoin_server_a_SOURCES = \
$(BITCOIN_CORE_H)
if !ENABLE_WALLET
libbitcoin_server_a_SOURCES += dummywallet.cpp
libnyc3_server_a_SOURCES += dummywallet.cpp
endif
if ENABLE_ZMQ
libbitcoin_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS)
libbitcoin_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libbitcoin_zmq_a_SOURCES = \
libnyc3_zmq_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(ZMQ_CFLAGS)
libnyc3_zmq_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libnyc3_zmq_a_SOURCES = \
zmq/zmqabstractnotifier.cpp \
zmq/zmqnotificationinterface.cpp \
zmq/zmqpublishnotifier.cpp \
@@ -302,11 +302,11 @@ libbitcoin_zmq_a_SOURCES = \
endif
# wallet: shared between bitcoind and bitcoin-qt, but only linked
# wallet: shared between nyc3d and nyc3-qt, but only linked
# when wallet enabled
libbitcoin_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libbitcoin_wallet_a_SOURCES = \
libnyc3_wallet_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libnyc3_wallet_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libnyc3_wallet_a_SOURCES = \
interfaces/wallet.cpp \
wallet/coincontrol.cpp \
wallet/crypter.cpp \
@@ -323,16 +323,16 @@ libbitcoin_wallet_a_SOURCES = \
wallet/coinselection.cpp \
$(BITCOIN_CORE_H)
libbitcoin_wallet_tool_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_wallet_tool_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libbitcoin_wallet_tool_a_SOURCES = \
libnyc3_wallet_tool_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libnyc3_wallet_tool_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libnyc3_wallet_tool_a_SOURCES = \
wallet/wallettool.cpp \
$(BITCOIN_CORE_H)
# crypto primitives library
crypto_libbitcoin_crypto_base_a_CPPFLAGS = $(AM_CPPFLAGS)
crypto_libbitcoin_crypto_base_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
crypto_libbitcoin_crypto_base_a_SOURCES = \
crypto_libnyc3_crypto_base_a_CPPFLAGS = $(AM_CPPFLAGS) $(SSL_CFLAGS)
crypto_libnyc3_crypto_base_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
crypto_libnyc3_crypto_base_a_SOURCES = \
crypto/aes.cpp \
crypto/aes.h \
crypto/chacha20.h \
@@ -344,6 +344,9 @@ crypto_libbitcoin_crypto_base_a_SOURCES = \
crypto/hmac_sha512.h \
crypto/ripemd160.cpp \
crypto/ripemd160.h \
crypto/scrypt.cpp \
crypto/scrypt-sse2.cpp \
crypto/scrypt.h \
crypto/sha1.cpp \
crypto/sha1.h \
crypto/sha256.cpp \
@@ -351,34 +354,40 @@ crypto_libbitcoin_crypto_base_a_SOURCES = \
crypto/sha512.cpp \
crypto/sha512.h \
crypto/siphash.cpp \
crypto/siphash.h
crypto/siphash.h \
crypto/parallel/architecture.h \
crypto/parallel/common.h \
crypto/parallel/parallel.cpp \
crypto/parallel/parallel.h \
crypto/parallel/sha512.cpp \
crypto/parallel/sha512.h
if USE_ASM
crypto_libbitcoin_crypto_base_a_SOURCES += crypto/sha256_sse4.cpp
crypto_libnyc3_crypto_base_a_SOURCES += crypto/sha256_sse4.cpp
endif
crypto_libbitcoin_crypto_sse41_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
crypto_libbitcoin_crypto_sse41_a_CPPFLAGS = $(AM_CPPFLAGS)
crypto_libbitcoin_crypto_sse41_a_CXXFLAGS += $(SSE41_CXXFLAGS)
crypto_libbitcoin_crypto_sse41_a_CPPFLAGS += -DENABLE_SSE41
crypto_libbitcoin_crypto_sse41_a_SOURCES = crypto/sha256_sse41.cpp
crypto_libnyc3_crypto_sse41_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
crypto_libnyc3_crypto_sse41_a_CPPFLAGS = $(AM_CPPFLAGS)
crypto_libnyc3_crypto_sse41_a_CXXFLAGS += $(SSE41_CXXFLAGS)
crypto_libnyc3_crypto_sse41_a_CPPFLAGS += -DENABLE_SSE41
crypto_libnyc3_crypto_sse41_a_SOURCES = crypto/sha256_sse41.cpp
crypto_libbitcoin_crypto_avx2_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
crypto_libbitcoin_crypto_avx2_a_CPPFLAGS = $(AM_CPPFLAGS)
crypto_libbitcoin_crypto_avx2_a_CXXFLAGS += $(AVX2_CXXFLAGS)
crypto_libbitcoin_crypto_avx2_a_CPPFLAGS += -DENABLE_AVX2
crypto_libbitcoin_crypto_avx2_a_SOURCES = crypto/sha256_avx2.cpp
crypto_libnyc3_crypto_avx2_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
crypto_libnyc3_crypto_avx2_a_CPPFLAGS = $(AM_CPPFLAGS)
crypto_libnyc3_crypto_avx2_a_CXXFLAGS += $(AVX2_CXXFLAGS)
crypto_libnyc3_crypto_avx2_a_CPPFLAGS += -DENABLE_AVX2
crypto_libnyc3_crypto_avx2_a_SOURCES = crypto/sha256_avx2.cpp
crypto_libbitcoin_crypto_shani_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
crypto_libbitcoin_crypto_shani_a_CPPFLAGS = $(AM_CPPFLAGS)
crypto_libbitcoin_crypto_shani_a_CXXFLAGS += $(SHANI_CXXFLAGS)
crypto_libbitcoin_crypto_shani_a_CPPFLAGS += -DENABLE_SHANI
crypto_libbitcoin_crypto_shani_a_SOURCES = crypto/sha256_shani.cpp
crypto_libnyc3_crypto_shani_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
crypto_libnyc3_crypto_shani_a_CPPFLAGS = $(AM_CPPFLAGS)
crypto_libnyc3_crypto_shani_a_CXXFLAGS += $(SHANI_CXXFLAGS)
crypto_libnyc3_crypto_shani_a_CPPFLAGS += -DENABLE_SHANI
crypto_libnyc3_crypto_shani_a_SOURCES = crypto/sha256_shani.cpp
# consensus: shared between all executables that validate any consensus rules.
libbitcoin_consensus_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_consensus_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libbitcoin_consensus_a_SOURCES = \
libnyc3_consensus_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libnyc3_consensus_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libnyc3_consensus_a_SOURCES = \
amount.h \
arith_uint256.cpp \
arith_uint256.h \
@@ -395,7 +404,7 @@ libbitcoin_consensus_a_SOURCES = \
primitives/transaction.h \
pubkey.cpp \
pubkey.h \
script/bitcoinconsensus.cpp \
script/nyc3consensus.cpp \
script/interpreter.cpp \
script/interpreter.h \
script/script.cpp \
@@ -411,10 +420,10 @@ libbitcoin_consensus_a_SOURCES = \
util/strencodings.h \
version.h
# common: shared between bitcoind, and bitcoin-qt and non-server tools
libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libbitcoin_common_a_SOURCES = \
# common: shared between nyc3d, and nyc3-qt and non-server tools
libnyc3_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libnyc3_common_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libnyc3_common_a_SOURCES = \
base58.cpp \
bech32.cpp \
chainparams.cpp \
@@ -442,9 +451,9 @@ libbitcoin_common_a_SOURCES = \
# util: shared between all executables.
# This library *must* be included to make sure that the glibc
# backward-compatibility objects and their sanity checks are linked.
libbitcoin_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libbitcoin_util_a_SOURCES = \
libnyc3_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libnyc3_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libnyc3_util_a_SOURCES = \
support/lockedpool.cpp \
chainparamsbase.cpp \
clientversion.cpp \
@@ -467,31 +476,31 @@ libbitcoin_util_a_SOURCES = \
$(BITCOIN_CORE_H)
if GLIBC_BACK_COMPAT
libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
libnyc3_util_a_SOURCES += compat/glibc_compat.cpp
AM_LDFLAGS += $(COMPAT_LDFLAGS)
endif
# cli: shared between bitcoin-cli and bitcoin-qt
libbitcoin_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libbitcoin_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libbitcoin_cli_a_SOURCES = \
# cli: shared between nyc3-cli and nyc3-qt
libnyc3_cli_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
libnyc3_cli_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libnyc3_cli_a_SOURCES = \
rpc/client.cpp \
$(BITCOIN_CORE_H)
nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
nodist_libnyc3_util_a_SOURCES = $(srcdir)/obj/build.h
#
# bitcoind binary #
bitcoind_SOURCES = bitcoind.cpp
bitcoind_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
bitcoind_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
bitcoind_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
# nyc3d binary #
nyc3d_SOURCES = nyc3d.cpp
nyc3d_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
nyc3d_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
nyc3d_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
if TARGET_WINDOWS
bitcoind_SOURCES += bitcoind-res.rc
nyc3d_SOURCES += nyc3d-res.rc
endif
bitcoind_LDADD = \
nyc3d_LDADD = \
$(LIBBITCOIN_SERVER) \
$(LIBBITCOIN_WALLET) \
$(LIBBITCOIN_SERVER) \
@@ -506,38 +515,38 @@ bitcoind_LDADD = \
$(LIBMEMENV) \
$(LIBSECP256K1)
bitcoind_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS)
nyc3d_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(ZMQ_LIBS)
# bitcoin-cli binary #
bitcoin_cli_SOURCES = bitcoin-cli.cpp
bitcoin_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
bitcoin_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
bitcoin_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
# nyc3-cli binary #
nyc3_cli_SOURCES = nyc3-cli.cpp
nyc3_cli_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(EVENT_CFLAGS)
nyc3_cli_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
nyc3_cli_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
if TARGET_WINDOWS
bitcoin_cli_SOURCES += bitcoin-cli-res.rc
nyc3_cli_SOURCES += nyc3-cli-res.rc
endif
bitcoin_cli_LDADD = \
nyc3_cli_LDADD = \
$(LIBBITCOIN_CLI) \
$(LIBUNIVALUE) \
$(LIBBITCOIN_UTIL) \
$(LIBBITCOIN_CRYPTO)
bitcoin_cli_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS) $(EVENT_LIBS)
nyc3_cli_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS) $(EVENT_LIBS)
#
# bitcoin-tx binary #
bitcoin_tx_SOURCES = bitcoin-tx.cpp
bitcoin_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
bitcoin_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
bitcoin_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
# nyc3-tx binary #
nyc3_tx_SOURCES = nyc3-tx.cpp
nyc3_tx_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
nyc3_tx_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
nyc3_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
if TARGET_WINDOWS
bitcoin_tx_SOURCES += bitcoin-tx-res.rc
nyc3_tx_SOURCES += nyc3-tx-res.rc
endif
bitcoin_tx_LDADD = \
nyc3_tx_LDADD = \
$(LIBUNIVALUE) \
$(LIBBITCOIN_COMMON) \
$(LIBBITCOIN_UTIL) \
@@ -545,20 +554,20 @@ bitcoin_tx_LDADD = \
$(LIBBITCOIN_CRYPTO) \
$(LIBSECP256K1)
bitcoin_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
nyc3_tx_LDADD += $(BOOST_LIBS) $(CRYPTO_LIBS)
#
# bitcoin-wallet binary #
bitcoin_wallet_SOURCES = bitcoin-wallet.cpp
bitcoin_wallet_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
bitcoin_wallet_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
bitcoin_wallet_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
# nyc3-wallet binary #
nyc3_wallet_SOURCES = nyc3-wallet.cpp
nyc3_wallet_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
nyc3_wallet_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
nyc3_wallet_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
if TARGET_WINDOWS
bitcoin_wallet_SOURCES += bitcoin-wallet-res.rc
nyc3_wallet_SOURCES += nyc3-wallet-res.rc
endif
bitcoin_wallet_LDADD = \
nyc3_wallet_LDADD = \
$(LIBBITCOIN_WALLET_TOOL) \
$(LIBBITCOIN_WALLET) \
$(LIBBITCOIN_SERVER) \
@@ -571,22 +580,22 @@ bitcoin_wallet_LDADD = \
$(LIBMEMENV) \
$(LIBSECP256K1)
bitcoin_wallet_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS)
nyc3_wallet_LDADD += $(BOOST_LIBS) $(BDB_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS)
#
# bitcoinconsensus library #
# nyc3consensus library #
if BUILD_BITCOIN_LIBS
include_HEADERS = script/bitcoinconsensus.h
libbitcoinconsensus_la_SOURCES = $(crypto_libbitcoin_crypto_base_a_SOURCES) $(libbitcoin_consensus_a_SOURCES)
include_HEADERS = script/nyc3consensus.h
libnyc3consensus_la_SOURCES = $(crypto_libnyc3_crypto_base_a_SOURCES) $(libnyc3_consensus_a_SOURCES)
if GLIBC_BACK_COMPAT
libbitcoinconsensus_la_SOURCES += compat/glibc_compat.cpp
libnyc3consensus_la_SOURCES += compat/glibc_compat.cpp
endif
libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1)
libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
libnyc3consensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
libnyc3consensus_la_LIBADD = $(LIBSECP256K1) $(CRYPTO_LIBS)
libnyc3consensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL $(SSL_CFLAGS)
libnyc3consensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
endif
#
@@ -616,12 +625,12 @@ CLEANFILES += obj/build.h
EXTRA_DIST = $(CTAES_DIST)
config/bitcoin-config.h: config/stamp-h1
config/nyc3-config.h: config/stamp-h1
@$(MAKE) -C $(top_builddir) $(subdir)/$(@)
config/stamp-h1: $(top_srcdir)/$(subdir)/config/bitcoin-config.h.in $(top_builddir)/config.status
config/stamp-h1: $(top_srcdir)/$(subdir)/config/nyc3-config.h.in $(top_builddir)/config.status
$(AM_V_at)$(MAKE) -C $(top_builddir) $(subdir)/$(@)
$(top_srcdir)/$(subdir)/config/bitcoin-config.h.in: $(am__configure_deps)
$(AM_V_at)$(MAKE) -C $(top_srcdir) $(subdir)/config/bitcoin-config.h.in
$(top_srcdir)/$(subdir)/config/nyc3-config.h.in: $(am__configure_deps)
$(AM_V_at)$(MAKE) -C $(top_srcdir) $(subdir)/config/nyc3-config.h.in
clean-local:
-$(MAKE) -C secp256k1 clean
@@ -657,18 +666,6 @@ if EMBEDDED_LEVELDB
include Makefile.leveldb.include
endif
if ENABLE_TESTS
include Makefile.test.include
endif
if ENABLE_BENCH
include Makefile.bench.include
endif
if ENABLE_QT
include Makefile.qt.include
endif
if ENABLE_QT_TESTS
include Makefile.qttest.include
endif
+143 -143
View File
@@ -2,97 +2,97 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
bin_PROGRAMS += qt/bitcoin-qt
EXTRA_LIBRARIES += qt/libbitcoinqt.a
bin_PROGRAMS += qt/nyc3-qt
EXTRA_LIBRARIES += qt/libnyc3qt.a
# bitcoin qt core #
# nyc3 qt core #
QT_TS = \
qt/locale/bitcoin_af.ts \
qt/locale/bitcoin_af_ZA.ts \
qt/locale/bitcoin_ar.ts \
qt/locale/bitcoin_be_BY.ts \
qt/locale/bitcoin_bg_BG.ts \
qt/locale/bitcoin_bg.ts \
qt/locale/bitcoin_ca_ES.ts \
qt/locale/bitcoin_ca.ts \
qt/locale/bitcoin_ca@valencia.ts \
qt/locale/bitcoin_cs.ts \
qt/locale/bitcoin_cy.ts \
qt/locale/bitcoin_da.ts \
qt/locale/bitcoin_de.ts \
qt/locale/bitcoin_el_GR.ts \
qt/locale/bitcoin_el.ts \
qt/locale/bitcoin_en_GB.ts \
qt/locale/bitcoin_en.ts \
qt/locale/bitcoin_eo.ts \
qt/locale/bitcoin_es_AR.ts \
qt/locale/bitcoin_es_CL.ts \
qt/locale/bitcoin_es_CO.ts \
qt/locale/bitcoin_es_DO.ts \
qt/locale/bitcoin_es_ES.ts \
qt/locale/bitcoin_es_MX.ts \
qt/locale/bitcoin_es.ts \
qt/locale/bitcoin_es_UY.ts \
qt/locale/bitcoin_es_VE.ts \
qt/locale/bitcoin_et_EE.ts \
qt/locale/bitcoin_et.ts \
qt/locale/bitcoin_eu_ES.ts \
qt/locale/bitcoin_fa_IR.ts \
qt/locale/bitcoin_fa.ts \
qt/locale/bitcoin_fi.ts \
qt/locale/bitcoin_fr_CA.ts \
qt/locale/bitcoin_fr_FR.ts \
qt/locale/bitcoin_fr.ts \
qt/locale/bitcoin_gl.ts \
qt/locale/bitcoin_he.ts \
qt/locale/bitcoin_hi_IN.ts \
qt/locale/bitcoin_hr.ts \
qt/locale/bitcoin_hu.ts \
qt/locale/bitcoin_id_ID.ts \
qt/locale/bitcoin_it_IT.ts \
qt/locale/bitcoin_it.ts \
qt/locale/bitcoin_ja.ts \
qt/locale/bitcoin_ka.ts \
qt/locale/bitcoin_kk_KZ.ts \
qt/locale/bitcoin_ko_KR.ts \
qt/locale/bitcoin_ku_IQ.ts \
qt/locale/bitcoin_ky.ts \
qt/locale/bitcoin_la.ts \
qt/locale/bitcoin_lt.ts \
qt/locale/bitcoin_lv_LV.ts \
qt/locale/bitcoin_mk_MK.ts \
qt/locale/bitcoin_mn.ts \
qt/locale/bitcoin_ms_MY.ts \
qt/locale/bitcoin_nb.ts \
qt/locale/bitcoin_ne.ts \
qt/locale/bitcoin_nl.ts \
qt/locale/bitcoin_pam.ts \
qt/locale/bitcoin_pl.ts \
qt/locale/bitcoin_pt_BR.ts \
qt/locale/bitcoin_pt_PT.ts \
qt/locale/bitcoin_ro_RO.ts \
qt/locale/bitcoin_ro.ts \
qt/locale/bitcoin_ru_RU.ts \
qt/locale/bitcoin_ru.ts \
qt/locale/bitcoin_sk.ts \
qt/locale/bitcoin_sl_SI.ts \
qt/locale/bitcoin_sq.ts \
qt/locale/bitcoin_sr@latin.ts \
qt/locale/bitcoin_sr.ts \
qt/locale/bitcoin_sv.ts \
qt/locale/bitcoin_ta.ts \
qt/locale/bitcoin_th_TH.ts \
qt/locale/bitcoin_tr_TR.ts \
qt/locale/bitcoin_tr.ts \
qt/locale/bitcoin_uk.ts \
qt/locale/bitcoin_ur_PK.ts \
qt/locale/bitcoin_uz@Cyrl.ts \
qt/locale/bitcoin_vi.ts \
qt/locale/bitcoin_vi_VN.ts \
qt/locale/bitcoin_zh_CN.ts \
qt/locale/bitcoin_zh_HK.ts \
qt/locale/bitcoin_zh.ts \
qt/locale/bitcoin_zh_TW.ts
qt/locale/nyc3_af.ts \
qt/locale/nyc3_af_ZA.ts \
qt/locale/nyc3_ar.ts \
qt/locale/nyc3_be_BY.ts \
qt/locale/nyc3_bg_BG.ts \
qt/locale/nyc3_bg.ts \
qt/locale/nyc3_ca_ES.ts \
qt/locale/nyc3_ca.ts \
qt/locale/nyc3_ca@valencia.ts \
qt/locale/nyc3_cs.ts \
qt/locale/nyc3_cy.ts \
qt/locale/nyc3_da.ts \
qt/locale/nyc3_de.ts \
qt/locale/nyc3_el_GR.ts \
qt/locale/nyc3_el.ts \
qt/locale/nyc3_en_GB.ts \
qt/locale/nyc3_en.ts \
qt/locale/nyc3_eo.ts \
qt/locale/nyc3_es_AR.ts \
qt/locale/nyc3_es_CL.ts \
qt/locale/nyc3_es_CO.ts \
qt/locale/nyc3_es_DO.ts \
qt/locale/nyc3_es_ES.ts \
qt/locale/nyc3_es_MX.ts \
qt/locale/nyc3_es.ts \
qt/locale/nyc3_es_UY.ts \
qt/locale/nyc3_es_VE.ts \
qt/locale/nyc3_et_EE.ts \
qt/locale/nyc3_et.ts \
qt/locale/nyc3_eu_ES.ts \
qt/locale/nyc3_fa_IR.ts \
qt/locale/nyc3_fa.ts \
qt/locale/nyc3_fi.ts \
qt/locale/nyc3_fr_CA.ts \
qt/locale/nyc3_fr_FR.ts \
qt/locale/nyc3_fr.ts \
qt/locale/nyc3_gl.ts \
qt/locale/nyc3_he.ts \
qt/locale/nyc3_hi_IN.ts \
qt/locale/nyc3_hr.ts \
qt/locale/nyc3_hu.ts \
qt/locale/nyc3_id_ID.ts \
qt/locale/nyc3_it_IT.ts \
qt/locale/nyc3_it.ts \
qt/locale/nyc3_ja.ts \
qt/locale/nyc3_ka.ts \
qt/locale/nyc3_kk_KZ.ts \
qt/locale/nyc3_ko_KR.ts \
qt/locale/nyc3_ku_IQ.ts \
qt/locale/nyc3_ky.ts \
qt/locale/nyc3_la.ts \
qt/locale/nyc3_lt.ts \
qt/locale/nyc3_lv_LV.ts \
qt/locale/nyc3_mk_MK.ts \
qt/locale/nyc3_mn.ts \
qt/locale/nyc3_ms_MY.ts \
qt/locale/nyc3_nb.ts \
qt/locale/nyc3_ne.ts \
qt/locale/nyc3_nl.ts \
qt/locale/nyc3_pam.ts \
qt/locale/nyc3_pl.ts \
qt/locale/nyc3_pt_BR.ts \
qt/locale/nyc3_pt_PT.ts \
qt/locale/nyc3_ro_RO.ts \
qt/locale/nyc3_ro.ts \
qt/locale/nyc3_ru_RU.ts \
qt/locale/nyc3_ru.ts \
qt/locale/nyc3_sk.ts \
qt/locale/nyc3_sl_SI.ts \
qt/locale/nyc3_sq.ts \
qt/locale/nyc3_sr@latin.ts \
qt/locale/nyc3_sr.ts \
qt/locale/nyc3_sv.ts \
qt/locale/nyc3_ta.ts \
qt/locale/nyc3_th_TH.ts \
qt/locale/nyc3_tr_TR.ts \
qt/locale/nyc3_tr.ts \
qt/locale/nyc3_uk.ts \
qt/locale/nyc3_ur_PK.ts \
qt/locale/nyc3_uz@Cyrl.ts \
qt/locale/nyc3_vi.ts \
qt/locale/nyc3_vi_VN.ts \
qt/locale/nyc3_zh_CN.ts \
qt/locale/nyc3_zh_HK.ts \
qt/locale/nyc3_zh.ts \
qt/locale/nyc3_zh_TW.ts
QT_FORMS_UI = \
qt/forms/addressbookpage.ui \
@@ -118,11 +118,11 @@ QT_MOC_CPP = \
qt/moc_addresstablemodel.cpp \
qt/moc_askpassphrasedialog.cpp \
qt/moc_bantablemodel.cpp \
qt/moc_bitcoinaddressvalidator.cpp \
qt/moc_bitcoinamountfield.cpp \
qt/moc_bitcoin.cpp \
qt/moc_bitcoingui.cpp \
qt/moc_bitcoinunits.cpp \
qt/moc_nyc3addressvalidator.cpp \
qt/moc_nyc3amountfield.cpp \
qt/moc_nyc3.cpp \
qt/moc_nyc3gui.cpp \
qt/moc_nyc3units.cpp \
qt/moc_clientmodel.cpp \
qt/moc_coincontroldialog.cpp \
qt/moc_coincontroltreewidget.cpp \
@@ -168,15 +168,15 @@ BITCOIN_MM = \
qt/macos_appnap.mm
QT_MOC = \
qt/bitcoinamountfield.moc \
qt/nyc3amountfield.moc \
qt/intro.moc \
qt/overviewpage.moc \
qt/rpcconsole.moc
QT_QRC_CPP = qt/qrc_bitcoin.cpp
QT_QRC = qt/bitcoin.qrc
QT_QRC_LOCALE_CPP = qt/qrc_bitcoin_locale.cpp
QT_QRC_LOCALE = qt/bitcoin_locale.qrc
QT_QRC_CPP = qt/qrc_nyc3.cpp
QT_QRC = qt/nyc3.qrc
QT_QRC_LOCALE_CPP = qt/qrc_nyc3_locale.cpp
QT_QRC_LOCALE = qt/nyc3_locale.qrc
if ENABLE_BIP70
PROTOBUF_CC = qt/paymentrequest.pb.cc
@@ -193,11 +193,11 @@ BITCOIN_QT_H = \
qt/addresstablemodel.h \
qt/askpassphrasedialog.h \
qt/bantablemodel.h \
qt/bitcoinaddressvalidator.h \
qt/bitcoinamountfield.h \
qt/bitcoin.h \
qt/bitcoingui.h \
qt/bitcoinunits.h \
qt/nyc3addressvalidator.h \
qt/nyc3amountfield.h \
qt/nyc3.h \
qt/nyc3gui.h \
qt/nyc3units.h \
qt/clientmodel.h \
qt/coincontroldialog.h \
qt/coincontroltreewidget.h \
@@ -250,9 +250,9 @@ RES_ICONS = \
qt/res/icons/address-book.png \
qt/res/icons/about.png \
qt/res/icons/about_qt.png \
qt/res/icons/bitcoin.ico \
qt/res/icons/bitcoin_testnet.ico \
qt/res/icons/bitcoin.png \
qt/res/icons/nyc3.ico \
qt/res/icons/nyc3_testnet.ico \
qt/res/icons/nyc3.png \
qt/res/icons/chevron.png \
qt/res/icons/clock1.png \
qt/res/icons/clock2.png \
@@ -305,11 +305,11 @@ RES_ICONS = \
BITCOIN_QT_BASE_CPP = \
qt/bantablemodel.cpp \
qt/bitcoin.cpp \
qt/bitcoinaddressvalidator.cpp \
qt/bitcoinamountfield.cpp \
qt/bitcoingui.cpp \
qt/bitcoinunits.cpp \
qt/nyc3.cpp \
qt/nyc3addressvalidator.cpp \
qt/nyc3amountfield.cpp \
qt/nyc3gui.cpp \
qt/nyc3units.cpp \
qt/clientmodel.cpp \
qt/csvmodelwriter.cpp \
qt/guiutil.cpp \
@@ -376,22 +376,22 @@ RES_IMAGES =
RES_MOVIES = $(wildcard $(srcdir)/qt/res/movies/spinner-*.png)
BITCOIN_RC = qt/res/bitcoin-qt-res.rc
BITCOIN_RC = qt/res/nyc3-qt-res.rc
BITCOIN_QT_INCLUDES = -DQT_NO_KEYWORDS
qt_libbitcoinqt_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
qt_libnyc3qt_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
$(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(PROTOBUF_CFLAGS) $(QR_CFLAGS)
qt_libbitcoinqt_a_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
qt_libbitcoinqt_a_OBJCXXFLAGS = $(AM_OBJCXXFLAGS) $(QT_PIE_FLAGS)
qt_libnyc3qt_a_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
qt_libnyc3qt_a_OBJCXXFLAGS = $(AM_OBJCXXFLAGS) $(QT_PIE_FLAGS)
qt_libbitcoinqt_a_SOURCES = $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(QT_FORMS_UI) \
qt_libnyc3qt_a_SOURCES = $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(QT_FORMS_UI) \
$(QT_QRC) $(QT_QRC_LOCALE) $(QT_TS) $(PROTOBUF_PROTO) $(RES_ICONS) $(RES_IMAGES) $(RES_MOVIES)
if TARGET_DARWIN
qt_libbitcoinqt_a_SOURCES += $(BITCOIN_MM)
qt_libnyc3qt_a_SOURCES += $(BITCOIN_MM)
endif
nodist_qt_libbitcoinqt_a_SOURCES = $(QT_MOC_CPP) $(QT_MOC) $(PROTOBUF_CC) \
nodist_qt_libnyc3qt_a_SOURCES = $(QT_MOC_CPP) $(QT_MOC) $(PROTOBUF_CC) \
$(PROTOBUF_H) $(QT_QRC_CPP) $(QT_QRC_LOCALE_CPP)
# forms/foo.h -> forms/ui_foo.h
@@ -400,76 +400,76 @@ QT_FORMS_H=$(join $(dir $(QT_FORMS_UI)),$(addprefix ui_, $(notdir $(QT_FORMS_UI:
# Most files will depend on the forms and moc files as includes. Generate them
# before anything else.
$(QT_MOC): $(QT_FORMS_H)
$(qt_libbitcoinqt_a_OBJECTS) $(qt_bitcoin_qt_OBJECTS) : | $(QT_MOC)
$(qt_libnyc3qt_a_OBJECTS) $(qt_nyc3_qt_OBJECTS) : | $(QT_MOC)
#Generating these with a half-written protobuf header leads to wacky results.
#This makes sure it's done.
$(QT_MOC): $(PROTOBUF_H)
$(QT_MOC_CPP): $(PROTOBUF_H)
# bitcoin-qt binary #
qt_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
# nyc3-qt binary #
qt_nyc3_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
$(QT_INCLUDES) $(PROTOBUF_CFLAGS) $(QR_CFLAGS)
qt_bitcoin_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
qt_nyc3_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
qt_bitcoin_qt_SOURCES = qt/main.cpp
qt_nyc3_qt_SOURCES = qt/main.cpp
if TARGET_WINDOWS
qt_bitcoin_qt_SOURCES += $(BITCOIN_RC)
qt_nyc3_qt_SOURCES += $(BITCOIN_RC)
endif
qt_bitcoin_qt_LDADD = qt/libbitcoinqt.a $(LIBBITCOIN_SERVER)
qt_nyc3_qt_LDADD = qt/libnyc3qt.a $(LIBBITCOIN_SERVER)
if ENABLE_WALLET
qt_bitcoin_qt_LDADD += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET)
qt_nyc3_qt_LDADD += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET)
endif
if ENABLE_ZMQ
qt_bitcoin_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
qt_nyc3_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
endif
qt_bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) \
qt_nyc3_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) \
$(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \
$(EVENT_PTHREADS_LIBS) $(EVENT_LIBS)
if ENABLE_BIP70
qt_bitcoin_qt_LDADD += $(SSL_LIBS)
qt_nyc3_qt_LDADD += $(SSL_LIBS)
else
if TARGET_WINDOWS
qt_bitcoin_qt_LDADD += $(SSL_LIBS)
qt_nyc3_qt_LDADD += $(SSL_LIBS)
endif
endif
qt_bitcoin_qt_LDADD += $(CRYPTO_LIBS)
qt_bitcoin_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
qt_bitcoin_qt_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS) --tag CXX
qt_nyc3_qt_LDADD += $(CRYPTO_LIBS)
qt_nyc3_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
qt_nyc3_qt_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS) --tag CXX
#locale/foo.ts -> locale/foo.qm
QT_QM=$(QT_TS:.ts=.qm)
SECONDARY: $(QT_QM)
$(srcdir)/qt/bitcoinstrings.cpp: $(libbitcoin_server_a_SOURCES) $(libbitcoin_wallet_a_SOURCES) $(libbitcoin_common_a_SOURCES) $(libbitcoin_zmq_a_SOURCES) $(libbitcoin_consensus_a_SOURCES) $(libbitcoin_util_a_SOURCES)
$(srcdir)/qt/nyc3strings.cpp: $(libnyc3_server_a_SOURCES) $(libnyc3_wallet_a_SOURCES) $(libnyc3_common_a_SOURCES) $(libnyc3_zmq_a_SOURCES) $(libnyc3_consensus_a_SOURCES) $(libnyc3_util_a_SOURCES)
@test -n $(XGETTEXT) || echo "xgettext is required for updating translations"
$(AM_V_GEN) cd $(srcdir); XGETTEXT=$(XGETTEXT) PACKAGE_NAME="$(PACKAGE_NAME)" COPYRIGHT_HOLDERS="$(COPYRIGHT_HOLDERS)" COPYRIGHT_HOLDERS_SUBSTITUTION="$(COPYRIGHT_HOLDERS_SUBSTITUTION)" $(PYTHON) ../share/qt/extract_strings_qt.py $^
translate: $(srcdir)/qt/bitcoinstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_BASE_CPP) qt/bitcoin.cpp $(BITCOIN_QT_WINDOWS_CPP) $(BITCOIN_QT_WALLET_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM)
translate: $(srcdir)/qt/nyc3strings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_BASE_CPP) qt/nyc3.cpp $(BITCOIN_QT_WINDOWS_CPP) $(BITCOIN_QT_WALLET_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM)
@test -n $(LUPDATE) || echo "lupdate is required for updating translations"
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LUPDATE) $^ -locations relative -no-obsolete -ts $(srcdir)/qt/locale/bitcoin_en.ts
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LUPDATE) $^ -locations relative -no-obsolete -ts $(srcdir)/qt/locale/nyc3_en.ts
$(QT_QRC_LOCALE_CPP): $(QT_QRC_LOCALE) $(QT_QM)
@test -f $(RCC)
@cp -f $< $(@D)/temp_$(<F)
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin_locale $(@D)/temp_$(<F) | \
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name nyc3_locale $(@D)/temp_$(<F) | \
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
@rm $(@D)/temp_$(<F)
$(QT_QRC_CPP): $(QT_QRC) $(QT_FORMS_H) $(RES_ICONS) $(RES_IMAGES) $(RES_MOVIES) $(PROTOBUF_H)
@test -f $(RCC)
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin $< | \
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name nyc3 $< | \
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_bitcoin_locale.qrc
CLEAN_QT = $(nodist_qt_libnyc3qt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_nyc3_locale.qrc
CLEANFILES += $(CLEAN_QT)
bitcoin_qt_clean: FORCE
rm -f $(CLEAN_QT) $(qt_libbitcoinqt_a_OBJECTS) $(qt_bitcoin_qt_OBJECTS) qt/bitcoin-qt$(EXEEXT) $(LIBBITCOINQT)
nyc3_qt_clean: FORCE
rm -f $(CLEAN_QT) $(qt_libnyc3qt_a_OBJECTS) $(qt_nyc3_qt_OBJECTS) qt/nyc3-qt$(EXEEXT) $(LIBBITCOINQT)
bitcoin_qt : qt/bitcoin-qt$(EXEEXT)
nyc3_qt : qt/nyc3-qt$(EXEEXT)
ui_%.h: %.ui
@test -f $(UIC)
+1
View File
@@ -112,6 +112,7 @@ BITCOIN_TESTS =\
test/script_tests.cpp \
test/script_standard_tests.cpp \
test/scriptnum_tests.cpp \
test/scrypt_tests.cpp \
test/serialize_tests.cpp \
test/sighash_tests.cpp \
test/sigopcount_tests.cpp \
+1 -1
View File
@@ -22,7 +22,7 @@ static const CAmount COIN = 100000000;
* critical; in unusual circumstances like a(nother) overflow bug that allowed
* for the creation of coins out of thin air modification could lead to a fork.
* */
static const CAmount MAX_MONEY = 21000000 * COIN;
static const CAmount MAX_MONEY = 9062500000 * COIN;
inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
#endif // BITCOIN_AMOUNT_H
+8 -1
View File
@@ -17,8 +17,10 @@
/**
* Maximum amount of time that a block timestamp is allowed to exceed the
* current network-adjusted time before the block will be accepted.
*
* Note: Given our 10s block time, 120s is appropriate by scale (10 min/2hr bitcoin)
*/
static constexpr int64_t MAX_FUTURE_BLOCK_TIME = 2 * 60 * 60;
static constexpr int64_t MAX_FUTURE_BLOCK_TIME = 2 * 60;
/**
* Timestamp window used as a grace period by code that compares external
@@ -311,6 +313,11 @@ public:
*/
bool HaveTxsDownloaded() const { return nChainTx != 0; }
uint256 GetBlockPoWHash() const
{
return GetBlockHeader().GetPoWHash();
}
int64_t GetBlockTime() const
{
return (int64_t)nTime;
+30 -218
View File
@@ -5,6 +5,7 @@
#include <chainparams.h>
#include <arith_uint256.h>
#include <chainparamsseeds.h>
#include <consensus/merkle.h>
#include <tinyformat.h>
@@ -43,15 +44,14 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesi
* transaction cannot be spent since it did not originally exist in the
* database.
*
* CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1)
* CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
* CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
* CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
* vMerkleTree: 4a5e1e
* CBlock(hash=17e7131a4eb39658cca55c136f59d2cf795db379f3cb4fa640b171ee4ae90e9a, ver=0x00000001,
* hashPrevBlock=0000000000000000000000000000000000000000000000000000000000000000,
* hashMerkleRoot=dfd0e8579d4f22ce8fb4a7c2e372469d027e2a4954b6a3ef302c698052bdae1f,
* nTime=1559078000, nBits=1f00ffff, nNonce=26552, vtx=1)
*/
static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
{
const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
const char* pszTimestamp = "nyc3 2019";
const CScript genesisOutputScript = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
}
@@ -63,19 +63,13 @@ class CMainParams : public CChainParams {
public:
CMainParams() {
strNetworkID = "main";
consensus.nSubsidyHalvingInterval = 210000;
consensus.BIP16Exception = uint256S("0x00000000000002dc756eebf4f49723ed8d30cc28a5f108eb94b1ba88ac4f9c22");
consensus.BIP34Height = 227931;
consensus.BIP34Hash = uint256S("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8");
consensus.BIP65Height = 388381; // 000000000000000004c2b624ed5d7756c508d90fd0da2c7c679febfa6c4735f0
consensus.BIP66Height = 363725; // 00000000000000000379eaa19dce8c9b722d46ae6a57c2f1a988119488b50931
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
consensus.nPowTargetSpacing = 10 * 60;
consensus.powLimit = uint256S("007ffff000000000000000000000000000000000000000000000000000000000");
consensus.nPowTargetTimespan = 10; // you read correctly..
consensus.nPowTargetSpacing = consensus.nPowTargetTimespan;
consensus.fPowAllowMinDifficultyBlocks = false;
consensus.fPowNoRetargeting = false;
consensus.nRuleChangeActivationThreshold = 1916; // 95% of 2016
consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
consensus.nRuleChangeActivationThreshold = 1916;
consensus.nMinerConfirmationWindow = 2016;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008
@@ -91,51 +85,40 @@ public:
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1510704000; // November 15th, 2017.
// The best chain should have at least this much work.
consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000051dc8b82f450202ecb3d471");
consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000000000000000000");
// By default assume that the signatures in ancestors of this block are valid.
consensus.defaultAssumeValid = uint256S("0x0000000000000000000f1c54590ee18d15ec70e68c8cd4cfbadb1b4f11697eee"); //563378
consensus.defaultAssumeValid = uint256S("0x0000000000000000000000000000000000000000000000000000000000000000");
/**
* The message start string is designed to be unlikely to occur in normal data.
* The characters are rarely used upper ASCII, not valid as UTF-8, and produce
* a large 32-bit integer with any alignment.
*/
pchMessageStart[0] = 0xf9;
pchMessageStart[0] = 0x1f;
pchMessageStart[1] = 0xbe;
pchMessageStart[2] = 0xb4;
pchMessageStart[3] = 0xd9;
nDefaultPort = 8333;
pchMessageStart[2] = 0xef;
pchMessageStart[3] = 0xf1;
nDefaultPort = 55555;
nPruneAfterHeight = 100000;
m_assumed_blockchain_size = 240;
m_assumed_chain_state_size = 3;
genesis = CreateGenesisBlock(1231006505, 2083236893, 0x1d00ffff, 1, 50 * COIN);
genesis = CreateGenesisBlock(1559208000, 427, 0x1f7ffff0, 1, 0 * COIN);
consensus.hashGenesisBlock = genesis.GetHash();
assert(consensus.hashGenesisBlock == uint256S("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"));
assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
assert(consensus.hashGenesisBlock == uint256S("0x9aa6888178b34fa8895f471e96f3e13b4bd3aabdb9a19e6e773f91c6c34bc63c"));
assert(genesis.hashMerkleRoot == uint256S("0xdfd0e8579d4f22ce8fb4a7c2e372469d027e2a4954b6a3ef302c698052bdae1f"));
// Note that of those which support the service bits prefix, most only support a subset of
// possible options.
// This is fine at runtime as we'll fall back to using them as a oneshot if they don't support the
// service bits we want, but we should get them updated to support all service bits wanted by any
// release ASAP to avoid it where possible.
vSeeds.emplace_back("seed.bitcoin.sipa.be"); // Pieter Wuille, only supports x1, x5, x9, and xd
vSeeds.emplace_back("dnsseed.bluematt.me"); // Matt Corallo, only supports x9
vSeeds.emplace_back("dnsseed.bitcoin.dashjr.org"); // Luke Dashjr
vSeeds.emplace_back("seed.bitcoinstats.com"); // Christian Decker, supports x1 - xf
vSeeds.emplace_back("seed.bitcoin.jonasschnelli.ch"); // Jonas Schnelli, only supports x1, x5, x9, and xd
vSeeds.emplace_back("seed.btc.petertodd.org"); // Peter Todd, only supports x1, x5, x9, and xd
vSeeds.emplace_back("seed.bitcoin.sprovoost.nl"); // Sjors Provoost
vSeeds.emplace_back("dnsseed.emzy.de"); // Stephan Oeste
// vSeeds.emplace_back("");
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,0);
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,53);
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5);
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,128);
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,181);
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E};
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4};
bech32_hrp = "bc";
bech32_hrp = "ny";
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
@@ -145,31 +128,18 @@ public:
checkpointData = {
{
{ 11111, uint256S("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")},
{ 33333, uint256S("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6")},
{ 74000, uint256S("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")},
{105000, uint256S("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")},
{134444, uint256S("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe")},
{168000, uint256S("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763")},
{193000, uint256S("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317")},
{210000, uint256S("0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e")},
{216116, uint256S("0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e")},
{225430, uint256S("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932")},
{250000, uint256S("0x000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214")},
{279000, uint256S("0x0000000000000001ae8c72a0b0c301f67e3afca10e819efa9041e458e9bd7e40")},
{295000, uint256S("0x00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983")},
{ 0, consensus.hashGenesisBlock }
}
};
chainTxData = ChainTxData{
// Data from rpc: getchaintxstats 4096 0000000000000000000f1c54590ee18d15ec70e68c8cd4cfbadb1b4f11697eee
/* nTime */ 1550374134,
/* nTxCount */ 383732546,
/* dTxRate */ 3.685496590998308
/* nTime */ 1559208000,
/* nTxCount */ 1,
/* dTxRate */ 1,
};
/* disable fallback fee on mainnet */
m_fallback_fee_enabled = false;
m_fallback_fee_enabled = true;
}
};
@@ -180,91 +150,6 @@ class CTestNetParams : public CChainParams {
public:
CTestNetParams() {
strNetworkID = "test";
consensus.nSubsidyHalvingInterval = 210000;
consensus.BIP16Exception = uint256S("0x00000000dd30457c001f4095d208cc1296b0eed002427aa599874af7a432b105");
consensus.BIP34Height = 21111;
consensus.BIP34Hash = uint256S("0x0000000023b3a96d3484e5abb3755c413e7d41500f8e2a5c3f0dd01299cd8ef8");
consensus.BIP65Height = 581885; // 00000000007f6655f22f98e72ed80d8b06dc761d5da09df0fa1dc4be4f861eb6
consensus.BIP66Height = 330776; // 000000002104c8c45e99a8853285a3b592602a3ccde2b832481da85e9e4ba182
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
consensus.nPowTargetSpacing = 10 * 60;
consensus.fPowAllowMinDifficultyBlocks = true;
consensus.fPowNoRetargeting = false;
consensus.nRuleChangeActivationThreshold = 1512; // 75% for testchains
consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008
// Deployment of BIP68, BIP112, and BIP113.
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1456790400; // March 1st, 2016
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1493596800; // May 1st, 2017
// Deployment of SegWit (BIP141, BIP143, and BIP147)
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1;
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1462060800; // May 1st 2016
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1493596800; // May 1st 2017
// The best chain should have at least this much work.
consensus.nMinimumChainWork = uint256S("0x00000000000000000000000000000000000000000000007dbe94253893cbd463");
// By default assume that the signatures in ancestors of this block are valid.
consensus.defaultAssumeValid = uint256S("0x0000000000000037a8cd3e06cd5edbfe9dd1dbcc5dacab279376ef7cfc2b4c75"); //1354312
pchMessageStart[0] = 0x0b;
pchMessageStart[1] = 0x11;
pchMessageStart[2] = 0x09;
pchMessageStart[3] = 0x07;
nDefaultPort = 18333;
nPruneAfterHeight = 1000;
m_assumed_blockchain_size = 30;
m_assumed_chain_state_size = 2;
genesis = CreateGenesisBlock(1296688602, 414098458, 0x1d00ffff, 1, 50 * COIN);
consensus.hashGenesisBlock = genesis.GetHash();
assert(consensus.hashGenesisBlock == uint256S("0x000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"));
assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
vFixedSeeds.clear();
vSeeds.clear();
// nodes with support for servicebits filtering should be at the top
vSeeds.emplace_back("testnet-seed.bitcoin.jonasschnelli.ch");
vSeeds.emplace_back("seed.tbtc.petertodd.org");
vSeeds.emplace_back("seed.testnet.bitcoin.sprovoost.nl");
vSeeds.emplace_back("testnet-seed.bluematt.me"); // Just a static list of stable node(s), only supports x9
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239);
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
bech32_hrp = "tb";
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));
fDefaultConsistencyChecks = false;
fRequireStandard = false;
fMineBlocksOnDemand = false;
checkpointData = {
{
{546, uint256S("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")},
}
};
chainTxData = ChainTxData{
// Data from rpc: getchaintxstats 4096 0000000000000037a8cd3e06cd5edbfe9dd1dbcc5dacab279376ef7cfc2b4c75
/* nTime */ 1531929919,
/* nTxCount */ 19438708,
/* dTxRate */ 0.626
};
/* enable fallback fee on testnet */
m_fallback_fee_enabled = true;
}
};
@@ -275,80 +160,7 @@ class CRegTestParams : public CChainParams {
public:
explicit CRegTestParams(const ArgsManager& args) {
strNetworkID = "regtest";
consensus.nSubsidyHalvingInterval = 150;
consensus.BIP16Exception = uint256();
consensus.BIP34Height = 500; // BIP34 activated on regtest (Used in functional tests)
consensus.BIP34Hash = uint256();
consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in functional tests)
consensus.BIP66Height = 1251; // BIP66 activated on regtest (Used in functional tests)
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
consensus.nPowTargetSpacing = 10 * 60;
consensus.fPowAllowMinDifficultyBlocks = true;
consensus.fPowNoRetargeting = true;
consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016)
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1;
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = Consensus::BIP9Deployment::ALWAYS_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
// The best chain should have at least this much work.
consensus.nMinimumChainWork = uint256S("0x00");
// By default assume that the signatures in ancestors of this block are valid.
consensus.defaultAssumeValid = uint256S("0x00");
pchMessageStart[0] = 0xfa;
pchMessageStart[1] = 0xbf;
pchMessageStart[2] = 0xb5;
pchMessageStart[3] = 0xda;
nDefaultPort = 18444;
nPruneAfterHeight = 1000;
m_assumed_blockchain_size = 0;
m_assumed_chain_state_size = 0;
UpdateVersionBitsParametersFromArgs(args);
genesis = CreateGenesisBlock(1296688602, 2, 0x207fffff, 1, 50 * COIN);
consensus.hashGenesisBlock = genesis.GetHash();
assert(consensus.hashGenesisBlock == uint256S("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"));
assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.
vSeeds.clear(); //!< Regtest mode doesn't have any DNS seeds.
fDefaultConsistencyChecks = true;
fRequireStandard = false;
fMineBlocksOnDemand = true;
checkpointData = {
{
{0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")},
}
};
chainTxData = ChainTxData{
0,
0,
0
};
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239);
base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};
bech32_hrp = "bcrt";
/* enable fallback fee on regtest */
m_fallback_fee_enabled = true;
}
/**
+2 -1279
View File
File diff suppressed because it is too large Load Diff
+11
View File
@@ -60,6 +60,17 @@ typedef unsigned int SOCKET;
#define SOCKET_ERROR -1
#endif
#ifndef WIN32
// PRIO_MAX is not defined on Solaris
#ifndef PRIO_MAX
#define PRIO_MAX 20
#endif
#define THREAD_PRIORITY_LOWEST PRIO_MAX
#define THREAD_PRIORITY_BELOW_NORMAL 2
#define THREAD_PRIORITY_NORMAL 0
#define THREAD_PRIORITY_ABOVE_NORMAL (-2)
#endif
#ifdef WIN32
#ifndef S_IRUSR
#define S_IRUSR 0400
-10
View File
@@ -48,16 +48,6 @@ struct BIP9Deployment {
*/
struct Params {
uint256 hashGenesisBlock;
int nSubsidyHalvingInterval;
/* Block hash that is excepted from BIP16 enforcement */
uint256 BIP16Exception;
/** Block height and hash at which BIP34 becomes active */
int BIP34Height;
uint256 BIP34Hash;
/** Block height at which BIP65 becomes active */
int BIP65Height;
/** Block height at which BIP66 becomes active */
int BIP66Height;
/**
* Minimum blocks including miner confirmation of the total of 2016 blocks in a retargeting period,
* (nPowTargetTimespan / nPowTargetSpacing) which is also used for BIP9 deployments.
+58
View File
@@ -0,0 +1,58 @@
// James Nobis <frt AT quelrod DOT net>
// http://www.freerainbowtables.com/phpBB3/topic2465.html
// "Feel free to consider this file to be in the public domain with no (C) attribution necessary."
#ifndef ARCHITECTURE_H
#define ARCHITECTURE_H
#if defined (__GLIBC__)
#include <endian.h>
#if (__BYTE_ORDER == __LITTLE_ENDIAN)
#define ARC_LITTLE_ENDIAN
#elif (__BYTE_ORDER == __BIG_ENDIAN)
#define ARC_BIG_ENDIAN
#else
#error "Unknown machine endianness"
#endif
#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
#define ARC_BIG_ENDIAN
#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
#define ARC_LITTLE_ENDIAN
#elif defined(__sparc) || defined(__sparc__) || \
defined(_POWER) || defined(__powerpc__) || \
defined(__ppc__) || defined(__hpux) || \
defined(_MIPSEB) || defined(_POWER) || \
defined(__s390__)
#define ARC_BIG_ENDIAN
#elif defined(__i386__) || defined(__alpha__) || \
defined(__ia64) || defined(__ia64__) || \
defined(_M_IX86) || defined(_M_IA64) || \
defined(_M_ALPHA) || defined(__amd64) || \
defined(__amd64__) || defined(_M_AMD64) || \
defined(__x86_64) || defined(__x86_64__) || \
defined(_M_X64)
#define ARC_LITTLE_ENDIAN
#else
#error "Unknown machine endianness"
#endif
#if defined(_M_X64) || defined(__x86_64__)
#define ARC_x86_64
#define ARC_x86
#elif defined(_M_IX86) || defined(__i386__)
#define ARC_x86_32
#define ARC_x86
#endif
#if defined(_LP64) || defined(__LP64__) || \
defined(__ia64) || defined(__ia64__) || \
defined(_M_IA64) || defined(__amd64) || \
defined(__amd64__) || defined(_M_AMD64) || \
defined(__x86_64) || defined(__x86_64__) || \
defined(_M_X64) || defined(_WIN64)
#define ARC_64
#else
#define ARC_32
#endif
#endif
+80
View File
@@ -0,0 +1,80 @@
// Copyright (c) 2014 Steve Thomas <steve AT tobtu DOT com>
#ifndef COMMON_H
#define COMMON_H
#include "architecture.h"
#include <stdio.h>
#ifdef _WIN32
#pragma warning(disable:4996)
#endif
#define __STDC_CONSTANT_MACROS
#define __STDC_LIMIT_MACROS
#ifdef _WIN32
#include "inttypes.h"
#include <time.h>
#include <windows.h>
typedef LARGE_INTEGER TIMER_TYPE;
#define TIMER_FUNC(t) QueryPerformanceCounter(&t)
inline double TIMER_DIFF(LARGE_INTEGER s, LARGE_INTEGER e)
{
LARGE_INTEGER f;
QueryPerformanceFrequency(&f);
return ((double) (e.QuadPart - s.QuadPart)) / f.QuadPart;
}
#else
#include <inttypes.h>
#include <sys/time.h>
#include <unistd.h>
#define TIMER_TYPE timeval
#define TIMER_FUNC(t) gettimeofday(&t, NULL)
#define TIMER_DIFF(s,e) ((e.tv_sec - s.tv_sec) + (e.tv_usec - s.tv_usec) / (double)1000000.0)
#endif
#define SWAP_ENDIAN_32_(x) \
( \
((x) << 24) | \
(((x) << 8) & 0x00ff0000) | \
(((x) >> 8) & 0x0000ff00) | \
((x) >> 24) \
)
#define SWAP_ENDIAN_32(x) SWAP_ENDIAN_32_(((uint32_t) (x)))
#define SWAP_ENDIAN_64_(x) \
( \
((x) << 56) | \
(((x) << 40) & UINT64_C(0x00ff000000000000)) | \
(((x) << 24) & UINT64_C(0x0000ff0000000000)) | \
(((x) << 8) & UINT64_C(0x000000ff00000000)) | \
(((x) >> 8) & UINT64_C(0x00000000ff000000)) | \
(((x) >> 24) & UINT64_C(0x0000000000ff0000)) | \
(((x) >> 40) & UINT64_C(0x000000000000ff00)) | \
((x) >> 56) \
)
#define SWAP_ENDIAN_64(x) SWAP_ENDIAN_64_(((uint64_t) (x)))
#ifdef ARC_LITTLE_ENDIAN
#define READ_LITTLE_ENDIAN_32(n) (n)
#define READ_BIG_ENDIAN_32(n) SWAP_ENDIAN_32(n)
#define WRITE_LITTLE_ENDIAN_32(n) (n)
#define WRITE_BIG_ENDIAN_32(n) SWAP_ENDIAN_32(n)
#define READ_LITTLE_ENDIAN_64(n) (n)
#define READ_BIG_ENDIAN_64(n) SWAP_ENDIAN_64(n)
#define WRITE_LITTLE_ENDIAN_64(n) (n)
#define WRITE_BIG_ENDIAN_64(n) SWAP_ENDIAN_64(n)
#else
#define READ_LITTLE_ENDIAN_32(n) SWAP_ENDIAN_32(n)
#define READ_BIG_ENDIAN_32(n) (n)
#define WRITE_LITTLE_ENDIAN_32(n) SWAP_ENDIAN_32(n)
#define WRITE_BIG_ENDIAN_32(n) (n)
#define READ_LITTLE_ENDIAN_64(n) SWAP_ENDIAN_64(n)
#define READ_BIG_ENDIAN_64(n) (n)
#define WRITE_LITTLE_ENDIAN_64(n) SWAP_ENDIAN_64(n)
#define WRITE_BIG_ENDIAN_64(n) (n)
#endif
#endif
+147
View File
@@ -0,0 +1,147 @@
// Copyright (c) 2014 Steve Thomas <steve AT tobtu DOT com>
#include <assert.h>
#include <string.h>
#include "parallel.h"
#include "sha512.h"
#define HASH_LENGTH Sha512::HASH_LENGTH
inline uint64_t calcLoopCount(uint32_t cost)
{
// floor((cost & 1 ? 2 : 3) * 2 ** floor((cost - 1) / 2))
// 1, 2, 3, 4, 6, 8, 12, 16, ...
if (cost == 0)
{
return 1;
}
return ((uint64_t) ((cost & 1) ^ 3)) << ((cost - 1) >> 1);
}
int PHS(void *out, size_t outlen, const void *in, size_t inlen, const void *salt, size_t saltlen, unsigned int t_cost, unsigned int m_cost)
{
uint64_t key [HASH_LENGTH / sizeof(uint64_t)];
uint64_t tmp [HASH_LENGTH / sizeof(uint64_t)];
uint64_t work[HASH_LENGTH / sizeof(uint64_t)];
uint64_t parallelLoops;
uint64_t sequentialLoops;
Sha512 sha512;
if ((t_cost & 0xffff) > 106 || (t_cost >> 16) > 126 || outlen > HASH_LENGTH)
{
memset(out, 0, outlen);
return 1;
}
// key = hash(hash(salt) || in)
Sha512::hash(salt, saltlen, key);
sha512.init();
sha512.update(key, HASH_LENGTH);
sha512.update(in, inlen);
sha512.finish(key);
// Work
parallelLoops = 3 * 5 * 128 * calcLoopCount(t_cost & 0xffff);
sequentialLoops = calcLoopCount(t_cost >> 16);
for (uint64_t i = 0; i < sequentialLoops; i++)
{
// Clear work
memset(work, 0, HASH_LENGTH);
for (uint64_t j = 0; j < parallelLoops; j++)
{
// work ^= hash(WRITE_BIG_ENDIAN_64(j) || key)
uint64_t tmpJ = WRITE_BIG_ENDIAN_64(j);
sha512.init();
sha512.update(&tmpJ, sizeof(tmpJ));
sha512.update(key, HASH_LENGTH);
sha512.finish(tmp);
for (unsigned int k = 0; k < HASH_LENGTH / sizeof(uint64_t); k++)
{
work[k] ^= tmp[k];
}
}
// Finish
// key = truncate(hash(hash(work || key)), outlen) || zeros(HASH_LENGTH - outlen)
sha512.init();
sha512.update(work, HASH_LENGTH);
sha512.update(key, HASH_LENGTH);
sha512.finish(key);
Sha512::hash(key, HASH_LENGTH, key, outlen);
memset(((uint8_t*) key) + outlen, 0, HASH_LENGTH - outlen);
}
// Finish
// out = key
memcpy(out, key, outlen);
// Clean up
// TODO: find a secure wipe function
memset(key, 0, sizeof(key));
memset(work, 0, sizeof(key));
memset(tmp, 0, sizeof(key));
return 0;
}
int parallelKdf(void *out, size_t outlen, const void *in, size_t inlen, const void *salt, size_t saltlen, unsigned int t_cost, unsigned int m_cost)
{
uint64_t key [HASH_LENGTH / sizeof(uint64_t)];
uint64_t tmp [HASH_LENGTH / sizeof(uint64_t)];
uint64_t work[HASH_LENGTH / sizeof(uint64_t)] = {0};
uint64_t parallelLoops;
Sha512 sha512;
if (t_cost > 106 || outlen > HASH_LENGTH)
{
memset(out, 0, outlen);
return 1;
}
// key = hash(hash(salt) || in)
Sha512::hash(salt, saltlen, key);
sha512.init();
sha512.update(key, HASH_LENGTH);
sha512.update(in, inlen);
sha512.finish(key);
// Work
parallelLoops = 3 * 5 * 128 * calcLoopCount(t_cost & 0xffff);
for (uint64_t i = 0; i < parallelLoops; i++)
{
// work ^= SHA512(WRITE_BIG_ENDIAN_64(i) || key)
uint64_t tmpI = WRITE_BIG_ENDIAN_64(i);
sha512.init();
sha512.update(&tmpI, sizeof(tmpI));
sha512.update(key, HASH_LENGTH);
sha512.finish(tmp);
for (unsigned int j = 0; j < HASH_LENGTH / sizeof(uint64_t); j++)
{
work[j] ^= tmp[j];
}
}
// Finish
for (int32_t i = 0, left = (int32_t) outlen; left > 0; left -= HASH_LENGTH, i++)
{
uint64_t tmpI = WRITE_BIG_ENDIAN_64(i);
// out = out || hash(WRITE_BIG_ENDIAN_64(i) || work || in)
sha512.init();
sha512.update(&tmpI, sizeof(tmpI));
sha512.update(work, HASH_LENGTH);
sha512.update(in, inlen);
sha512.finish(out, outlen);
out = ((uint8_t*) out) + HASH_LENGTH;
}
// Clean up
// TODO: find a secure wipe function
memset(key, 0, sizeof(key));
memset(work, 0, sizeof(key));
memset(tmp, 0, sizeof(key));
return 0;
}
+10
View File
@@ -0,0 +1,10 @@
// Copyright (c) 2014 Steve Thomas <steve AT tobtu DOT com>
#ifndef BATTCRYPT_H
#define BATTCRYPT_H
#include "common.h"
int PHS(void *out, size_t outlen, const void *in, size_t inlen, const void *salt, size_t saltlen, unsigned int t_cost, unsigned int m_cost);
#endif
+203
View File
@@ -0,0 +1,203 @@
// Copyright (c) 2014 Steve Thomas <steve AT tobtu DOT com>
#include <string.h>
#include "sha512.h"
const uint64_t SHA512_CONSTS[80] = {
UINT64_C(0x428a2f98d728ae22), UINT64_C(0x7137449123ef65cd), UINT64_C(0xb5c0fbcfec4d3b2f), UINT64_C(0xe9b5dba58189dbbc), UINT64_C(0x3956c25bf348b538),
UINT64_C(0x59f111f1b605d019), UINT64_C(0x923f82a4af194f9b), UINT64_C(0xab1c5ed5da6d8118), UINT64_C(0xd807aa98a3030242), UINT64_C(0x12835b0145706fbe),
UINT64_C(0x243185be4ee4b28c), UINT64_C(0x550c7dc3d5ffb4e2), UINT64_C(0x72be5d74f27b896f), UINT64_C(0x80deb1fe3b1696b1), UINT64_C(0x9bdc06a725c71235),
UINT64_C(0xc19bf174cf692694), UINT64_C(0xe49b69c19ef14ad2), UINT64_C(0xefbe4786384f25e3), UINT64_C(0x0fc19dc68b8cd5b5), UINT64_C(0x240ca1cc77ac9c65),
UINT64_C(0x2de92c6f592b0275), UINT64_C(0x4a7484aa6ea6e483), UINT64_C(0x5cb0a9dcbd41fbd4), UINT64_C(0x76f988da831153b5), UINT64_C(0x983e5152ee66dfab),
UINT64_C(0xa831c66d2db43210), UINT64_C(0xb00327c898fb213f), UINT64_C(0xbf597fc7beef0ee4), UINT64_C(0xc6e00bf33da88fc2), UINT64_C(0xd5a79147930aa725),
UINT64_C(0x06ca6351e003826f), UINT64_C(0x142929670a0e6e70), UINT64_C(0x27b70a8546d22ffc), UINT64_C(0x2e1b21385c26c926), UINT64_C(0x4d2c6dfc5ac42aed),
UINT64_C(0x53380d139d95b3df), UINT64_C(0x650a73548baf63de), UINT64_C(0x766a0abb3c77b2a8), UINT64_C(0x81c2c92e47edaee6), UINT64_C(0x92722c851482353b),
UINT64_C(0xa2bfe8a14cf10364), UINT64_C(0xa81a664bbc423001), UINT64_C(0xc24b8b70d0f89791), UINT64_C(0xc76c51a30654be30), UINT64_C(0xd192e819d6ef5218),
UINT64_C(0xd69906245565a910), UINT64_C(0xf40e35855771202a), UINT64_C(0x106aa07032bbd1b8), UINT64_C(0x19a4c116b8d2d0c8), UINT64_C(0x1e376c085141ab53),
UINT64_C(0x2748774cdf8eeb99), UINT64_C(0x34b0bcb5e19b48a8), UINT64_C(0x391c0cb3c5c95a63), UINT64_C(0x4ed8aa4ae3418acb), UINT64_C(0x5b9cca4f7763e373),
UINT64_C(0x682e6ff3d6b2b8a3), UINT64_C(0x748f82ee5defb2fc), UINT64_C(0x78a5636f43172f60), UINT64_C(0x84c87814a1f0ab72), UINT64_C(0x8cc702081a6439ec),
UINT64_C(0x90befffa23631e28), UINT64_C(0xa4506cebde82bde9), UINT64_C(0xbef9a3f7b2c67915), UINT64_C(0xc67178f2e372532b), UINT64_C(0xca273eceea26619c),
UINT64_C(0xd186b8c721c0c207), UINT64_C(0xeada7dd6cde0eb1e), UINT64_C(0xf57d4f7fee6ed178), UINT64_C(0x06f067aa72176fba), UINT64_C(0x0a637dc5a2c898a6),
UINT64_C(0x113f9804bef90dae), UINT64_C(0x1b710b35131c471b), UINT64_C(0x28db77f523047d84), UINT64_C(0x32caab7b40c72493), UINT64_C(0x3c9ebe0a15c9bebc),
UINT64_C(0x431d67c49c100d4c), UINT64_C(0x4cc5d4becb3e42b6), UINT64_C(0x597f299cfc657e2a), UINT64_C(0x5fcb6fab3ad6faec), UINT64_C(0x6c44198c4a475817)};
void sha512Block(const uint64_t block[16], uint64_t state[8]);
void Sha512::hash(const void *message, size_t length, void *out, uint32_t outLength)
{
uint64_t block[16];
uint64_t state[8] = {
UINT64_C(0x6a09e667f3bcc908), UINT64_C(0xbb67ae8584caa73b), UINT64_C(0x3c6ef372fe94f82b), UINT64_C(0xa54ff53a5f1d36f1),
UINT64_C(0x510e527fade682d1), UINT64_C(0x9b05688c2b3e6c1f), UINT64_C(0x1f83d9abfb41bd6b), UINT64_C(0x5be0cd19137e2179)};
size_t left = length;
while (left >= 128)
{
sha512Block((const uint64_t*) message, state);
message = ((const uint64_t*) message) + 16;
left -= 128;
}
memcpy(block, message, left);
((uint8_t*) block)[left] = 0x80;
memset(((uint8_t*) block) + (left + 1), 0, 128 - (left + 1));
if (left >= 128 - 16)
{
sha512Block(block, state);
for (uint32_t i = 0; i < 14; i++)
{
block[i] = 0;
}
}
uint64_t tmp;
tmp = ((uint64_t) length) >> (64 - 3);
block[14] = WRITE_BIG_ENDIAN_64(tmp);
tmp = ((uint64_t) length) << 3;
block[15] = WRITE_BIG_ENDIAN_64(tmp);
sha512Block(block, state);
if (outLength > 64)
{
outLength = 64;
}
for (uint32_t i = 0, end = outLength / 8; i < end; i++)
{
((uint64_t*) out)[i] = WRITE_BIG_ENDIAN_64(state[i]);
}
for (uint32_t i = outLength & ~7, shift = 56; i < outLength; i++, shift -= 8)
{
((uint8_t*) out)[i] = (uint8_t) (state[i / 8] >> shift);
}
}
void Sha512::init()
{
m_messageLengthHi = 0;
m_messageLengthLo = 0;
m_state[0] = UINT64_C(0x6a09e667f3bcc908);
m_state[1] = UINT64_C(0xbb67ae8584caa73b);
m_state[2] = UINT64_C(0x3c6ef372fe94f82b);
m_state[3] = UINT64_C(0xa54ff53a5f1d36f1);
m_state[4] = UINT64_C(0x510e527fade682d1);
m_state[5] = UINT64_C(0x9b05688c2b3e6c1f);
m_state[6] = UINT64_C(0x1f83d9abfb41bd6b);
m_state[7] = UINT64_C(0x5be0cd19137e2179);
}
void Sha512::update(const void *message, size_t length)
{
size_t pos = (size_t) m_messageLengthLo & 127;
size_t left = length;
if (pos + left >= 128)
{
memcpy(((uint8_t*) m_block) + pos, message, 128 - pos);
sha512Block(m_block, m_state);
message = ((const uint8_t*) message) + 128 - pos;
left -= 128 - pos;
while (left >= 128)
{
sha512Block(((const uint64_t*) message), m_state);
message = ((const uint8_t*) message) + 128;
left -= 128;
}
memcpy(m_block, message, left);
}
else
{
memcpy(((uint8_t*) m_block) + pos, message, left);
}
m_messageLengthLo += length;
if (m_messageLengthLo < length)
{
m_messageLengthHi++;
}
}
void Sha512::finish(void *out, uint32_t outLength)
{
uint64_t lengthHi = m_messageLengthHi;
uint64_t lengthLo = m_messageLengthLo;
((uint8_t*) m_block)[lengthLo % 128] = 0x80;
memset(((uint8_t*) m_block) + (lengthLo % 128 + 1), 0, 128 - (lengthLo % 128 + 1));
if (lengthLo % 128 >= 128 - 16)
{
sha512Block(m_block, m_state);
for (uint32_t i = 0; i < 15; i++)
{
m_block[i] = 0;
}
}
lengthHi = (lengthHi << 3) + (lengthLo >> (64 - 3));
lengthLo *= 8;
m_block[14] = WRITE_BIG_ENDIAN_64(lengthHi);
m_block[15] = WRITE_BIG_ENDIAN_64(lengthLo);
sha512Block(m_block, m_state);
if (outLength > 64)
{
outLength = 64;
}
for (uint32_t i = 0, end = outLength / 8; i < end; i++)
{
((uint64_t*) out)[i] = WRITE_BIG_ENDIAN_64(m_state[i]);
}
for (uint32_t i = outLength & ~7, shift = 56; i < outLength; i++, shift -= 8)
{
((uint8_t*) out)[i] = (uint8_t) (m_state[i / 8] >> shift);
}
}
void sha512Block(const uint64_t block[16], uint64_t state[8])
{
#define ROTR(n,s) ((n >> s) | (n << (64 - s)))
#define SHA512_STEP(a,b,c,d,e,f,g,h,w,i) \
h += (ROTR(e, 14) ^ ROTR(e, 18) ^ ROTR(e, 41)) + ((e & f) ^ (~e & g)) + SHA512_CONSTS[i] + w[i]; \
d += h; \
h += (ROTR(a, 28) ^ ROTR(a, 34) ^ ROTR(a, 39)) + ((a & b) ^ (a & c) ^ (b & c));
uint64_t w[80];
uint64_t a = state[0];
uint64_t b = state[1];
uint64_t c = state[2];
uint64_t d = state[3];
uint64_t e = state[4];
uint64_t f = state[5];
uint64_t g = state[6];
uint64_t h = state[7];
for (int i = 0; i < 16; i++)
{
w[i] = READ_BIG_ENDIAN_64(block[i]);
}
for (int i = 16; i < 80; i++)
{
w[i] =
w[i-16] +
w[i- 7] +
(ROTR(w[i-15], 1) ^ ROTR(w[i-15], 8) ^ (w[i-15] >> 7)) +
(ROTR(w[i- 2], 19) ^ ROTR(w[i- 2], 61) ^ (w[i- 2] >> 6));
}
for (int i = 0; i < 80; i += 8)
{
SHA512_STEP(a,b,c,d,e,f,g,h,w,i+0);
SHA512_STEP(h,a,b,c,d,e,f,g,w,i+1);
SHA512_STEP(g,h,a,b,c,d,e,f,w,i+2);
SHA512_STEP(f,g,h,a,b,c,d,e,w,i+3);
SHA512_STEP(e,f,g,h,a,b,c,d,w,i+4);
SHA512_STEP(d,e,f,g,h,a,b,c,w,i+5);
SHA512_STEP(c,d,e,f,g,h,a,b,w,i+6);
SHA512_STEP(b,c,d,e,f,g,h,a,w,i+7);
}
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
state[4] += e;
state[5] += f;
state[6] += g;
state[7] += h;
#undef ROTR
#undef SHA512_STEP
}
+28
View File
@@ -0,0 +1,28 @@
// Copyright (c) 2014 Steve Thomas <steve AT tobtu DOT com>
#ifndef SHA512_H
#define SHA512_H
#include "common.h"
class Sha512
{
public:
Sha512() {}
~Sha512() {}
static const unsigned int HASH_LENGTH = 64;
static void hash(const void *message, size_t length, void *out, uint32_t outLength = 64);
void init();
void update(const void *message, size_t length);
void finish(void *out, uint32_t outLength = 64);
private:
uint64_t m_messageLengthHi;
uint64_t m_messageLengthLo;
uint64_t m_state[8];
uint64_t m_block[16];
};
#endif
+141
View File
@@ -0,0 +1,141 @@
/*
* Copyright 2009 Colin Percival, 2011 ArtForz, 2012-2013 pooler
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file was originally written by Colin Percival as part of the Tarsnap
* online backup system.
*/
#if defined(USE_SSE2)
#include <crypto/scrypt.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <openssl/sha.h>
#include <emmintrin.h>
static inline void xor_salsa8_sse2(__m128i B[4], const __m128i Bx[4])
{
__m128i X0, X1, X2, X3;
__m128i T;
int i;
X0 = B[0] = _mm_xor_si128(B[0], Bx[0]);
X1 = B[1] = _mm_xor_si128(B[1], Bx[1]);
X2 = B[2] = _mm_xor_si128(B[2], Bx[2]);
X3 = B[3] = _mm_xor_si128(B[3], Bx[3]);
for (i = 0; i < 8; i += 2) {
/* Operate on "columns". */
T = _mm_add_epi32(X0, X3);
X1 = _mm_xor_si128(X1, _mm_slli_epi32(T, 7));
X1 = _mm_xor_si128(X1, _mm_srli_epi32(T, 25));
T = _mm_add_epi32(X1, X0);
X2 = _mm_xor_si128(X2, _mm_slli_epi32(T, 9));
X2 = _mm_xor_si128(X2, _mm_srli_epi32(T, 23));
T = _mm_add_epi32(X2, X1);
X3 = _mm_xor_si128(X3, _mm_slli_epi32(T, 13));
X3 = _mm_xor_si128(X3, _mm_srli_epi32(T, 19));
T = _mm_add_epi32(X3, X2);
X0 = _mm_xor_si128(X0, _mm_slli_epi32(T, 18));
X0 = _mm_xor_si128(X0, _mm_srli_epi32(T, 14));
/* Rearrange data. */
X1 = _mm_shuffle_epi32(X1, 0x93);
X2 = _mm_shuffle_epi32(X2, 0x4E);
X3 = _mm_shuffle_epi32(X3, 0x39);
/* Operate on "rows". */
T = _mm_add_epi32(X0, X1);
X3 = _mm_xor_si128(X3, _mm_slli_epi32(T, 7));
X3 = _mm_xor_si128(X3, _mm_srli_epi32(T, 25));
T = _mm_add_epi32(X3, X0);
X2 = _mm_xor_si128(X2, _mm_slli_epi32(T, 9));
X2 = _mm_xor_si128(X2, _mm_srli_epi32(T, 23));
T = _mm_add_epi32(X2, X3);
X1 = _mm_xor_si128(X1, _mm_slli_epi32(T, 13));
X1 = _mm_xor_si128(X1, _mm_srli_epi32(T, 19));
T = _mm_add_epi32(X1, X2);
X0 = _mm_xor_si128(X0, _mm_slli_epi32(T, 18));
X0 = _mm_xor_si128(X0, _mm_srli_epi32(T, 14));
/* Rearrange data. */
X1 = _mm_shuffle_epi32(X1, 0x39);
X2 = _mm_shuffle_epi32(X2, 0x4E);
X3 = _mm_shuffle_epi32(X3, 0x93);
}
B[0] = _mm_add_epi32(B[0], X0);
B[1] = _mm_add_epi32(B[1], X1);
B[2] = _mm_add_epi32(B[2], X2);
B[3] = _mm_add_epi32(B[3], X3);
}
void scrypt_1024_1_1_256_sp_sse2(const char *input, char *output, char *scratchpad)
{
uint8_t B[128];
union {
__m128i i128[8];
uint32_t u32[32];
} X;
__m128i *V;
uint32_t i, j, k;
V = (__m128i *)(((uintptr_t)(scratchpad) + 63) & ~ (uintptr_t)(63));
PBKDF2_SHA256((const uint8_t *)input, 80, (const uint8_t *)input, 80, 1, B, 128);
for (k = 0; k < 2; k++) {
for (i = 0; i < 16; i++) {
X.u32[k * 16 + i] = le32dec(&B[(k * 16 + (i * 5 % 16)) * 4]);
}
}
for (i = 0; i < 1024; i++) {
for (k = 0; k < 8; k++)
V[i * 8 + k] = X.i128[k];
xor_salsa8_sse2(&X.i128[0], &X.i128[4]);
xor_salsa8_sse2(&X.i128[4], &X.i128[0]);
}
for (i = 0; i < 1024; i++) {
j = 8 * (X.u32[16] & 1023);
for (k = 0; k < 8; k++)
X.i128[k] = _mm_xor_si128(X.i128[k], V[j + k]);
xor_salsa8_sse2(&X.i128[0], &X.i128[4]);
xor_salsa8_sse2(&X.i128[4], &X.i128[0]);
}
for (k = 0; k < 2; k++) {
for (i = 0; i < 16; i++) {
le32enc(&B[(k * 16 + (i * 5 % 16)) * 4], X.u32[k * 16 + i]);
}
}
PBKDF2_SHA256((const uint8_t *)input, 80, B, 128, 1, (uint8_t *)output, 32);
}
#endif // USE_SSE2
+332
View File
@@ -0,0 +1,332 @@
/*
* Copyright 2009 Colin Percival, 2011 ArtForz, 2012-2013 pooler
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file was originally written by Colin Percival as part of the Tarsnap
* online backup system.
*/
#include <crypto/scrypt.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <openssl/sha.h>
#if defined(USE_SSE2) && !defined(USE_SSE2_ALWAYS)
#ifdef _MSC_VER
// MSVC 64bit is unable to use inline asm
#include <intrin.h>
#else
// GCC Linux or i686-w64-mingw32
#include <cpuid.h>
#endif
#endif
#ifndef __FreeBSD__
static inline uint32_t be32dec(const void *pp)
{
const uint8_t *p = (uint8_t const *)pp;
return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) +
((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24));
}
static inline void be32enc(void *pp, uint32_t x)
{
uint8_t *p = (uint8_t *)pp;
p[3] = x & 0xff;
p[2] = (x >> 8) & 0xff;
p[1] = (x >> 16) & 0xff;
p[0] = (x >> 24) & 0xff;
}
#endif
typedef struct HMAC_SHA256Context {
SHA256_CTX ictx;
SHA256_CTX octx;
} HMAC_SHA256_CTX;
/* Initialize an HMAC-SHA256 operation with the given key. */
static void
HMAC_SHA256_Init(HMAC_SHA256_CTX *ctx, const void *_K, size_t Klen)
{
unsigned char pad[64];
unsigned char khash[32];
const unsigned char *K = (const unsigned char *)_K;
size_t i;
/* If Klen > 64, the key is really SHA256(K). */
if (Klen > 64) {
SHA256_Init(&ctx->ictx);
SHA256_Update(&ctx->ictx, K, Klen);
SHA256_Final(khash, &ctx->ictx);
K = khash;
Klen = 32;
}
/* Inner SHA256 operation is SHA256(K xor [block of 0x36] || data). */
SHA256_Init(&ctx->ictx);
memset(pad, 0x36, 64);
for (i = 0; i < Klen; i++)
pad[i] ^= K[i];
SHA256_Update(&ctx->ictx, pad, 64);
/* Outer SHA256 operation is SHA256(K xor [block of 0x5c] || hash). */
SHA256_Init(&ctx->octx);
memset(pad, 0x5c, 64);
for (i = 0; i < Klen; i++)
pad[i] ^= K[i];
SHA256_Update(&ctx->octx, pad, 64);
/* Clean the stack. */
memset(khash, 0, 32);
}
/* Add bytes to the HMAC-SHA256 operation. */
static void
HMAC_SHA256_Update(HMAC_SHA256_CTX *ctx, const void *in, size_t len)
{
/* Feed data to the inner SHA256 operation. */
SHA256_Update(&ctx->ictx, in, len);
}
/* Finish an HMAC-SHA256 operation. */
static void
HMAC_SHA256_Final(unsigned char digest[32], HMAC_SHA256_CTX *ctx)
{
unsigned char ihash[32];
/* Finish the inner SHA256 operation. */
SHA256_Final(ihash, &ctx->ictx);
/* Feed the inner hash to the outer SHA256 operation. */
SHA256_Update(&ctx->octx, ihash, 32);
/* Finish the outer SHA256 operation. */
SHA256_Final(digest, &ctx->octx);
/* Clean the stack. */
memset(ihash, 0, 32);
}
/**
* PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen):
* Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and
* write the output to buf. The value dkLen must be at most 32 * (2^32 - 1).
*/
void
PBKDF2_SHA256(const uint8_t *passwd, size_t passwdlen, const uint8_t *salt,
size_t saltlen, uint64_t c, uint8_t *buf, size_t dkLen)
{
HMAC_SHA256_CTX PShctx, hctx;
size_t i;
uint8_t ivec[4];
uint8_t U[32];
uint8_t T[32];
uint64_t j;
int k;
size_t clen;
/* Compute HMAC state after processing P and S. */
HMAC_SHA256_Init(&PShctx, passwd, passwdlen);
HMAC_SHA256_Update(&PShctx, salt, saltlen);
/* Iterate through the blocks. */
for (i = 0; i * 32 < dkLen; i++) {
/* Generate INT(i + 1). */
be32enc(ivec, (uint32_t)(i + 1));
/* Compute U_1 = PRF(P, S || INT(i)). */
memcpy(&hctx, &PShctx, sizeof(HMAC_SHA256_CTX));
HMAC_SHA256_Update(&hctx, ivec, 4);
HMAC_SHA256_Final(U, &hctx);
/* T_i = U_1 ... */
memcpy(T, U, 32);
for (j = 2; j <= c; j++) {
/* Compute U_j. */
HMAC_SHA256_Init(&hctx, passwd, passwdlen);
HMAC_SHA256_Update(&hctx, U, 32);
HMAC_SHA256_Final(U, &hctx);
/* ... xor U_j ... */
for (k = 0; k < 32; k++)
T[k] ^= U[k];
}
/* Copy as many bytes as necessary into buf. */
clen = dkLen - i * 32;
if (clen > 32)
clen = 32;
memcpy(&buf[i * 32], T, clen);
}
/* Clean PShctx, since we never called _Final on it. */
memset(&PShctx, 0, sizeof(HMAC_SHA256_CTX));
}
#define ROTL(a, b) (((a) << (b)) | ((a) >> (32 - (b))))
static inline void xor_salsa8(uint32_t B[16], const uint32_t Bx[16])
{
uint32_t x00,x01,x02,x03,x04,x05,x06,x07,x08,x09,x10,x11,x12,x13,x14,x15;
int i;
x00 = (B[ 0] ^= Bx[ 0]);
x01 = (B[ 1] ^= Bx[ 1]);
x02 = (B[ 2] ^= Bx[ 2]);
x03 = (B[ 3] ^= Bx[ 3]);
x04 = (B[ 4] ^= Bx[ 4]);
x05 = (B[ 5] ^= Bx[ 5]);
x06 = (B[ 6] ^= Bx[ 6]);
x07 = (B[ 7] ^= Bx[ 7]);
x08 = (B[ 8] ^= Bx[ 8]);
x09 = (B[ 9] ^= Bx[ 9]);
x10 = (B[10] ^= Bx[10]);
x11 = (B[11] ^= Bx[11]);
x12 = (B[12] ^= Bx[12]);
x13 = (B[13] ^= Bx[13]);
x14 = (B[14] ^= Bx[14]);
x15 = (B[15] ^= Bx[15]);
for (i = 0; i < 8; i += 2) {
/* Operate on columns. */
x04 ^= ROTL(x00 + x12, 7); x09 ^= ROTL(x05 + x01, 7);
x14 ^= ROTL(x10 + x06, 7); x03 ^= ROTL(x15 + x11, 7);
x08 ^= ROTL(x04 + x00, 9); x13 ^= ROTL(x09 + x05, 9);
x02 ^= ROTL(x14 + x10, 9); x07 ^= ROTL(x03 + x15, 9);
x12 ^= ROTL(x08 + x04, 13); x01 ^= ROTL(x13 + x09, 13);
x06 ^= ROTL(x02 + x14, 13); x11 ^= ROTL(x07 + x03, 13);
x00 ^= ROTL(x12 + x08, 18); x05 ^= ROTL(x01 + x13, 18);
x10 ^= ROTL(x06 + x02, 18); x15 ^= ROTL(x11 + x07, 18);
/* Operate on rows. */
x01 ^= ROTL(x00 + x03, 7); x06 ^= ROTL(x05 + x04, 7);
x11 ^= ROTL(x10 + x09, 7); x12 ^= ROTL(x15 + x14, 7);
x02 ^= ROTL(x01 + x00, 9); x07 ^= ROTL(x06 + x05, 9);
x08 ^= ROTL(x11 + x10, 9); x13 ^= ROTL(x12 + x15, 9);
x03 ^= ROTL(x02 + x01, 13); x04 ^= ROTL(x07 + x06, 13);
x09 ^= ROTL(x08 + x11, 13); x14 ^= ROTL(x13 + x12, 13);
x00 ^= ROTL(x03 + x02, 18); x05 ^= ROTL(x04 + x07, 18);
x10 ^= ROTL(x09 + x08, 18); x15 ^= ROTL(x14 + x13, 18);
}
B[ 0] += x00;
B[ 1] += x01;
B[ 2] += x02;
B[ 3] += x03;
B[ 4] += x04;
B[ 5] += x05;
B[ 6] += x06;
B[ 7] += x07;
B[ 8] += x08;
B[ 9] += x09;
B[10] += x10;
B[11] += x11;
B[12] += x12;
B[13] += x13;
B[14] += x14;
B[15] += x15;
}
void scrypt_1024_1_1_256_sp_generic(const char *input, char *output, char *scratchpad)
{
uint8_t B[128];
uint32_t X[32];
uint32_t *V;
uint32_t i, j, k;
V = (uint32_t *)(((uintptr_t)(scratchpad) + 63) & ~ (uintptr_t)(63));
PBKDF2_SHA256((const uint8_t *)input, 80, (const uint8_t *)input, 80, 1, B, 128);
for (k = 0; k < 32; k++)
X[k] = le32dec(&B[4 * k]);
for (i = 0; i < 1024; i++) {
memcpy(&V[i * 32], X, 128);
xor_salsa8(&X[0], &X[16]);
xor_salsa8(&X[16], &X[0]);
}
for (i = 0; i < 1024; i++) {
j = 32 * (X[16] & 1023);
for (k = 0; k < 32; k++)
X[k] ^= V[j + k];
xor_salsa8(&X[0], &X[16]);
xor_salsa8(&X[16], &X[0]);
}
for (k = 0; k < 32; k++)
le32enc(&B[4 * k], X[k]);
PBKDF2_SHA256((const uint8_t *)input, 80, B, 128, 1, (uint8_t *)output, 32);
}
#if defined(USE_SSE2)
// By default, set to generic scrypt function. This will prevent crash in case when scrypt_detect_sse2() wasn't called
void (*scrypt_1024_1_1_256_sp_detected)(const char *input, char *output, char *scratchpad) = &scrypt_1024_1_1_256_sp_generic;
std::string scrypt_detect_sse2()
{
std::string ret;
#if defined(USE_SSE2_ALWAYS)
ret = "scrypt: using scrypt-sse2 as built.";
#else // USE_SSE2_ALWAYS
// 32bit x86 Linux or Windows, detect cpuid features
unsigned int cpuid_edx=0;
#if defined(_MSC_VER)
// MSVC
int x86cpuid[4];
__cpuid(x86cpuid, 1);
cpuid_edx = (unsigned int)buffer[3];
#else // _MSC_VER
// Linux or i686-w64-mingw32 (gcc-4.6.3)
unsigned int eax, ebx, ecx;
__get_cpuid(1, &eax, &ebx, &ecx, &cpuid_edx);
#endif // _MSC_VER
if (cpuid_edx & 1<<26)
{
scrypt_1024_1_1_256_sp_detected = &scrypt_1024_1_1_256_sp_sse2;
ret = "scrypt: using scrypt-sse2 as detected");
}
else
{
scrypt_1024_1_1_256_sp_detected = &scrypt_1024_1_1_256_sp_generic;
ret = "scrypt: using scrypt-generic, SSE2 unavailable";
}
#endif // USE_SSE2_ALWAYS
return ret;
}
#endif
void scrypt_1024_1_1_256(const char *input, char *output)
{
char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
scrypt_1024_1_1_256_sp(input, output, scratchpad);
}
+49
View File
@@ -0,0 +1,49 @@
#ifndef BITCOIN_CRYPTO_SCRYPT_H
#define BITCOIN_CRYPTO_SCRYPT_H
#include <stdlib.h>
#include <stdint.h>
static const int SCRYPT_SCRATCHPAD_SIZE = 131072 + 63;
void scrypt_1024_1_1_256(const char *input, char *output);
void scrypt_1024_1_1_256_sp_generic(const char *input, char *output, char *scratchpad);
#if defined(USE_SSE2)
#include <string>
#if defined(_M_X64) || defined(__x86_64__) || defined(_M_AMD64) || (defined(MAC_OSX) && defined(__i386__))
#define USE_SSE2_ALWAYS 1
#define scrypt_1024_1_1_256_sp(input, output, scratchpad) scrypt_1024_1_1_256_sp_sse2((input), (output), (scratchpad))
#else
#define scrypt_1024_1_1_256_sp(input, output, scratchpad) scrypt_1024_1_1_256_sp_detected((input), (output), (scratchpad))
#endif
std::string scrypt_detect_sse2();
void scrypt_1024_1_1_256_sp_sse2(const char *input, char *output, char *scratchpad);
extern void (*scrypt_1024_1_1_256_sp_detected)(const char *input, char *output, char *scratchpad);
#else
#define scrypt_1024_1_1_256_sp(input, output, scratchpad) scrypt_1024_1_1_256_sp_generic((input), (output), (scratchpad))
#endif
void
PBKDF2_SHA256(const uint8_t *passwd, size_t passwdlen, const uint8_t *salt,
size_t saltlen, uint64_t c, uint8_t *buf, size_t dkLen);
#ifndef __FreeBSD__
static inline uint32_t le32dec(const void *pp)
{
const uint8_t *p = (uint8_t const *)pp;
return ((uint32_t)(p[0]) + ((uint32_t)(p[1]) << 8) +
((uint32_t)(p[2]) << 16) + ((uint32_t)(p[3]) << 24));
}
static inline void le32enc(void *pp, uint32_t x)
{
uint8_t *p = (uint8_t *)pp;
p[0] = x & 0xff;
p[1] = (x >> 8) & 0xff;
p[2] = (x >> 16) & 0xff;
p[3] = (x >> 24) & 0xff;
}
#endif
#endif // BITCOIN_CRYPTO_SCRYPT_H
+1
View File
@@ -9,6 +9,7 @@
#include <crypto/common.h>
#include <crypto/ripemd160.h>
#include <crypto/sha256.h>
#include <crypto/parallel/parallel.h>
#include <prevector.h>
#include <serialize.h>
#include <uint256.h>
+9
View File
@@ -71,6 +71,10 @@
#include <zmq/zmqrpc.h>
#endif
#ifdef USE_SSE2
#include <crypto/scrypt.h>
#endif
bool fFeeEstimatesInitialized = false;
static const bool DEFAULT_PROXYRANDOMIZE = true;
static const bool DEFAULT_REST_ENABLE = false;
@@ -1313,6 +1317,11 @@ bool AppInitMain(InitInterfaces& interfaces)
if (!AppInitServers())
return InitError(_("Unable to start HTTP server. See debug log for details."));
}
#if defined(USE_SSE2)
std::string sse2detect = scrypt_detect_sse2();
LogPrintf("%s\n", sse2detect);
#endif
// ********************************************************* Step 5: verify wallet database integrity
for (const auto& client : interfaces.chain_clients) {
+170
View File
@@ -24,11 +24,14 @@
#include <util/moneystr.h>
#include <util/system.h>
#include <validationinterface.h>
#include <wallet/wallet.h>
#include <algorithm>
#include <queue>
#include <utility>
#include <boost/thread.hpp>
int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev)
{
int64_t nOldTime = pblock->nTime;
@@ -445,3 +448,170 @@ void IncrementExtraNonce(CBlock* pblock, const CBlockIndex* pindexPrev, unsigned
pblock->vtx[0] = MakeTransactionRef(std::move(txCoinbase));
pblock->hashMerkleRoot = BlockMerkleRoot(*pblock);
}
static bool ProcessBlockFound(const std::shared_ptr<const CBlock> &pblock, const CChainParams& chainparams)
{
LogPrintf("%s\n", pblock->ToString());
LogPrintf("generated %s\n", FormatMoney(pblock->vtx[0]->vout[0].nValue));
// Found a solution
{
LOCK(cs_main);
if (pblock->hashPrevBlock != chainActive.Tip()->GetBlockHash())
return error("ProcessBlockFound -- generated block is stale");
}
// Process this block the same as if we had received it from another node
if (!ProcessNewBlock(chainparams, pblock, true, nullptr))
return error("ProcessBlockFound -- ProcessNewBlock() failed, block not accepted");
return true;
}
void static NYC3Miner(const CChainParams& chainparams, CConnman& connman)
{
LogPrintf("NYC3miner -- started\n");
SetThreadPriority(THREAD_PRIORITY_LOWEST);
RenameThread("NYC3-miner");
std::vector<std::shared_ptr<CWallet>> wallets = GetWallets();
CWallet * const pwallet = (wallets.size() > 0) ? wallets[0].get() : nullptr;
if (!pwallet)
return;
unsigned int nExtraNonce = 0;
std::shared_ptr<CReserveScript> coinbaseScript;
pwallet->GetScriptForMining(coinbaseScript);
while (true)
{
try {
MilliSleep(1000);
// Throw an error if no script was provided. This can happen
// due to some internal error but also if the keypool is empty.
// In the latter case, already the pointer is NULL.
if (!coinbaseScript || coinbaseScript->reserveScript.empty())
throw std::runtime_error("No coinbase script available (mining requires a wallet)");
do {
bool fvNodesEmpty = connman.GetNodeCount(CConnman::CONNECTIONS_ALL) == 0;
if (!fvNodesEmpty && !IsInitialBlockDownload())
break;
MilliSleep(1000);
} while (true);
//
// Create new block
//
unsigned int nTransactionsUpdatedLast = mempool.GetTransactionsUpdated();
CBlockIndex* pindexPrev = chainActive.Tip();
if(!pindexPrev) break;
BlockAssembler assembler(chainparams);
auto pblocktemplate = assembler.CreateNewBlock(coinbaseScript->reserveScript);
auto pblock = std::make_shared<CBlock>(pblocktemplate->block);
IncrementExtraNonce(pblock.get(), pindexPrev, nExtraNonce);
LogPrintf("NYC3Miner -- Running miner with %u transactions in block (%u bytes)\n", pblock->vtx.size(),
::GetSerializeSize(*pblock, PROTOCOL_VERSION));
// check if block is valid
CValidationState state;
if (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, false)) {
throw std::runtime_error(strprintf("%s: TestBlockValidity failed: %s", __func__, FormatStateMessage(state)));
}
//
// Search
//
int64_t nStart = GetTime();
arith_uint256 hashTarget = arith_uint256().SetCompact(pblock->nBits);
while (true)
{
unsigned int nHashesDone = 0;
uint256 hash;
while (true)
{
hash = pblock->GetPoWHash();
if (UintToArith256(hash) <= hashTarget)
{
// Found a solution
SetThreadPriority(THREAD_PRIORITY_NORMAL);
LogPrintf("NYC3miner:\n proof-of-work found\n hash: %s\n target: %s\n", hash.GetHex(), hashTarget.GetHex());
ProcessBlockFound(pblock, chainparams);
SetThreadPriority(THREAD_PRIORITY_LOWEST);
coinbaseScript->KeepScript();
// In regression test mode, stop mining after a block is found. This
// allows developers to controllably generate a block on demand.
if (chainparams.MineBlocksOnDemand())
throw boost::thread_interrupted();
break;
}
pblock->nNonce += 1;
nHashesDone += 1;
if ((pblock->nNonce & 0xFF) == 0)
break;
}
// Check for stop or if block needs to be rebuilt
boost::this_thread::interruption_point();
// Regtest mode doesn't require peers
if (connman.GetNodeCount(CConnman::CONNECTIONS_ALL) == 0)
break;
if (pblock->nNonce >= 0xffff0000)
break;
if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 60)
break;
if (pindexPrev != chainActive.Tip())
break;
// Update nTime every few seconds
if (UpdateTime(pblock.get(), chainparams.GetConsensus(), pindexPrev) < 0)
break; // Recreate the block if the clock has run backwards,
// so that we can use the correct time.
if (chainparams.GetConsensus().fPowAllowMinDifficultyBlocks)
{
// Changing pblock->nTime can change work required on testnet:
hashTarget.SetCompact(pblock->nBits);
}
}
}
catch (const boost::thread_interrupted&)
{
LogPrintf("NYC3Miner -- terminated\n");
throw;
}
catch (const std::runtime_error &e)
{
LogPrintf("NYC3miner -- runtime error: %s\n", e.what());
}
}
}
void GenerateNYC3s(bool fGenerate, int nThreads, const CChainParams& chainparams, CConnman &connman)
{
static boost::thread_group* minerThreads = NULL;
if (nThreads < 0)
nThreads = GetNumCores();
if (minerThreads != NULL)
{
minerThreads->interrupt_all();
delete minerThreads;
minerThreads = NULL;
}
if (nThreads == 0 || !fGenerate)
return;
minerThreads = new boost::thread_group();
for (int i = 0; i < nThreads; i++)
minerThreads->create_thread(boost::bind(&NYC3Miner, boost::cref(chainparams), boost::ref(connman)));
}
+4
View File
@@ -20,6 +20,7 @@
class CBlockIndex;
class CChainParams;
class CScript;
class CWallet;
namespace Consensus { struct Params; };
@@ -202,4 +203,7 @@ private:
void IncrementExtraNonce(CBlock* pblock, const CBlockIndex* pindexPrev, unsigned int& nExtraNonce);
int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev);
/** Run the miner threads */
void GenerateNYC3s(bool fGenerate, int nThreads, const CChainParams& chainparams, CConnman &connman);
#endif // BITCOIN_MINER_H
+1 -1
View File
@@ -1696,7 +1696,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
return;
// Add seed nodes if DNS seeds are all down (an infrastructure attack?).
if (addrman.size() == 0 && (GetTime() - nStart > 60)) {
if (addrman.size() == 0 && (GetTime() - nStart > 2)) {
static bool done = false;
if (!done) {
LogPrintf("Adding fixed seed nodes as DNS doesn't seem to be available.\n");
View File
+45 -1
View File
@@ -10,7 +10,44 @@
#include <primitives/block.h>
#include <uint256.h>
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
// credit/rights go to zawy (https://github.com/zawy12) for this algorithm
unsigned int Lwma3CalculateNextWorkRequired(const CBlockIndex* pindexLast, const Consensus::Params& params)
{
const int64_t T = params.nPowTargetSpacing;
const int64_t N = 150;
const int64_t k = N * (N + 1) * T / 2;
const int64_t height = pindexLast->nHeight;
const arith_uint256 powLimit = UintToArith256(params.powLimit);
if (height < N) { return powLimit.GetCompact(); }
arith_uint256 sumTarget, nextTarget;
int64_t thisTimestamp, previousTimestamp;
int64_t t = 0, j = 0;
const CBlockIndex* blockPreviousTimestamp = pindexLast->GetAncestor(height - N);
previousTimestamp = blockPreviousTimestamp->GetBlockTime();
// Loop through N most recent blocks.
for (int64_t i = height - N + 1; i <= height; i++) {
const CBlockIndex* block = pindexLast->GetAncestor(i);
thisTimestamp = (block->GetBlockTime() > previousTimestamp) ?
block->GetBlockTime() : previousTimestamp + 1;
int64_t solvetime = std::min(6 * T, thisTimestamp - previousTimestamp);
previousTimestamp = thisTimestamp;
j++;
t += solvetime * j; // Weighted solvetime sum.
arith_uint256 target;
target.SetCompact(block->nBits);
sumTarget += target / (k * N);
}
nextTarget = t * sumTarget;
if (nextTarget > powLimit) { nextTarget = powLimit; }
return nextTarget.GetCompact();
}
unsigned int GetNextWorkBuffer(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
{
assert(pindexLast != nullptr);
unsigned int nProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact();
@@ -46,6 +83,13 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
return CalculateNextWorkRequired(pindexLast, pindexFirst->GetBlockTime(), params);
}
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
{
if (pindexLast->nHeight+1 <= 150)
return GetNextWorkBuffer(pindexLast, pblock, params);
return Lwma3CalculateNextWorkRequired(pindexLast, params);
}
unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime, const Consensus::Params& params)
{
if (params.fPowNoRetargeting)
+8
View File
@@ -9,12 +9,20 @@
#include <tinyformat.h>
#include <util/strencodings.h>
#include <crypto/common.h>
#include <crypto/scrypt.h>
uint256 CBlockHeader::GetHash() const
{
return SerializeHash(*this);
}
uint256 CBlockHeader::GetPoWHash() const
{
uint256 thash;
PHS((void*)BEGIN(thash),32,(void*)BEGIN(nVersion),80,(void*)BEGIN(nVersion),80,4,4);
return thash;
}
std::string CBlock::ToString() const
{
std::stringstream s;
+2
View File
@@ -62,6 +62,8 @@ public:
uint256 GetHash() const;
uint256 GetPoWHash() const;
int64_t GetBlockTime() const
{
return (int64_t)nTime;
+1 -1
View File
@@ -10,7 +10,7 @@
#include <qt/forms/ui_addressbookpage.h>
#include <qt/addresstablemodel.h>
#include <qt/bitcoingui.h>
#include <qt/nyc3gui.h>
#include <qt/csvmodelwriter.h>
#include <qt/editaddressdialog.h>
#include <qt/guiutil.h>
-90
View File
@@ -1,90 +0,0 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/translations">
<file alias="af">locale/bitcoin_af.qm</file>
<file alias="af_ZA">locale/bitcoin_af_ZA.qm</file>
<file alias="ar">locale/bitcoin_ar.qm</file>
<file alias="be_BY">locale/bitcoin_be_BY.qm</file>
<file alias="bg_BG">locale/bitcoin_bg_BG.qm</file>
<file alias="bg">locale/bitcoin_bg.qm</file>
<file alias="ca_ES">locale/bitcoin_ca_ES.qm</file>
<file alias="ca">locale/bitcoin_ca.qm</file>
<file alias="ca@valencia">locale/bitcoin_ca@valencia.qm</file>
<file alias="cs">locale/bitcoin_cs.qm</file>
<file alias="cy">locale/bitcoin_cy.qm</file>
<file alias="da">locale/bitcoin_da.qm</file>
<file alias="de">locale/bitcoin_de.qm</file>
<file alias="el_GR">locale/bitcoin_el_GR.qm</file>
<file alias="el">locale/bitcoin_el.qm</file>
<file alias="en_GB">locale/bitcoin_en_GB.qm</file>
<file alias="en">locale/bitcoin_en.qm</file>
<file alias="eo">locale/bitcoin_eo.qm</file>
<file alias="es_AR">locale/bitcoin_es_AR.qm</file>
<file alias="es_CL">locale/bitcoin_es_CL.qm</file>
<file alias="es_CO">locale/bitcoin_es_CO.qm</file>
<file alias="es_DO">locale/bitcoin_es_DO.qm</file>
<file alias="es_ES">locale/bitcoin_es_ES.qm</file>
<file alias="es_MX">locale/bitcoin_es_MX.qm</file>
<file alias="es">locale/bitcoin_es.qm</file>
<file alias="es_UY">locale/bitcoin_es_UY.qm</file>
<file alias="es_VE">locale/bitcoin_es_VE.qm</file>
<file alias="et_EE">locale/bitcoin_et_EE.qm</file>
<file alias="et">locale/bitcoin_et.qm</file>
<file alias="eu_ES">locale/bitcoin_eu_ES.qm</file>
<file alias="fa_IR">locale/bitcoin_fa_IR.qm</file>
<file alias="fa">locale/bitcoin_fa.qm</file>
<file alias="fi">locale/bitcoin_fi.qm</file>
<file alias="fr_CA">locale/bitcoin_fr_CA.qm</file>
<file alias="fr_FR">locale/bitcoin_fr_FR.qm</file>
<file alias="fr">locale/bitcoin_fr.qm</file>
<file alias="gl">locale/bitcoin_gl.qm</file>
<file alias="he">locale/bitcoin_he.qm</file>
<file alias="hi_IN">locale/bitcoin_hi_IN.qm</file>
<file alias="hr">locale/bitcoin_hr.qm</file>
<file alias="hu">locale/bitcoin_hu.qm</file>
<file alias="id_ID">locale/bitcoin_id_ID.qm</file>
<file alias="it_IT">locale/bitcoin_it_IT.qm</file>
<file alias="it">locale/bitcoin_it.qm</file>
<file alias="ja">locale/bitcoin_ja.qm</file>
<file alias="ka">locale/bitcoin_ka.qm</file>
<file alias="kk_KZ">locale/bitcoin_kk_KZ.qm</file>
<file alias="ko_KR">locale/bitcoin_ko_KR.qm</file>
<file alias="ku_IQ">locale/bitcoin_ku_IQ.qm</file>
<file alias="ky">locale/bitcoin_ky.qm</file>
<file alias="la">locale/bitcoin_la.qm</file>
<file alias="lt">locale/bitcoin_lt.qm</file>
<file alias="lv_LV">locale/bitcoin_lv_LV.qm</file>
<file alias="mk_MK">locale/bitcoin_mk_MK.qm</file>
<file alias="mn">locale/bitcoin_mn.qm</file>
<file alias="ms_MY">locale/bitcoin_ms_MY.qm</file>
<file alias="nb">locale/bitcoin_nb.qm</file>
<file alias="ne">locale/bitcoin_ne.qm</file>
<file alias="nl">locale/bitcoin_nl.qm</file>
<file alias="pam">locale/bitcoin_pam.qm</file>
<file alias="pl">locale/bitcoin_pl.qm</file>
<file alias="pt_BR">locale/bitcoin_pt_BR.qm</file>
<file alias="pt_PT">locale/bitcoin_pt_PT.qm</file>
<file alias="ro_RO">locale/bitcoin_ro_RO.qm</file>
<file alias="ro">locale/bitcoin_ro.qm</file>
<file alias="ru_RU">locale/bitcoin_ru_RU.qm</file>
<file alias="ru">locale/bitcoin_ru.qm</file>
<file alias="sk">locale/bitcoin_sk.qm</file>
<file alias="sl_SI">locale/bitcoin_sl_SI.qm</file>
<file alias="sq">locale/bitcoin_sq.qm</file>
<file alias="sr@latin">locale/bitcoin_sr@latin.qm</file>
<file alias="sr">locale/bitcoin_sr.qm</file>
<file alias="sv">locale/bitcoin_sv.qm</file>
<file alias="ta">locale/bitcoin_ta.qm</file>
<file alias="th_TH">locale/bitcoin_th_TH.qm</file>
<file alias="tr_TR">locale/bitcoin_tr_TR.qm</file>
<file alias="tr">locale/bitcoin_tr.qm</file>
<file alias="uk">locale/bitcoin_uk.qm</file>
<file alias="ur_PK">locale/bitcoin_ur_PK.qm</file>
<file alias="uz@Cyrl">locale/bitcoin_uz@Cyrl.qm</file>
<file alias="vi">locale/bitcoin_vi.qm</file>
<file alias="vi_VN">locale/bitcoin_vi_VN.qm</file>
<file alias="zh_CN">locale/bitcoin_zh_CN.qm</file>
<file alias="zh_HK">locale/bitcoin_zh_HK.qm</file>
<file alias="zh">locale/bitcoin_zh.qm</file>
<file alias="zh_TW">locale/bitcoin_zh_TW.qm</file>
</qresource>
</RCC>
+2 -2
View File
@@ -11,7 +11,7 @@
#include <qt/addresstablemodel.h>
#include <base58.h>
#include <qt/bitcoinunits.h>
#include <qt/nyc3units.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
#include <qt/platformstyle.h>
@@ -532,7 +532,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
}
// actually update labels
int nDisplayUnit = BitcoinUnits::BTC;
int nDisplayUnit = BitcoinUnits::NYC3;
if (model && model->getOptionsModel())
nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
+3 -3
View File
@@ -164,7 +164,7 @@
<item row="5" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="BitcoinAmountField" name="reqAmount">
<widget class="nyc3amountfield" name="reqAmount">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -351,9 +351,9 @@
</widget>
<customwidgets>
<customwidget>
<class>BitcoinAmountField</class>
<class>nyc3amountfield</class>
<extends>QLineEdit</extends>
<header>qt/bitcoinamountfield.h</header>
<header>qt/nyc3amountfield.h</header>
<container>1</container>
</customwidget>
</customwidgets>
+3 -3
View File
@@ -858,7 +858,7 @@ Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis p
</widget>
</item>
<item>
<widget class="BitcoinAmountField" name="customFee"/>
<widget class="nyc3amountfield" name="customFee"/>
</item>
<item>
<spacer name="horizontalSpacer_6">
@@ -1234,9 +1234,9 @@ Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis p
<header>qt/qvalidatedlineedit.h</header>
</customwidget>
<customwidget>
<class>BitcoinAmountField</class>
<class>nyc3amountfield</class>
<extends>QLineEdit</extends>
<header>qt/bitcoinamountfield.h</header>
<header>qt/nyc3amountfield.h</header>
<container>1</container>
</customwidget>
</customwidgets>
+5 -5
View File
@@ -165,7 +165,7 @@
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayoutAmount" stretch="0,1,0">
<item>
<widget class="BitcoinAmountField" name="payAmount"/>
<widget class="nyc3amountfield" name="payAmount"/>
</item>
<item>
<widget class="QCheckBox" name="checkboxSubtractFeeFromAmount">
@@ -709,7 +709,7 @@
</widget>
</item>
<item row="2" column="1">
<widget class="BitcoinAmountField" name="payAmount_is">
<widget class="nyc3amountfield" name="payAmount_is">
<property name="acceptDrops">
<bool>false</bool>
</property>
@@ -1242,7 +1242,7 @@
</widget>
</item>
<item row="2" column="1">
<widget class="BitcoinAmountField" name="payAmount_s">
<widget class="nyc3amountfield" name="payAmount_s">
<property name="acceptDrops">
<bool>false</bool>
</property>
@@ -1258,9 +1258,9 @@
<header>qt/qvalidatedlineedit.h</header>
</customwidget>
<customwidget>
<class>BitcoinAmountField</class>
<class>nyc3amountfield</class>
<extends>QLineEdit</extends>
<header>qt/bitcoinamountfield.h</header>
<header>qt/nyc3amountfield.h</header>
</customwidget>
</customwidgets>
<tabstops>
+4 -4
View File
@@ -4,8 +4,8 @@
#include <qt/guiutil.h>
#include <qt/bitcoinaddressvalidator.h>
#include <qt/bitcoinunits.h>
#include <qt/nyc3addressvalidator.h>
#include <qt/nyc3units.h>
#include <qt/qvalidatedlineedit.h>
#include <qt/walletmodel.h>
@@ -149,7 +149,7 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
{
if(!i->second.isEmpty())
{
if(!BitcoinUnits::parse(BitcoinUnits::BTC, i->second, &rv.amount))
if(!BitcoinUnits::parse(BitcoinUnits::NYC3, i->second, &rv.amount))
{
return false;
}
@@ -180,7 +180,7 @@ QString formatBitcoinURI(const SendCoinsRecipient &info)
if (info.amount)
{
ret += QString("?amount=%1").arg(BitcoinUnits::format(BitcoinUnits::BTC, info.amount, false, BitcoinUnits::separatorNever));
ret += QString("?amount=%1").arg(BitcoinUnits::format(BitcoinUnits::NYC3, info.amount, false, BitcoinUnits::separatorNever));
paramCount++;
}

Some files were not shown because too many files have changed in this diff Show More