mirror of
https://git.hush.is/hush/hush3.git
synced 2025-09-24 00:04:19 -04:00
uni3
This commit is contained in:
parent
fcac670670
commit
9d36579649
217
Makefile.am
217
Makefile.am
@ -16,15 +16,17 @@ BITCOIND_BIN=$(top_builddir)/src/zcashd$(EXEEXT)
|
||||
BITCOIN_CLI_BIN=$(top_builddir)/src/zcash-cli$(EXEEXT)
|
||||
BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win$(WINDOWS_BITS)-setup$(EXEEXT)
|
||||
|
||||
##OSX_APP=Bitcoin-Qt.app
|
||||
##OSX_DMG=Bitcoin-Core.dmg
|
||||
##OSX_BACKGROUND_IMAGE=background.tiff
|
||||
##OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
|
||||
##OSX_FANCY_PLIST=$(top_srcdir)/contrib/macdeploy/fancy.plist
|
||||
##OSX_BASE_LPROJ_DIR=$(top_srcdir)/contrib/macdeploy/Base.lproj/InfoPlist.strings
|
||||
##OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns
|
||||
##OSX_PLIST=$(top_srcdir)/share/qt/Info.plist #not installed
|
||||
##OSX_QT_TRANSLATIONS = da,de,es,hu,ru,uk,zh_CN,zh_TW
|
||||
if TARGET_DARWIN
|
||||
OSX_APP=Bitcoin-Qt.app
|
||||
OSX_DMG=Bitcoin-Core.dmg
|
||||
OSX_BACKGROUND_IMAGE=background.tiff
|
||||
OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
|
||||
OSX_FANCY_PLIST=$(top_srcdir)/contrib/macdeploy/fancy.plist
|
||||
OSX_BASE_LPROJ_DIR=$(top_srcdir)/contrib/macdeploy/Base.lproj/InfoPlist.strings
|
||||
OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns
|
||||
OSX_PLIST=$(top_srcdir)/share/qt/Info.plist #not installed
|
||||
OSX_QT_TRANSLATIONS = da,de,es,hu,ru,uk,zh_CN,zh_TW
|
||||
endif
|
||||
|
||||
DIST_DOCS = $(wildcard doc/*.md) $(wildcard doc/release-notes/*.md)
|
||||
|
||||
@ -35,14 +37,15 @@ WINDOWS_PACKAGING = $(top_srcdir)/share/pixmaps/bitcoin.ico \
|
||||
$(top_srcdir)/share/pixmaps/nsis-header.bmp \
|
||||
$(top_srcdir)/share/pixmaps/nsis-wizard.bmp
|
||||
|
||||
##OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) $(OSX_BASE_LPROJ_DIR) \
|
||||
## $(top_srcdir)/contrib/macdeploy/$(OSX_BACKGROUND_IMAGE) \
|
||||
## $(top_srcdir)/contrib/macdeploy/DS_Store \
|
||||
## $(top_srcdir)/contrib/macdeploy/detached-sig-apply.sh \
|
||||
## $(top_srcdir)/contrib/macdeploy/detached-sig-create.sh
|
||||
if TARGET_DARWIN
|
||||
OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) $(OSX_BASE_LPROJ_DIR) \
|
||||
$(top_srcdir)/contrib/macdeploy/$(OSX_BACKGROUND_IMAGE) \
|
||||
$(top_srcdir)/contrib/macdeploy/DS_Store \
|
||||
$(top_srcdir)/contrib/macdeploy/detached-sig-apply.sh \
|
||||
$(top_srcdir)/contrib/macdeploy/detached-sig-create.sh
|
||||
endif
|
||||
|
||||
|
||||
if BUILD_DARWIN
|
||||
if TARGET_DARWIN
|
||||
COVERAGE_INFO = baseline_filtered_combined.info baseline.info block_test.info \
|
||||
leveldb_baseline.info test_bitcoin_filtered.info total_coverage.info \
|
||||
baseline_filtered.info block_test_filtered.info \
|
||||
@ -53,7 +56,7 @@ COVERAGE_INFO = baseline_filtered_combined.info baseline.info block_test.info \
|
||||
leveldb_baseline.info test_bitcoin_filtered.info total_coverage.info \
|
||||
baseline_filtered.info block_test_filtered.info \
|
||||
leveldb_baseline_filtered.info test_bitcoin_coverage.info test_bitcoin.info \
|
||||
zcash-gtest.info zcash-gtest_filtered.info zcash-gtest_coverage.info
|
||||
#zcash-gtest.info zcash-gtest_filtered.info zcash-gtest_coverage.info
|
||||
endif
|
||||
|
||||
dist-hook:
|
||||
@ -80,68 +83,73 @@ $(BITCOIN_WIN_INSTALLER): all-recursive
|
||||
$(if $(findstring src/,$(MAKECMDGOALS)),$(MAKECMDGOALS), none): FORCE
|
||||
$(MAKE) -C src $(patsubst src/%,%,$@)
|
||||
|
||||
##$(OSX_APP)/Contents/PkgInfo:
|
||||
## $(MKDIR_P) $(@D)
|
||||
## @echo "APPL????" > $@
|
||||
##
|
||||
##$(OSX_APP)/Contents/Resources/empty.lproj:
|
||||
## $(MKDIR_P) $(@D)
|
||||
## @touch $@
|
||||
##
|
||||
##$(OSX_APP)/Contents/Info.plist: $(OSX_PLIST)
|
||||
## $(MKDIR_P) $(@D)
|
||||
## $(INSTALL_DATA) $< $@
|
||||
##
|
||||
##$(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS)
|
||||
## $(MKDIR_P) $(@D)
|
||||
## $(INSTALL_DATA) $< $@
|
||||
##
|
||||
##$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(BITCOIN_QT_BIN)
|
||||
## $(MKDIR_P) $(@D)
|
||||
## STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $< $@
|
||||
##
|
||||
##$(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings: $(OSX_BASE_LPROJ_DIR)
|
||||
## $(MKDIR_P) $(@D)
|
||||
## $(INSTALL_DATA) $< $@
|
||||
##
|
||||
##OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \
|
||||
## $(OSX_APP)/Contents/Resources/bitcoin.icns $(OSX_APP)/Contents/Info.plist \
|
||||
## $(OSX_APP)/Contents/MacOS/Bitcoin-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings
|
||||
##
|
||||
##if BUILD_DARWIN
|
||||
##$(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING)
|
||||
## $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -add-qt-tr $(OSX_QT_TRANSLATIONS) -translations-dir=$(QT_TRANSLATION_DIR) -dmg -fancy $(OSX_FANCY_PLIST) -verbose 2
|
||||
##
|
||||
##deploydir: $(OSX_DMG)
|
||||
##else
|
||||
##APP_DIST_DIR=$(top_builddir)/dist
|
||||
##APP_DIST_EXTRAS=$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE) $(APP_DIST_DIR)/.DS_Store $(APP_DIST_DIR)/Applications
|
||||
##
|
||||
##$(APP_DIST_DIR)/Applications:
|
||||
## @rm -f $@
|
||||
## @cd $(@D); $(LN_S) /Applications $(@F)
|
||||
##
|
||||
##$(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt
|
||||
##
|
||||
##$(OSX_DMG): $(APP_DIST_EXTRAS)
|
||||
## $(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "Bitcoin-Core" -no-pad -r -apple -o $@ dist
|
||||
##
|
||||
##$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE): contrib/macdeploy/$(OSX_BACKGROUND_IMAGE)
|
||||
## $(MKDIR_P) $(@D)
|
||||
## $(INSTALL) $< $@
|
||||
##$(APP_DIST_DIR)/.DS_Store: contrib/macdeploy/DS_Store
|
||||
## $(INSTALL) $< $@
|
||||
##
|
||||
##$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
|
||||
## INSTALLNAMETOOL=$(INSTALLNAMETOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -translations-dir=$(QT_TRANSLATION_DIR) -add-qt-tr $(OSX_QT_TRANSLATIONS) -verbose 2
|
||||
##
|
||||
##deploydir: $(APP_DIST_EXTRAS)
|
||||
##endif
|
||||
##
|
||||
##if TARGET_DARWIN
|
||||
##appbundle: $(OSX_APP_BUILT)
|
||||
##deploy: $(OSX_DMG)
|
||||
##endif
|
||||
if TARGET_DARWIN
|
||||
|
||||
$(OSX_APP)/Contents/PkgInfo:
|
||||
$(MKDIR_P) $(@D)
|
||||
@echo "APPL????" > $@
|
||||
|
||||
$(OSX_APP)/Contents/Resources/empty.lproj:
|
||||
$(MKDIR_P) $(@D)
|
||||
@touch $@
|
||||
|
||||
$(OSX_APP)/Contents/Info.plist: $(OSX_PLIST)
|
||||
$(MKDIR_P) $(@D)
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
$(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS)
|
||||
$(MKDIR_P) $(@D)
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(BITCOIN_QT_BIN)
|
||||
$(MKDIR_P) $(@D)
|
||||
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $< $@
|
||||
|
||||
$(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings: $(OSX_BASE_LPROJ_DIR)
|
||||
$(MKDIR_P) $(@D)
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \
|
||||
$(OSX_APP)/Contents/Resources/bitcoin.icns $(OSX_APP)/Contents/Info.plist \
|
||||
$(OSX_APP)/Contents/MacOS/Bitcoin-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings
|
||||
|
||||
endif
|
||||
|
||||
if BUILD_DARWIN
|
||||
$(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING)
|
||||
$(OSX_DEPLOY_SCRIPT) $(OSX_APP) -add-qt-tr $(OSX_QT_TRANSLATIONS) -translations-dir=$(QT_TRANSLATION_DIR) -dmg -fancy $(OSX_FANCY_PLIST) -verbose 2
|
||||
deploydir: $(OSX_DMG)
|
||||
else
|
||||
APP_DIST_DIR=$(top_builddir)/dist
|
||||
APP_DIST_EXTRAS=$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE) $(APP_DIST_DIR)/.DS_Store $(APP_DIST_DIR)/Applications
|
||||
endif
|
||||
|
||||
if TARGET_DARWIN
|
||||
$(APP_DIST_DIR)/Applications:
|
||||
@rm -f $@
|
||||
@cd $(@D); $(LN_S) /Applications $(@F)
|
||||
|
||||
$(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt
|
||||
|
||||
$(OSX_DMG): $(APP_DIST_EXTRAS)
|
||||
$(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "Bitcoin-Core" -no-pad -r -apple -o $@ dist
|
||||
|
||||
$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE): contrib/macdeploy/$(OSX_BACKGROUND_IMAGE)
|
||||
$(MKDIR_P) $(@D)
|
||||
$(INSTALL) $< $@
|
||||
$(APP_DIST_DIR)/.DS_Store: contrib/macdeploy/DS_Store
|
||||
$(INSTALL) $< $@
|
||||
|
||||
$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
|
||||
INSTALLNAMETOOL=$(INSTALLNAMETOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -translations-dir=$(QT_TRANSLATION_DIR) -add-qt-tr $(OSX_QT_TRANSLATIONS) -verbose 2
|
||||
|
||||
deploydir: $(APP_DIST_EXTRAS)
|
||||
endif
|
||||
|
||||
if TARGET_DARWIN
|
||||
appbundle: $(OSX_APP_BUILT)
|
||||
deploy: $(OSX_DMG)
|
||||
endif
|
||||
|
||||
if TARGET_WINDOWS
|
||||
deploy: $(BITCOIN_WIN_INSTALLER)
|
||||
@ -161,10 +169,14 @@ baseline.info:
|
||||
if BUILD_DARWIN
|
||||
baseline_filtered.info: baseline.info
|
||||
$(LCOV) -r $< "/usr/include/*" \
|
||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
|
||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \
|
||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \
|
||||
"$(abs_builddir)/depends/$(BUILD)/include/*.h" \
|
||||
"$(abs_builddir)/depends/$(BUILD)/include/boost/*" \
|
||||
"$(abs_builddir)/depends/$(BUILD)/include/gmock/*" \
|
||||
"$(abs_builddir)/depends/$(BUILD)/include/gtest/*" \
|
||||
"$(abs_builddir)/src/gtest/*" \
|
||||
"$(abs_builddir)/src/test/*" \
|
||||
"$(abs_builddir)/src/wallet/gtest/*" \
|
||||
"$(abs_builddir)/src/wallet/test/*" \
|
||||
-o $@
|
||||
else
|
||||
baseline_filtered.info: baseline.info
|
||||
@ -186,10 +198,14 @@ leveldb_baseline.info: baseline_filtered.info
|
||||
if BUILD_DARWIN
|
||||
leveldb_baseline_filtered.info: leveldb_baseline.info
|
||||
$(LCOV) -r $< "/usr/include/*" \
|
||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
|
||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \
|
||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \
|
||||
"$(abs_builddir)/depends/$(BUILD)/include/*.h" \
|
||||
"$(abs_builddir)/depends/$(BUILD)/include/boost/*" \
|
||||
"$(abs_builddir)/depends/$(BUILD)/include/gmock/*" \
|
||||
"$(abs_builddir)/depends/$(BUILD)/include/gtest/*" \
|
||||
"$(abs_builddir)/src/gtest/*" \
|
||||
"$(abs_builddir)/src/test/*" \
|
||||
"$(abs_builddir)/src/wallet/gtest/*" \
|
||||
"$(abs_builddir)/src/wallet/test/*" \
|
||||
-o $@
|
||||
else
|
||||
leveldb_baseline_filtered.info: leveldb_baseline.info
|
||||
@ -217,9 +233,11 @@ test_bitcoin.info: baseline_filtered_combined.info
|
||||
if BUILD_DARWIN
|
||||
test_bitcoin_filtered.info: test_bitcoin.info
|
||||
$(LCOV) -r $< "/usr/include/*" \
|
||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
|
||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \
|
||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \
|
||||
"$(abs_builddir)/depends/$(BUILD)/include/*.h" \
|
||||
"$(abs_builddir)/depends/$(BUILD)/include/boost/*" \
|
||||
"$(abs_builddir)/depends/$(BUILD)/include/gmock/*" \
|
||||
"$(abs_builddir)/depends/$(BUILD)/include/gtest/*" \
|
||||
"$(abs_builddir)/src/gtest/*" \
|
||||
"$(abs_builddir)/src/test/*" \
|
||||
"$(abs_builddir)/src/wallet/gtest/*" \
|
||||
"$(abs_builddir)/src/wallet/test/*" \
|
||||
@ -248,10 +266,14 @@ block_test.info: test_bitcoin_filtered.info
|
||||
if BUILD_DARWIN
|
||||
block_test_filtered.info: block_test.info
|
||||
$(LCOV) -r $< "/usr/include/*" \
|
||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
|
||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \
|
||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \
|
||||
"$(abs_builddir)/depends/$(BUILD)/include/*.h" \
|
||||
"$(abs_builddir)/depends/$(BUILD)/include/boost/*" \
|
||||
"$(abs_builddir)/depends/$(BUILD)/include/gmock/*" \
|
||||
"$(abs_builddir)/depends/$(BUILD)/include/gtest/*" \
|
||||
"$(abs_builddir)/src/gtest/*" \
|
||||
"$(abs_builddir)/src/test/*" \
|
||||
"$(abs_builddir)/src/wallet/gtest/*" \
|
||||
"$(abs_builddir)/src/wallet/test/*" \
|
||||
-o $@
|
||||
else
|
||||
block_test_filtered.info: block_test.info
|
||||
@ -276,8 +298,8 @@ zcash-gtest_coverage.info: baseline_filtered_combined.info zcash-gtest_filtered.
|
||||
endif
|
||||
|
||||
if BUILD_DARWIN
|
||||
total_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info block_test_filtered.info
|
||||
$(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -a block_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
|
||||
total_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info zcash-gtest_filtered.info block_test_filtered.info
|
||||
$(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -a zcash-gtest_filtered.info -a block_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
|
||||
else
|
||||
total_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info zcash-gtest_filtered.info block_test_filtered.info
|
||||
$(LCOV) -a baseline_filtered.info -a leveldb_baseline_filtered.info -a test_bitcoin_filtered.info -a zcash-gtest_filtered.info -a block_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
|
||||
@ -288,12 +310,19 @@ test_bitcoin.coverage/.dirstamp: test_bitcoin_coverage.info
|
||||
$(GENHTML) -s $< -o $(@D)
|
||||
@touch $@
|
||||
|
||||
if TARGET_DARWIN
|
||||
zcash-gtest.coverage/.dirstamp: zcash-gtest_coverage.info
|
||||
$(GENHTML) -s $< -o $(@D)
|
||||
@touch $@
|
||||
cov-zcash: zcash-gtest.coverage/.dirstamp
|
||||
endif
|
||||
|
||||
total.coverage/.dirstamp: total_coverage.info
|
||||
$(GENHTML) -s $< -o $(@D)
|
||||
@touch $@
|
||||
|
||||
if BUILD_DARWIN
|
||||
cov: test_bitcoin.coverage/.dirstamp total.coverage/.dirstamp
|
||||
cov: test_bitcoin.coverage/.dirstamp cov-zcash total.coverage/.dirstamp
|
||||
else
|
||||
cov: test_bitcoin.coverage/.dirstamp cov-zcash total.coverage/.dirstamp
|
||||
endif
|
||||
|
33
configure.ac
33
configure.ac
@ -121,11 +121,20 @@ AC_ARG_ENABLE([comparison-tool-reorg-tests],
|
||||
[use_comparison_tool_reorg_tests=$enableval],
|
||||
[use_comparison_tool_reorg_tests=no])
|
||||
|
||||
if test x$TARGET_OS = xdarwin; then
|
||||
AC_ARG_ENABLE([hardening],
|
||||
[AS_HELP_STRING([--enable-hardening],
|
||||
[attempt to harden the resulting executables (default is yes)])],
|
||||
[use_hardening=$enableval],
|
||||
[use_hardening=no])
|
||||
else
|
||||
AC_ARG_ENABLE([hardening],
|
||||
[AS_HELP_STRING([--enable-hardening],
|
||||
[attempt to harden the resulting executables (default is yes)])],
|
||||
[use_hardening=$enableval],
|
||||
[use_hardening=yes])
|
||||
fi
|
||||
|
||||
|
||||
AC_ARG_ENABLE([reduce-exports],
|
||||
[AS_HELP_STRING([--enable-reduce-exports],
|
||||
@ -292,11 +301,11 @@ case $host in
|
||||
|
||||
dnl AC_CHECK_PROG([BREW],brew, brew)
|
||||
dnl if test x$BREW = xbrew; then
|
||||
dnl These Homebrew packages may be keg-only, meaning that they won't be found
|
||||
dnl in expected paths because they may conflict with system files. Ask
|
||||
dnl Homebrew where each one is located, then adjust paths accordingly.
|
||||
dnl It's safe to add these paths even if the functionality is disabled by
|
||||
dnl the user (--without-wallet for example).
|
||||
dnl These Homebrew packages may be keg-only, meaning that they won't be found
|
||||
dnl in expected paths because they may conflict with system files. Ask
|
||||
dnl Homebrew where each one is located, then adjust paths accordingly.
|
||||
dnl It's safe to add these paths even if the functionality is disabled by
|
||||
dnl the user (--without-wallet for example).
|
||||
|
||||
dnl openssl_prefix=`$BREW --prefix openssl 2>/dev/null`
|
||||
dnl bdb_prefix=`$BREW --prefix berkeley-db4 2>/dev/null`
|
||||
@ -453,6 +462,8 @@ if test x$use_hardening != xno; then
|
||||
|
||||
if test x$TARGET_OS != xwindows; then
|
||||
# All windows code is PIC, forcing it on just adds useless compile warnings
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],[AC_MSG_ERROR(Cannot enable RELRO)])
|
||||
AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],[AC_MSG_ERROR(Cannot enable BIND_NOW)])
|
||||
AX_CHECK_COMPILE_FLAG([-fPIE],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fPIE"],[AC_MSG_ERROR(Cannot enable -fPIE)])
|
||||
AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"],[AC_MSG_ERROR(Cannot enable -pie)])
|
||||
else
|
||||
@ -754,11 +765,19 @@ fi
|
||||
|
||||
# These packages don't provide pkgconfig config files across all
|
||||
# platforms, so we use older autoconf detection mechanisms:
|
||||
if test x$TARGET_OS = xdarwin; then
|
||||
AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing))
|
||||
AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)])
|
||||
|
||||
AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing))
|
||||
AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)])
|
||||
fi
|
||||
|
||||
#AC_CHECK_HEADER([gmp.h],,AC_MSG_ERROR(libgmp headers missing))
|
||||
#AC_CHECK_LIB([gmp],[[__gmpn_sub_n]],GMP_LIBS=-lgmp, [AC_MSG_ERROR(libgmp missing)])
|
||||
|
||||
#AC_CHECK_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing))
|
||||
#AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx missing)])
|
||||
|
||||
# libsnark header layout is broken unless cpp's -I is passed with the
|
||||
# libsnark directory, so for now we use this hideous workaround:
|
||||
@ -773,8 +792,12 @@ fi
|
||||
CPPFLAGS="-I$LIBSNARK_INCDIR $CPPFLAGS"
|
||||
|
||||
# Now check for libsnark compilability using traditional autoconf tests:
|
||||
if test x$TARGET_OS = xdarwin; then
|
||||
AC_CHECK_HEADER([libsnark/gadgetlib1/gadget.hpp],,AC_MSG_ERROR(libsnark headers missing))
|
||||
AC_CHECK_LIB([snark],[main],LIBSNARK_LIBS=-lsnark, [AC_MSG_ERROR(libsnark missing)], [-lgmpxx])
|
||||
fi
|
||||
#AC_CHECK_HEADER([libsnark/gadgetlib1/gadget.hpp],,AC_MSG_ERROR(libsnark headers missing))
|
||||
#AC_CHECK_LIB([snark],[main],LIBSNARK_LIBS=-lsnark, [AC_MSG_ERROR(libsnark missing)], [-lgmpxx])
|
||||
|
||||
RUST_LIBS=""
|
||||
if test x$enable_rust != xno; then
|
||||
|
@ -5,7 +5,7 @@ BASE_CACHE ?= $(BASEDIR)/built
|
||||
SDK_PATH ?= $(BASEDIR)/SDKs
|
||||
NO_WALLET ?=
|
||||
NO_UPNP ?=
|
||||
FALLBACK_DOWNLOAD_PATH ?= https://z.cash/depends-sources
|
||||
FALLBACK_DOWNLOAD_PATH ?= https://supernet/depends-sources
|
||||
|
||||
BUILD ?= $(shell ./config.guess)
|
||||
HOST ?= $(BUILD)
|
||||
|
@ -7,7 +7,7 @@ build_darwin_OTOOL: = $(shell xcrun -f otool)
|
||||
build_darwin_NM: = $(shell xcrun -f nm)
|
||||
build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
|
||||
build_darwin_SHA256SUM = shasum -a 256
|
||||
build_darwin_DOWNLOAD = wget --timeout=$(DOWNLOAD_CONNECT_TIMEOUT) --tries=$(DOWNLOAD_RETRIES) -nv -O
|
||||
build_darwin_DOWNLOAD = curl --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -L -f -o
|
||||
|
||||
#darwin host on darwin builder. overrides darwin host preferences.
|
||||
darwin_CC= gcc-5
|
||||
|
@ -22,8 +22,7 @@ endef
|
||||
define fetch_file
|
||||
(test -f $$($(1)_source_dir)/$(4) || \
|
||||
( mkdir -p $$($(1)_download_dir) && echo Fetching $(1)... && \
|
||||
( $(build_DOWNLOAD) "$$($(1)_download_dir)/$(4).temp" "$(FALLBACK_DOWNLOAD_PATH)/$(4)" || \
|
||||
$(build_DOWNLOAD) "$$($(1)_download_dir)/$(4).temp" "$(2)/$(3)" ) && \
|
||||
( $(build_DOWNLOAD) "$$($(1)_download_dir)/$(4).temp" "$(2)/$(3)" ) && \
|
||||
echo "$(5) $$($(1)_download_dir)/$(4).temp" > $$($(1)_download_dir)/.$(4).hash && \
|
||||
$(build_SHA256SUM) -c $$($(1)_download_dir)/.$(4).hash && \
|
||||
mv $$($(1)_download_dir)/$(4).temp $$($(1)_source_dir)/$(4) && \
|
||||
|
@ -1,5 +1,7 @@
|
||||
mingw32_CFLAGS=-pipe
|
||||
mingw32_CXXFLAGS=$(mingw32_CFLAGS)
|
||||
mingw32_CC=x86_64-w64-mingw32-gcc-posix
|
||||
mingw32_CXX=x86_64-w64-mingw32-g++-posix
|
||||
mingw32_CFLAGS=-pipe -std=c11
|
||||
mingw32_CXXFLAGS=$(mingw32_CFLAGS) -std=c++11
|
||||
|
||||
mingw32_release_CFLAGS=-O2
|
||||
mingw32_release_CXXFLAGS=$(mingw32_release_CFLAGS)
|
||||
|
@ -15,6 +15,17 @@ define $(package)_config_cmds
|
||||
../dist/$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
|
||||
ifeq ($(build_os),darwin)
|
||||
define $(package)_preprocess_cmds
|
||||
sed -i -e "s/WinIoCtl.h/winioctl.h/g" src/dbinc/win_db.h
|
||||
endef
|
||||
else ifeq ($(build_os), mingw32)
|
||||
define $(package)_preprocess_cmds
|
||||
sed -i "s/WinIoCtl.h/winioctl.h/g" src/dbinc/win_db.h
|
||||
endef
|
||||
endif
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE) libdb_cxx-6.2.a libdb-6.2.a
|
||||
endef
|
||||
|
@ -9,12 +9,29 @@ $(package)_file_name=$(package)-$($(package)_version).tar.gz
|
||||
$(package)_download_file=release-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=3f20b6acb37e5a98e8c4518165711e3e35d47deb6cdb5a4dd4566563b5efd232
|
||||
|
||||
ifeq ($(build_os),darwin)
|
||||
define $(package)_set_vars
|
||||
$(package)_build_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)" CXX="$($(package)_cxx)" CXXFLAGS="$($(package)_cxxflags)"
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(build_os),darwin)
|
||||
$(package)_install=ginstall
|
||||
define $(package)_build_cmds
|
||||
$(MAKE) -C make GTEST_DIR='$(host_prefix)' gmock-all.o
|
||||
endef
|
||||
else
|
||||
$(package)_install=install
|
||||
define $(package)_build_cmds
|
||||
$(MAKE) -C make GTEST_DIR='$(host_prefix)' CXXFLAGS='-fPIC' gmock-all.o
|
||||
endef
|
||||
endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
define $(package)_stage_cmds
|
||||
install -D ./make/gmock-all.o $($(package)_staging_dir)$(host_prefix)/lib/libgmock.a && \
|
||||
$($(package)_install) -D ./make/gmock-all.o $($(package)_staging_dir)$(host_prefix)/lib/libgmock.a && \
|
||||
cp -a ./include $($(package)_staging_dir)$(host_prefix)/include
|
||||
endef
|
||||
|
@ -5,11 +5,25 @@ $(package)_file_name=$(package)-$($(package)_version).tar.gz
|
||||
$(package)_download_file=release-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=f73a6546fdf9fce9ff93a5015e0333a8af3062a152a9ad6bcb772c96687016cc
|
||||
|
||||
ifeq ($(build_os),darwin)
|
||||
define $(package)_set_vars
|
||||
$(package)_build_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)" CXX="$($(package)_cxx)" CXXFLAGS="$($(package)_cxxflags)"
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(build_os),darwin)
|
||||
$(package)_install=ginstall
|
||||
define $(package)_build_cmds
|
||||
$(MAKE) -C make gtest.a
|
||||
endef
|
||||
else
|
||||
$(package)_install=install
|
||||
define $(package)_build_cmds
|
||||
$(MAKE) -C make CXXFLAGS=-fPIC gtest.a
|
||||
endef
|
||||
endif
|
||||
|
||||
define $(package)_stage_cmds
|
||||
install -D ./make/gtest.a $($(package)_staging_dir)$(host_prefix)/lib/libgtest.a && \
|
||||
$($(package)_install) -D ./make/gtest.a $($(package)_staging_dir)$(host_prefix)/lib/libgtest.a && \
|
||||
cp -a ./include $($(package)_staging_dir)$(host_prefix)/include
|
||||
endef
|
||||
|
34
depends/packages/libcurl.mk
Normal file
34
depends/packages/libcurl.mk
Normal file
@ -0,0 +1,34 @@
|
||||
package=libcurl
|
||||
$(package)_version=7.54.0
|
||||
$(package)_download_path=https://curl.haxx.se/download
|
||||
$(package)_file_name=curl-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=a84b635941c74e26cce69dd817489bec687eb1f230e7d1897fc5b5f108b59adf
|
||||
$(package)_config_opts_linux=--disable-shared --enable-static --prefix=$(host_prefix)
|
||||
$(package)_config_opts_mingw32=--enable-mingw --disable-shared --enable-static --prefix=$(host_prefix) --host=x86_64-w64-mingw32
|
||||
$(package)_config_opts_darwin=--disable-shared --enable-static --prefix=$(host_prefix)
|
||||
$(package)_cflags_darwin=-mmacosx-version-min=10.9
|
||||
$(package)_conf_tool=./configure
|
||||
|
||||
ifeq ($(build_os),darwin)
|
||||
define $(package)_set_vars
|
||||
$(package)_build_env=MACOSX_DEPLOYMENT_TARGET="10.9"
|
||||
endef
|
||||
else
|
||||
define $(package)_config_cmds
|
||||
$($(package)_conf_tool) $($(package)_config_opts)
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(build_os),darwin)
|
||||
define $(package)_build_cmds
|
||||
$(MAKE) CPPFLAGS='-fPIC' CFLAGS='-mmacosx-version-min=10.9'
|
||||
endef
|
||||
else
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
endif
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
@ -1,10 +1,29 @@
|
||||
package=libgmp
|
||||
|
||||
ifeq ($(host_os),mingw32)
|
||||
$(package)_download_path=https://github.com/joshuayabut/$(package)/archive/
|
||||
$(package)_file_name=$(package)-$($(package)_git_commit).tar.gz
|
||||
$(package)_download_file=$($(package)_git_commit).tar.gz
|
||||
$(package)_sha256_hash=193836c1acc9dc00fe2521205d7bbe1ba13263f6cbef6f02584bf6f8b34b108f
|
||||
$(package)_git_commit=053c03b1cab347671d936f43ef66b48ab5e380ee
|
||||
$(package)_dependencies=
|
||||
$(package)_config_opts=--enable-cxx --disable-shared
|
||||
else ifeq ($(build_os),darwin)
|
||||
$(package)_download_path=https://github.com/ca333/$(package)/archive/
|
||||
$(package)_file_name=$(package)-$($(package)_git_commit).tar.gz
|
||||
$(package)_download_file=$($(package)_git_commit).tar.gz
|
||||
$(package)_sha256_hash=59b2c2b5d58fdf5943bfde1fa709e9eb53e7e072c9699d28dc1c2cbb3c8cc32c
|
||||
$(package)_git_commit=aece03c7b6967f91f3efdac8c673f55adff53ab1
|
||||
$(package)_dependencies=
|
||||
$(package)_config_opts=--enable-cxx --disable-shared
|
||||
else
|
||||
$(package)_version=6.1.1
|
||||
$(package)_download_path=https://gmplib.org/download/gmp/
|
||||
$(package)_file_name=gmp-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95bbeffd6
|
||||
$(package)_dependencies=
|
||||
$(package)_config_opts=--enable-cxx --disable-shared
|
||||
endif
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf) --host=$(host) --build=$(build)
|
||||
|
@ -7,13 +7,29 @@ $(package)_sha256_hash=a5760a90d4a1045c8944204f29fa2a3cf2f800afee400f88bf89bbfe2
|
||||
$(package)_git_commit=91348647a86201a9482ad4ad68398152dc3d635e
|
||||
$(package)_dependencies=rust
|
||||
|
||||
|
||||
ifeq ($(host_os),mingw32)
|
||||
define $(package)_build_cmds
|
||||
~/.cargo/bin/cargo build --release --target=x86_64-pc-windows-gnu --verbose
|
||||
endef
|
||||
else
|
||||
define $(package)_build_cmds
|
||||
cargo build --release
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(host_os),mingw32)
|
||||
define $(package)_stage_cmds
|
||||
mkdir $($(package)_staging_dir)$(host_prefix)/lib/ && \
|
||||
mkdir $($(package)_staging_dir)$(host_prefix)/include/ && \
|
||||
cp target/x86_64-pc-windows-gnu/release/rustzcash.lib $($(package)_staging_dir)$(host_prefix)/lib/ && \
|
||||
cp include/librustzcash.h $($(package)_staging_dir)$(host_prefix)/include/
|
||||
endef
|
||||
else
|
||||
define $(package)_stage_cmds
|
||||
mkdir $($(package)_staging_dir)$(host_prefix)/lib/ && \
|
||||
mkdir $($(package)_staging_dir)$(host_prefix)/include/ && \
|
||||
cp target/release/librustzcash.a $($(package)_staging_dir)$(host_prefix)/lib/ && \
|
||||
cp include/librustzcash.h $($(package)_staging_dir)$(host_prefix)/include/
|
||||
endef
|
||||
endif
|
||||
|
@ -12,19 +12,20 @@ ifeq ($(build_os),darwin)
|
||||
define $(package)_build_cmds
|
||||
CC=gcc-5 CXX=g++-5 CXXFLAGS="-arch x86_64 -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1" $(MAKE) lib DEPINST=$(host_prefix) CURVE=ALT_BN128 MULTICORE=0 NO_PROCPS=1 NO_GTEST=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT
|
||||
endef
|
||||
else ifeq ($(host_os),mingw32)
|
||||
define $(package)_build_cmds
|
||||
CXX="x86_64-w64-mingw32-g++-posix" CXXFLAGS="-DBINARY_OUTPUT -DPTW32_STATIC_LIB -DSTATICLIB -DNO_PT_COMPRESSION=1 -fopenmp" $(MAKE) lib DEPINST=$(host_prefix) CURVE=ALT_BN128 MULTICORE=1 NO_PROCPS=1 NO_GTEST=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT OPTFLAGS="-O2 -march=x86-64"
|
||||
endef
|
||||
else
|
||||
define $(package)_build_cmds
|
||||
CXXFLAGS="-fPIC -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1" $(MAKE) lib DEPINST=$(host_prefix) CURVE=ALT_BN128 MULTICORE=1 NO_PROCPS=1 NO_GTEST=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT OPTFLAGS="-O2 -march=x86-64"
|
||||
CXXFLAGS="-fPIC -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1" $(MAKE) lib DEPINST=$(host_prefix) CURVE=ALT_BN128 MULTICORE=1 NO_PROCPS=1 NO_GTEST=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT OPTFLAGS="-O2 -march=x86-64"
|
||||
endef
|
||||
|
||||
|
||||
|
||||
|
||||
endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) install STATIC=1 DEPINST=$(host_prefix) PREFIX=$($(package)_staging_dir)$(host_prefix) CURVE=ALT_BN128 NO_SUPERCOP=1
|
||||
endef
|
||||
|
@ -1,6 +1,6 @@
|
||||
package=libsodium
|
||||
$(package)_version=1.0.11
|
||||
$(package)_download_path=https://download.libsodium.org/libsodium/releases/
|
||||
$(package)_download_path=https://supernetorg.bintray.com/misc
|
||||
$(package)_file_name=libsodium-1.0.11.tar.gz
|
||||
$(package)_sha256_hash=a14549db3c49f6ae2170cbbf4664bd48ace50681045e8dbea7c8d9fb96f9c765
|
||||
$(package)_dependencies=
|
||||
|
@ -1,10 +1,10 @@
|
||||
rust_packages := rust librustzcash
|
||||
zcash_packages := libsnark libgmp libsodium
|
||||
|
||||
ifeq ($(build_os),darwin)
|
||||
packages := boost openssl libevent zeromq $(zcash_packages)
|
||||
ifeq ($(host_os),linux)
|
||||
packages := boost openssl libevent zeromq $(zcash_packages) googletest googlemock
|
||||
else
|
||||
packages := boost openssl libevent zeromq $(zcash_packages) googletest googlemock
|
||||
packages := boost openssl libevent zeromq $(zcash_packages) googletest googlemock libcurl
|
||||
endif
|
||||
|
||||
|
||||
|
@ -1,8 +1,16 @@
|
||||
package=rust
|
||||
$(package)_version=1.16.0
|
||||
$(package)_download_path=https://static.rust-lang.org/dist
|
||||
ifeq ($(build_os),darwin)
|
||||
$(package)_file_name=rust-$($(package)_version)-x86_64-apple-darwin.tar.gz
|
||||
$(package)_sha256_hash=2d08259ee038d3a2c77a93f1a31fc59e7a1d6d1bbfcba3dba3c8213b2e5d1926
|
||||
else ifeq ($(host_os),mingw32)
|
||||
$(package)_file_name=rust-$($(package)_version)-i686-unknown-linux-gnu.tar.gz
|
||||
$(package)_sha256_hash=b5859161ebb182d3b75fa14a5741e5de87b088146fb0ef4a30f3b2439c6179c5
|
||||
else
|
||||
$(package)_file_name=rust-$($(package)_version)-x86_64-unknown-linux-gnu.tar.gz
|
||||
$(package)_sha256_hash=48621912c242753ba37cad5145df375eeba41c81079df46f93ffb4896542e8fd
|
||||
endif
|
||||
|
||||
define $(package)_stage_cmds
|
||||
./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig
|
||||
|
@ -1,3 +1,18 @@
|
||||
ifeq ($(host_os),mingw32)
|
||||
$(package)_version=4.2.2-1
|
||||
$(package)_download_path=https://github.com/ca333/libzmq/archive/
|
||||
$(package)_download_file=v$($(package)_version).tar.gz
|
||||
$(package)_file_name=libzmq-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=0e225b85ce11be23bf7eb7d3f25c6686728bf30d5c31f61c12d37bb646c69962
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_build_env+=
|
||||
$(package)_config_opts=--enable-shared=false --enable-static --host=x86_64-w64-mingw32
|
||||
$(package)_config_opts_mingw32=--enable-shared=false --enable-static --host=x86_64-w64-mingw32
|
||||
$(package)_cflags=-Wno-error -Wall -Wno-pedantic-ms-format -DLIBCZMQ_EXPORTS -DZMQ_DEFINED_STDINT -lws2_32 -liphlpapi -lrpcrt4
|
||||
$(package)_conf_tool=./configure
|
||||
endef
|
||||
else
|
||||
package=zeromq
|
||||
$(package)_version=4.2.1
|
||||
$(package)_download_path=https://github.com/zeromq/libzmq/releases/download/v$($(package)_version)/
|
||||
@ -8,10 +23,20 @@ define $(package)_set_vars
|
||||
$(package)_config_opts=--without-documentation --disable-shared --disable-curve
|
||||
$(package)_config_opts_linux=--with-pic
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(host_os),mingw32)
|
||||
define $(package)_preprocess_cmds
|
||||
cd $($(package)_build_subdir); ./autogen.sh
|
||||
endef
|
||||
define $(package)_config_cmds
|
||||
$($(package)_conf_tool) $($(package)_config_opts) CFLAGS="-Wno-error -Wall -Wno-pedantic-ms-format -DLIBCZMQ_EXPORTS -DZMQ_DEFINED_STDINT -lws2_32 -liphlpapi -lrpcrt4"
|
||||
endef
|
||||
else
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
endif
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE) src/libzmq.la
|
||||
|
@ -23,7 +23,15 @@ BITCOIN_INCLUDES=-I$(builddir) -I$(builddir)/obj $(BOOST_CPPFLAGS) $(LEVELDB_CPP
|
||||
BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
|
||||
BITCOIN_INCLUDES += -I$(srcdir)/univalue/include
|
||||
|
||||
if TARGET_WINDOWS
|
||||
LIBBITCOIN_SERVER=libbitcoin_server.a -lcurl
|
||||
endif
|
||||
if TARGET_DARWIN
|
||||
LIBBITCOIN_SERVER=libbitcoin_server.a -lcurl
|
||||
else
|
||||
LIBBITCOIN_SERVER=libbitcoin_server.a
|
||||
endif
|
||||
|
||||
LIBBITCOIN_WALLET=libbitcoin_wallet.a
|
||||
LIBBITCOIN_COMMON=libbitcoin_common.a
|
||||
LIBBITCOIN_CLI=libbitcoin_cli.a
|
||||
|
@ -44,7 +44,6 @@ komodo_asset WLC 210000000
|
||||
komodo_asset KV 1000000
|
||||
komodo_asset CEAL 366666666
|
||||
komodo_asset MESH 1000007
|
||||
komodo_asset MNZ 257142858
|
||||
|
||||
komodo_asset USD
|
||||
komodo_asset EUR
|
||||
|
@ -21,7 +21,6 @@ echo $pubkey
|
||||
./komodod -pubkey=$pubkey -ac_name=KV -ac_supply=1000000 -addnode=78.47.196.146 $1 &
|
||||
./komodod -pubkey=$pubkey -ac_name=CEAL -ac_supply=366666666 -addnode=78.47.196.146 $1 &
|
||||
./komodod -pubkey=$pubkey -ac_name=MESH -ac_supply=1000007 -addnode=78.47.196.146 $1 &
|
||||
./komodod -pubkey=$pubkey -ac_name=MNZ -ac_supply=257142858 -addnode=51.15.138.138 $1 &
|
||||
sleep $delay
|
||||
|
||||
./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 &
|
||||
|
@ -86,7 +86,7 @@ static bool AppInitRPC(int argc, char* argv[])
|
||||
// Parameters
|
||||
//
|
||||
ParseParameters(argc, argv);
|
||||
komodo_args(argv[0]);
|
||||
komodo_args();
|
||||
if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) {
|
||||
std::string strUsage = _("Komodo RPC client version") + " " + FormatFullVersion() + "\n" + PrivacyInfo();
|
||||
if (!mapArgs.count("-version")) {
|
||||
@ -196,7 +196,7 @@ UniValue CallRPC(const string& strMethod, const UniValue& params)
|
||||
{
|
||||
std::string host = GetArg("-rpcconnect", "127.0.0.1");
|
||||
int port = GetArg("-rpcport", BaseParams().RPCPort());
|
||||
BITCOIND_PORT = port;
|
||||
|
||||
// Obtain event base
|
||||
raii_event_base base = obtain_event_base();
|
||||
|
||||
|
@ -20,6 +20,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define frpintf(...)
|
||||
#define printf(...)
|
||||
#endif
|
||||
|
||||
/* Introduction text for doxygen: */
|
||||
|
||||
/*! \mainpage Developer documentation
|
||||
@ -106,14 +111,18 @@ bool AppInit(int argc, char* argv[])
|
||||
|
||||
try
|
||||
{
|
||||
void komodo_args(char *argv0);
|
||||
komodo_args(argv[0]);
|
||||
fprintf(stderr,"call komodo_args.(%s) NOTARY_PUBKEY.(%s)\n",argv[0],NOTARY_PUBKEY.c_str());
|
||||
void komodo_args();
|
||||
komodo_args();
|
||||
fprintf(stderr,"call komodo_args NOTARY_PUBKEY.(%s)\n",NOTARY_PUBKEY.c_str());
|
||||
while ( ASSETCHAIN_INIT == 0 )
|
||||
{
|
||||
//if ( komodo_is_issuer() != 0 )
|
||||
// komodo_passport_iteration();
|
||||
#ifdef _WIN32
|
||||
boost::this_thread::sleep_for(boost::chrono::seconds(1));
|
||||
#else
|
||||
sleep(1);
|
||||
#endif
|
||||
}
|
||||
printf("initialized %s\n",ASSETCHAINS_SYMBOL);
|
||||
if (!boost::filesystem::is_directory(GetDataDir(false)))
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
consensus.nPowMaxAdjustUp = 16; // 16% adjustment up
|
||||
consensus.nPowTargetSpacing = 1 * 60;
|
||||
consensus.fPowAllowMinDifficultyBlocks = true; //false;
|
||||
/**
|
||||
/**
|
||||
* 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.
|
||||
@ -131,7 +131,7 @@ public:
|
||||
};
|
||||
if ( pthread_create((pthread_t *)malloc(sizeof(pthread_t)),NULL,chainparams_commandline,(void *)&consensus) != 0 )
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -141,7 +141,11 @@ void *chainparams_commandline(void *ptr)
|
||||
{
|
||||
while ( ASSETCHAINS_PORT == 0 )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
|
||||
#else
|
||||
sleep(1);
|
||||
#endif
|
||||
}
|
||||
//fprintf(stderr,">>>>>>>> port.%u\n",ASSETCHAINS_PORT);
|
||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
|
@ -18,6 +18,9 @@
|
||||
|
||||
#include "crypto/equihash.h"
|
||||
#include "util.h"
|
||||
#ifndef __linux__
|
||||
#include "compat/endian.h"
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
@ -22,7 +22,6 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dp
|
||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KV\",\"pubkey\":\"$pubkey\"}"
|
||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CEAL\",\"pubkey\":\"$pubkey\"}"
|
||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MESH\",\"pubkey\":\"$pubkey\"}"
|
||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MNZ\",\"pubkey\":\"$pubkey\"}"
|
||||
|
||||
|
||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"USD\",\"pubkey\":\"$pubkey\"}"
|
||||
|
@ -49,4 +49,3 @@ echo wlc; fiat/wlc $1 $2 $3 $4
|
||||
echo kv; fiat/kv $1 $2 $3 $4
|
||||
echo ceal; fiat/ceal $1 $2 $3 $4
|
||||
echo mesh; fiat/mesh $1 $2 $3 $4
|
||||
echo mnz; fiat/mnz $1 $2 $3 $4
|
||||
|
@ -126,15 +126,6 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &)
|
||||
// singleton request
|
||||
if (valRequest.isObject()) {
|
||||
jreq.parse(valRequest);
|
||||
|
||||
if (!RPCAuthorized(authHeader.second)) {
|
||||
LogPrintf("ThreadRPCServer incorrect password attempt from %s\n", req->GetPeer().ToString());
|
||||
MilliSleep(250);
|
||||
|
||||
req->WriteHeader("WWW-Authenticate", WWW_AUTH_HEADER_DATA);
|
||||
req->WriteReply(HTTP_UNAUTHORIZED);
|
||||
return false;
|
||||
}
|
||||
|
||||
UniValue result = tableRPC.execute(jreq.strMethod, jreq.params);
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
||||
// komodo functions that interact with bitcoind C++
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <curl.h>
|
||||
#include <easy.h>
|
||||
#include <curl/curl.h>
|
||||
#include <curl/easy.h>
|
||||
#else
|
||||
#include <curl/curl.h>
|
||||
#include <curl/easy.h>
|
||||
@ -164,7 +164,7 @@ try_again:
|
||||
curl_handle = curl_easy_init();
|
||||
init_string(&s);
|
||||
headers = curl_slist_append(0,"Expect:");
|
||||
|
||||
|
||||
curl_easy_setopt(curl_handle,CURLOPT_USERAGENT,"mozilla/4.0");//"Mozilla/4.0 (compatible; )");
|
||||
curl_easy_setopt(curl_handle,CURLOPT_HTTPHEADER, headers);
|
||||
curl_easy_setopt(curl_handle,CURLOPT_URL, url);
|
||||
@ -193,7 +193,7 @@ try_again:
|
||||
bracket0 = (char *)"[";
|
||||
bracket1 = (char *)"]";
|
||||
}
|
||||
|
||||
|
||||
databuf = (char *)malloc(256 + strlen(command) + strlen(params));
|
||||
sprintf(databuf,"{\"id\":\"jl777\",\"method\":\"%s\",\"params\":%s%s%s}",command,bracket0,params,bracket1);
|
||||
//printf("url.(%s) userpass.(%s) databuf.(%s)\n",url,userpass,databuf);
|
||||
@ -233,7 +233,7 @@ try_again:
|
||||
free(s.ptr);
|
||||
sleep((1<<numretries));
|
||||
goto try_again;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -340,7 +340,6 @@ char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port)
|
||||
sprintf(url,(char *)"http://127.0.0.1:%u",port);
|
||||
sprintf(postdata,"{\"method\":\"%s\",\"params\":%s}",method,params);
|
||||
//printf("postdata.(%s) USERPASS.(%s)\n",postdata,KMDUSERPASS);
|
||||
//LogPrintf("komodo_issuemethod userpass.(%s) %s %s port.%u\n",userpass,method,params,port);
|
||||
retstr2 = bitcoind_RPC(&retstr,(char *)"debug",url,userpass,method,params);
|
||||
//retstr = curl_post(&cHandle,url,USERPASS,postdata,0,0,0,0);
|
||||
}
|
||||
@ -433,6 +432,7 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t
|
||||
{
|
||||
if ( KMDUSERPASS[0] != 0 )
|
||||
jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,7771);
|
||||
//else jsonstr = _dex_getrawtransaction();
|
||||
else return(0); // need universal way to issue DEX* API, since notaries mine most blocks, this ok
|
||||
}
|
||||
else if ( strcmp(dest,"BTC") == 0 )
|
||||
@ -481,7 +481,7 @@ uint256 komodo_getblockhash(int32_t height)
|
||||
uint256 hash; char params[128],*hexstr,*jsonstr; cJSON *result; int32_t i; uint8_t revbuf[32];
|
||||
memset(&hash,0,sizeof(hash));
|
||||
sprintf(params,"[%d]",height);
|
||||
if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"getblockhash",params,BITCOIND_PORT)) != 0 )
|
||||
if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"getblockhash",params,7771)) != 0 )
|
||||
{
|
||||
if ( (result= cJSON_Parse(jsonstr)) != 0 )
|
||||
{
|
||||
@ -883,4 +883,3 @@ int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,9 @@
|
||||
#include <stdint.h>
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <sodium.h>
|
||||
#endif
|
||||
bits320 fmul(const bits320 in2,const bits320 in);
|
||||
bits320 fexpand(bits256 basepoint);
|
||||
bits256 fcontract(const bits320 input);
|
||||
@ -144,7 +146,7 @@ bits320 fsquare_times(const bits320 in,uint64_t count)
|
||||
t[2] = ((uint128_t) d0) * r2 + ((uint128_t) r1) * r1 + (((uint128_t) d4) * (r3 ));
|
||||
t[3] = ((uint128_t) d0) * r3 + ((uint128_t) d1) * r2 + (((uint128_t) r4) * (d419 ));
|
||||
t[4] = ((uint128_t) d0) * r4 + ((uint128_t) d1) * r3 + (((uint128_t) r2) * (r2 ));
|
||||
|
||||
|
||||
r0 = (uint64_t)t[0] & 0x7ffffffffffffLL; c = (uint64_t)(t[0] >> 51);
|
||||
t[1] += c; r1 = (uint64_t)t[1] & 0x7ffffffffffffLL; c = (uint64_t)(t[1] >> 51);
|
||||
t[2] += c; r2 = (uint64_t)t[2] & 0x7ffffffffffffLL; c = (uint64_t)(t[2] >> 51);
|
||||
@ -401,9 +403,9 @@ div_by_2_25(const limb v)
|
||||
* On entry: |output[i]| < 280*2^54 */
|
||||
static void freduce_coefficients(limb *output) {
|
||||
unsigned i;
|
||||
|
||||
|
||||
output[10] = 0;
|
||||
|
||||
|
||||
for (i = 0; i < 10; i += 2) {
|
||||
limb over = div_by_2_26(output[i]);
|
||||
/* The entry condition (that |output[i]| < 280*2^54) means that over is, at
|
||||
@ -412,7 +414,7 @@ static void freduce_coefficients(limb *output) {
|
||||
* 281*2^54. */
|
||||
output[i] -= over << 26;
|
||||
output[i+1] += over;
|
||||
|
||||
|
||||
/* For the first iteration, |output[i+1]| < 281*2^54, thus |over| <
|
||||
* 281*2^29. When this is added to the next limb, the resulting bound can
|
||||
* be approximated as 281*2^54.
|
||||
@ -427,9 +429,9 @@ static void freduce_coefficients(limb *output) {
|
||||
output[0] += output[10] << 4;
|
||||
output[0] += output[10] << 1;
|
||||
output[0] += output[10];
|
||||
|
||||
|
||||
output[10] = 0;
|
||||
|
||||
|
||||
/* Now output[1..9] are reduced, and |output[0]| < 2^26 + 19*281*2^29
|
||||
* So |over| will be no more than 2^16. */
|
||||
{
|
||||
@ -437,7 +439,7 @@ static void freduce_coefficients(limb *output) {
|
||||
output[0] -= over << 26;
|
||||
output[1] += over;
|
||||
}
|
||||
|
||||
|
||||
/* Now output[0,2..9] are reduced, and |output[1]| < 2^25 + 2^16 < 2^26. The
|
||||
* bound on |output[1]| is sufficient to meet our needs. */
|
||||
}
|
||||
@ -576,11 +578,11 @@ static void fcontract32(u8 *output, limb *input_limbs)
|
||||
int j;
|
||||
s32 input[10];
|
||||
s32 mask;
|
||||
|
||||
|
||||
/* |input_limbs[i]| < 2^26, so it's valid to convert to an s32. */
|
||||
for (i = 0; i < 10; i++)
|
||||
input[i] = (s32)input_limbs[i];
|
||||
|
||||
|
||||
for (j = 0; j < 2; ++j) {
|
||||
for (i = 0; i < 9; ++i) {
|
||||
if ((i & 1) == 1) {
|
||||
@ -597,7 +599,7 @@ static void fcontract32(u8 *output, limb *input_limbs)
|
||||
input[i+1] = input[i+1] - carry;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* There's no greater limb for input[9] to borrow from, but we can multiply
|
||||
* by 19 and borrow from input[0], which is valid mod 2^255-19. */
|
||||
{
|
||||
@ -606,19 +608,19 @@ static void fcontract32(u8 *output, limb *input_limbs)
|
||||
input[9] = input[9] + (carry << 25);
|
||||
input[0] = input[0] - (carry * 19);
|
||||
}
|
||||
|
||||
|
||||
/* After the first iteration, input[1..9] are non-negative and fit within
|
||||
* 25 or 26 bits, depending on position. However, input[0] may be
|
||||
* negative. */
|
||||
}
|
||||
|
||||
|
||||
/* The first borrow-propagation pass above ended with every limb
|
||||
except (possibly) input[0] non-negative.
|
||||
|
||||
|
||||
If input[0] was negative after the first pass, then it was because of a
|
||||
carry from input[9]. On entry, input[9] < 2^26 so the carry was, at most,
|
||||
one, since (2**26-1) >> 25 = 1. Thus input[0] >= -19.
|
||||
|
||||
|
||||
In the second pass, each limb is decreased by at most one. Thus the second
|
||||
borrow-propagation pass could only have wrapped around to decrease
|
||||
input[0] again if the first pass left input[0] negative *and* input[1]
|
||||
@ -630,7 +632,7 @@ static void fcontract32(u8 *output, limb *input_limbs)
|
||||
input[0] = input[0] + (carry << 26);
|
||||
input[1] = input[1] - carry;
|
||||
}
|
||||
|
||||
|
||||
/* All input[i] are now non-negative. However, there might be values between
|
||||
* 2^25 and 2^26 in a limb which is, nominally, 25 bits wide. */
|
||||
for (j = 0; j < 2; j++) {
|
||||
@ -645,21 +647,21 @@ static void fcontract32(u8 *output, limb *input_limbs)
|
||||
input[i+1] += carry;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
const s32 carry = input[9] >> 25;
|
||||
input[9] &= 0x1ffffff;
|
||||
input[0] += 19*carry;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* If the first carry-chain pass, just above, ended up with a carry from
|
||||
* input[9], and that caused input[0] to be out-of-bounds, then input[0] was
|
||||
* < 2^26 + 2*19, because the carry was, at most, two.
|
||||
*
|
||||
* If the second pass carried from input[9] again then input[0] is < 2*19 and
|
||||
* the input[9] -> input[0] carry didn't push input[0] out of bounds. */
|
||||
|
||||
|
||||
/* It still remains the case that input might be between 2^255-19 and 2^255.
|
||||
* In this case, input[1..9] must take their maximum value and input[0] must
|
||||
* be >= (2^255-19) & 0x3ffffff, which is 0x3ffffed. */
|
||||
@ -671,11 +673,11 @@ static void fcontract32(u8 *output, limb *input_limbs)
|
||||
mask &= s32_eq(input[i], 0x3ffffff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* mask is either 0xffffffff (if input >= 2^255-19) and zero otherwise. Thus
|
||||
* this conditionally subtracts 2^255-19. */
|
||||
input[0] -= mask & 0x3ffffed;
|
||||
|
||||
|
||||
for (i = 1; i < 10; i++) {
|
||||
if ((i & 1) == 1) {
|
||||
input[i] -= mask & 0x1ffffff;
|
||||
@ -683,7 +685,7 @@ static void fcontract32(u8 *output, limb *input_limbs)
|
||||
input[i] -= mask & 0x3ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
input[1] <<= 2;
|
||||
input[2] <<= 3;
|
||||
input[3] <<= 5;
|
||||
@ -882,12 +884,18 @@ inline bits320 crecip(const bits320 z)
|
||||
/* 2^255 - 21 */ return(fmul(t0, a));
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
void OS_randombytes(unsigned char *x,long xlen);
|
||||
#endif
|
||||
|
||||
bits256 rand256(int32_t privkeyflag)
|
||||
{
|
||||
bits256 randval;
|
||||
#ifndef __WIN32
|
||||
OS_randombytes(randval.bytes,sizeof(randval));
|
||||
#else
|
||||
randombytes_buf(randval.bytes,sizeof(randval));
|
||||
#endif
|
||||
if ( privkeyflag != 0 )
|
||||
randval.bytes[0] &= 0xf8, randval.bytes[31] &= 0x7f, randval.bytes[31] |= 0x40;
|
||||
return(randval);
|
||||
|
@ -1352,8 +1352,8 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
||||
void komodo_passport_iteration()
|
||||
{
|
||||
static long lastpos[34]; static char userpass[33][1024]; static uint32_t lasttime;
|
||||
int32_t maxseconds = 10;
|
||||
FILE *fp; int32_t baseid,limit,n,ht,isrealtime,expired,refid,blocks,longest; struct komodo_state *sp,*refsp; char *retstr,fname[512],*base,symbol[16],dest[16]; uint32_t buf[3],starttime; cJSON *infoobj,*result; uint64_t RTmask = 0;
|
||||
int32_t maxseconds = 30;
|
||||
FILE *fp; int32_t baseid,n,ht,isrealtime,expired,refid,blocks,longest; struct komodo_state *sp,*refsp; char *retstr,fname[512],*base,symbol[16],dest[16]; uint32_t buf[3],starttime; cJSON *infoobj,*result; uint64_t RTmask = 0;
|
||||
//printf("PASSPORT.(%s)\n",ASSETCHAINS_SYMBOL);
|
||||
expired = 0;
|
||||
while ( KOMODO_INITDONE == 0 )
|
||||
@ -1365,12 +1365,10 @@ void komodo_passport_iteration()
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
||||
{
|
||||
refid = 33;
|
||||
limit = 1000000;
|
||||
jumblr_iteration();
|
||||
}
|
||||
else
|
||||
{
|
||||
limit = 10000;
|
||||
refid = komodo_baseid(ASSETCHAINS_SYMBOL)+1; // illegal base -> baseid.-1 -> 0
|
||||
if ( refid == 0 )
|
||||
{
|
||||
@ -1384,7 +1382,7 @@ void komodo_passport_iteration()
|
||||
return;
|
||||
}*/
|
||||
starttime = (uint32_t)time(NULL);
|
||||
if ( 0 && starttime == lasttime )
|
||||
if ( starttime == lasttime )
|
||||
{
|
||||
usleep(1000);
|
||||
return;
|
||||
@ -1415,9 +1413,9 @@ void komodo_passport_iteration()
|
||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
printf("%s passport refid.%d %s fname.(%s) base.%s %ld %ld\n",ASSETCHAINS_SYMBOL,refid,symbol,fname,base,ftell(fp),lastpos[baseid]);
|
||||
fseek(fp,lastpos[baseid],SEEK_SET);
|
||||
while ( komodo_parsestatefile(sp,fp,symbol,dest) >= 0 && n < limit )
|
||||
while ( komodo_parsestatefile(sp,fp,symbol,dest) >= 0 && n < 1000 )
|
||||
{
|
||||
if ( n == limit-1 )
|
||||
if ( n == 999 )
|
||||
{
|
||||
if ( time(NULL) < starttime+maxseconds )
|
||||
n = 0;
|
||||
|
@ -24,6 +24,10 @@
|
||||
z_sendmany "fromaddress" [{"address":... ,"amount":..., "memo":"<hex>"},...] ( minconf ) ( fee )
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <wincrypt.h>
|
||||
#endif
|
||||
|
||||
#define JUMBLR_ADDR "RGhxXpXSSBTBm9EvNsXnTQczthMCxHX91t"
|
||||
#define JUMBLR_BTCADDR "18RmTJe9qMech8siuhYfMtHo8RtcN1obC6"
|
||||
#define JUMBLR_MAXSECRETADDRS 777
|
||||
@ -78,7 +82,7 @@ char *jumblr_importaddress(char *address)
|
||||
{
|
||||
char params[1024];
|
||||
sprintf(params,"[\"%s\", \"%s\", false]",address,address);
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"importaddress",params,BITCOIND_PORT));
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"importaddress",params,7771));
|
||||
}
|
||||
|
||||
char *jumblr_validateaddress(char *addr)
|
||||
@ -86,7 +90,7 @@ char *jumblr_validateaddress(char *addr)
|
||||
char params[1024];
|
||||
sprintf(params,"[\"%s\"]",addr);
|
||||
printf("validateaddress.%s\n",params);
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"validateaddress",params,BITCOIND_PORT));
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"validateaddress",params,7771));
|
||||
}
|
||||
|
||||
int32_t Jumblr_secretaddrfind(char *searchaddr)
|
||||
@ -155,6 +159,16 @@ int32_t Jumblr_depositaddradd(char *depositaddr) // external
|
||||
return(retval);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void OS_randombytes(unsigned char *x,long xlen)
|
||||
{
|
||||
HCRYPTPROV prov = 0;
|
||||
CryptAcquireContextW(&prov, NULL, NULL,PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT);
|
||||
CryptGenRandom(prov, xlen, x);
|
||||
CryptReleaseContext(prov, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t Jumblr_secretaddr(char *secretaddr)
|
||||
{
|
||||
uint32_t r;
|
||||
@ -207,28 +221,28 @@ char *jumblr_zgetnewaddress()
|
||||
{
|
||||
char params[1024];
|
||||
sprintf(params,"[]");
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getnewaddress",params,BITCOIND_PORT));
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getnewaddress",params,7771));
|
||||
}
|
||||
|
||||
char *jumblr_zlistoperationids()
|
||||
{
|
||||
char params[1024];
|
||||
sprintf(params,"[]");
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listoperationids",params,BITCOIND_PORT));
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listoperationids",params,7771));
|
||||
}
|
||||
|
||||
char *jumblr_zgetoperationresult(char *opid)
|
||||
{
|
||||
char params[1024];
|
||||
sprintf(params,"[[\"%s\"]]",opid);
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getoperationresult",params,BITCOIND_PORT));
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getoperationresult",params,7771));
|
||||
}
|
||||
|
||||
char *jumblr_zgetoperationstatus(char *opid)
|
||||
{
|
||||
char params[1024];
|
||||
sprintf(params,"[[\"%s\"]]",opid);
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getoperationstatus",params,BITCOIND_PORT));
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getoperationstatus",params,7771));
|
||||
}
|
||||
|
||||
char *jumblr_sendt_to_z(char *taddr,char *zaddr,double amount)
|
||||
@ -238,7 +252,7 @@ char *jumblr_sendt_to_z(char *taddr,char *zaddr,double amount)
|
||||
return(clonestr((char *)"{\"error\":\"illegal address in t to z\"}"));
|
||||
sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}, {\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",taddr,zaddr,amount-fee-JUMBLR_TXFEE,JUMBLR_ADDR,fee,JUMBLR_TXFEE);
|
||||
printf("t -> z: %s\n",params);
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,BITCOIND_PORT));
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,7771));
|
||||
}
|
||||
|
||||
char *jumblr_sendz_to_z(char *zaddrS,char *zaddrD,double amount)
|
||||
@ -249,7 +263,7 @@ char *jumblr_sendz_to_z(char *zaddrS,char *zaddrD,double amount)
|
||||
//sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}, {\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",zaddrS,zaddrD,amount-fee-JUMBLR_TXFEE,JUMBLR_ADDR,fee,JUMBLR_TXFEE);
|
||||
sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",zaddrS,zaddrD,amount-fee-JUMBLR_TXFEE,JUMBLR_TXFEE);
|
||||
printf("z -> z: %s\n",params);
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,BITCOIND_PORT));
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,7771));
|
||||
}
|
||||
|
||||
char *jumblr_sendz_to_t(char *zaddr,char *taddr,double amount)
|
||||
@ -259,56 +273,56 @@ char *jumblr_sendz_to_t(char *zaddr,char *taddr,double amount)
|
||||
return(clonestr((char *)"{\"error\":\"illegal address in z to t\"}"));
|
||||
sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}, {\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",zaddr,taddr,amount-fee-JUMBLR_TXFEE,JUMBLR_ADDR,fee,JUMBLR_TXFEE);
|
||||
printf("z -> t: %s\n",params);
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,BITCOIND_PORT));
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,7771));
|
||||
}
|
||||
|
||||
char *jumblr_zlistaddresses()
|
||||
{
|
||||
char params[1024];
|
||||
sprintf(params,"[]");
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listaddresses",params,BITCOIND_PORT));
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listaddresses",params,7771));
|
||||
}
|
||||
|
||||
char *jumblr_zlistreceivedbyaddress(char *addr)
|
||||
{
|
||||
char params[1024];
|
||||
sprintf(params,"[\"%s\", 1]",addr);
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listreceivedbyaddress",params,BITCOIND_PORT));
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listreceivedbyaddress",params,7771));
|
||||
}
|
||||
|
||||
char *jumblr_getreceivedbyaddress(char *addr)
|
||||
{
|
||||
char params[1024];
|
||||
sprintf(params,"[\"%s\", 1]",addr);
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"getreceivedbyaddress",params,BITCOIND_PORT));
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"getreceivedbyaddress",params,7771));
|
||||
}
|
||||
|
||||
char *jumblr_importprivkey(char *wifstr)
|
||||
{
|
||||
char params[1024];
|
||||
sprintf(params,"[\"%s\", \"\", false]",wifstr);
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"importprivkey",params,BITCOIND_PORT));
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"importprivkey",params,7771));
|
||||
}
|
||||
|
||||
char *jumblr_zgetbalance(char *addr)
|
||||
{
|
||||
char params[1024];
|
||||
sprintf(params,"[\"%s\", 1]",addr);
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getbalance",params,BITCOIND_PORT));
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getbalance",params,7771));
|
||||
}
|
||||
|
||||
char *jumblr_listunspent(char *coinaddr)
|
||||
{
|
||||
char params[1024];
|
||||
sprintf(params,"[1, 99999999, [\"%s\"]]",coinaddr);
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"listunspent",params,BITCOIND_PORT));
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"listunspent",params,7771));
|
||||
}
|
||||
|
||||
char *jumblr_gettransaction(char *txidstr)
|
||||
{
|
||||
char params[1024];
|
||||
sprintf(params,"[\"%s\", 1]",txidstr);
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,BITCOIND_PORT));
|
||||
return(jumblr_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,7771));
|
||||
}
|
||||
|
||||
int32_t jumblr_numvins(bits256 txid)
|
||||
@ -657,7 +671,7 @@ void jumblr_iteration()
|
||||
addr = zaddr+1;
|
||||
} else addr = zaddr;
|
||||
amount = jumblr_increment(r/3,height,total,biggest,medium,smallest);
|
||||
/*
|
||||
/*
|
||||
amount = 0;
|
||||
if ( (height % (JUMBLR_SYNCHRONIZED_BLOCKS*JUMBLR_SYNCHRONIZED_BLOCKS)) == 0 && total >= SATOSHIDEN * ((JUMBLR_INCR + 3*fee)*100 + 3*JUMBLR_TXFEE) )
|
||||
amount = SATOSHIDEN * ((JUMBLR_INCR + 3*fee)*100 + 3*JUMBLR_TXFEE);
|
||||
@ -769,4 +783,3 @@ void jumblr_iteration()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,11 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
#ifdef _WIN32
|
||||
#include <sodium.h>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#endif
|
||||
|
||||
#define SATOSHIDEN ((uint64_t)100000000L)
|
||||
#define dstr(x) ((double)(x) / SATOSHIDEN)
|
||||
@ -108,13 +113,13 @@ static inline int32_t sha256_vcompress(struct sha256_vstate * md,uint8_t *buf)
|
||||
LOAD32H(W[i],buf + (4*i));
|
||||
for (i=16; i<64; i++) // fill W[16..63]
|
||||
W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16];
|
||||
|
||||
|
||||
#define RND(a,b,c,d,e,f,g,h,i,ki) \
|
||||
t0 = h + Sigma1(e) + Ch(e, f, g) + ki + W[i]; \
|
||||
t1 = Sigma0(a) + Maj(a, b, c); \
|
||||
d += t0; \
|
||||
h = t0 + t1;
|
||||
|
||||
|
||||
RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],0,0x428a2f98);
|
||||
RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],1,0x71374491);
|
||||
RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],2,0xb5c0fbcf);
|
||||
@ -345,19 +350,19 @@ static int32_t rmd160_vcompress(struct rmd160_vstate *md,uint8_t *buf)
|
||||
{
|
||||
uint32_t aa,bb,cc,dd,ee,aaa,bbb,ccc,ddd,eee,X[16];
|
||||
int i;
|
||||
|
||||
|
||||
/* load words X */
|
||||
for (i = 0; i < 16; i++){
|
||||
LOAD32L(X[i], buf + (4 * i));
|
||||
}
|
||||
|
||||
|
||||
/* load state */
|
||||
aa = aaa = md->state[0];
|
||||
bb = bbb = md->state[1];
|
||||
cc = ccc = md->state[2];
|
||||
dd = ddd = md->state[3];
|
||||
ee = eee = md->state[4];
|
||||
|
||||
|
||||
/* round 1 */
|
||||
FF(aa, bb, cc, dd, ee, X[ 0], 11);
|
||||
FF(ee, aa, bb, cc, dd, X[ 1], 14);
|
||||
@ -375,7 +380,7 @@ static int32_t rmd160_vcompress(struct rmd160_vstate *md,uint8_t *buf)
|
||||
FF(cc, dd, ee, aa, bb, X[13], 7);
|
||||
FF(bb, cc, dd, ee, aa, X[14], 9);
|
||||
FF(aa, bb, cc, dd, ee, X[15], 8);
|
||||
|
||||
|
||||
/* round 2 */
|
||||
GG(ee, aa, bb, cc, dd, X[ 7], 7);
|
||||
GG(dd, ee, aa, bb, cc, X[ 4], 6);
|
||||
@ -393,7 +398,7 @@ static int32_t rmd160_vcompress(struct rmd160_vstate *md,uint8_t *buf)
|
||||
GG(bb, cc, dd, ee, aa, X[14], 7);
|
||||
GG(aa, bb, cc, dd, ee, X[11], 13);
|
||||
GG(ee, aa, bb, cc, dd, X[ 8], 12);
|
||||
|
||||
|
||||
/* round 3 */
|
||||
HH(dd, ee, aa, bb, cc, X[ 3], 11);
|
||||
HH(cc, dd, ee, aa, bb, X[10], 13);
|
||||
@ -411,7 +416,7 @@ static int32_t rmd160_vcompress(struct rmd160_vstate *md,uint8_t *buf)
|
||||
HH(aa, bb, cc, dd, ee, X[11], 12);
|
||||
HH(ee, aa, bb, cc, dd, X[ 5], 7);
|
||||
HH(dd, ee, aa, bb, cc, X[12], 5);
|
||||
|
||||
|
||||
/* round 4 */
|
||||
II(cc, dd, ee, aa, bb, X[ 1], 11);
|
||||
II(bb, cc, dd, ee, aa, X[ 9], 12);
|
||||
@ -429,7 +434,7 @@ static int32_t rmd160_vcompress(struct rmd160_vstate *md,uint8_t *buf)
|
||||
II(ee, aa, bb, cc, dd, X[ 5], 6);
|
||||
II(dd, ee, aa, bb, cc, X[ 6], 5);
|
||||
II(cc, dd, ee, aa, bb, X[ 2], 12);
|
||||
|
||||
|
||||
/* round 5 */
|
||||
JJ(bb, cc, dd, ee, aa, X[ 4], 9);
|
||||
JJ(aa, bb, cc, dd, ee, X[ 0], 15);
|
||||
@ -447,7 +452,7 @@ static int32_t rmd160_vcompress(struct rmd160_vstate *md,uint8_t *buf)
|
||||
JJ(dd, ee, aa, bb, cc, X[ 6], 8);
|
||||
JJ(cc, dd, ee, aa, bb, X[15], 5);
|
||||
JJ(bb, cc, dd, ee, aa, X[13], 6);
|
||||
|
||||
|
||||
/* parallel round 1 */
|
||||
JJJ(aaa, bbb, ccc, ddd, eee, X[ 5], 8);
|
||||
JJJ(eee, aaa, bbb, ccc, ddd, X[14], 9);
|
||||
@ -465,7 +470,7 @@ static int32_t rmd160_vcompress(struct rmd160_vstate *md,uint8_t *buf)
|
||||
JJJ(ccc, ddd, eee, aaa, bbb, X[10], 14);
|
||||
JJJ(bbb, ccc, ddd, eee, aaa, X[ 3], 12);
|
||||
JJJ(aaa, bbb, ccc, ddd, eee, X[12], 6);
|
||||
|
||||
|
||||
/* parallel round 2 */
|
||||
III(eee, aaa, bbb, ccc, ddd, X[ 6], 9);
|
||||
III(ddd, eee, aaa, bbb, ccc, X[11], 13);
|
||||
@ -483,7 +488,7 @@ static int32_t rmd160_vcompress(struct rmd160_vstate *md,uint8_t *buf)
|
||||
III(bbb, ccc, ddd, eee, aaa, X[ 9], 15);
|
||||
III(aaa, bbb, ccc, ddd, eee, X[ 1], 13);
|
||||
III(eee, aaa, bbb, ccc, ddd, X[ 2], 11);
|
||||
|
||||
|
||||
/* parallel round 3 */
|
||||
HHH(ddd, eee, aaa, bbb, ccc, X[15], 9);
|
||||
HHH(ccc, ddd, eee, aaa, bbb, X[ 5], 7);
|
||||
@ -501,7 +506,7 @@ static int32_t rmd160_vcompress(struct rmd160_vstate *md,uint8_t *buf)
|
||||
HHH(aaa, bbb, ccc, ddd, eee, X[ 0], 13);
|
||||
HHH(eee, aaa, bbb, ccc, ddd, X[ 4], 7);
|
||||
HHH(ddd, eee, aaa, bbb, ccc, X[13], 5);
|
||||
|
||||
|
||||
/* parallel round 4 */
|
||||
GGG(ccc, ddd, eee, aaa, bbb, X[ 8], 15);
|
||||
GGG(bbb, ccc, ddd, eee, aaa, X[ 6], 5);
|
||||
@ -519,7 +524,7 @@ static int32_t rmd160_vcompress(struct rmd160_vstate *md,uint8_t *buf)
|
||||
GGG(eee, aaa, bbb, ccc, ddd, X[ 7], 5);
|
||||
GGG(ddd, eee, aaa, bbb, ccc, X[10], 15);
|
||||
GGG(ccc, ddd, eee, aaa, bbb, X[14], 8);
|
||||
|
||||
|
||||
/* parallel round 5 */
|
||||
FFF(bbb, ccc, ddd, eee, aaa, X[12] , 8);
|
||||
FFF(aaa, bbb, ccc, ddd, eee, X[15] , 5);
|
||||
@ -537,7 +542,7 @@ static int32_t rmd160_vcompress(struct rmd160_vstate *md,uint8_t *buf)
|
||||
FFF(ddd, eee, aaa, bbb, ccc, X[ 3] , 13);
|
||||
FFF(ccc, ddd, eee, aaa, bbb, X[ 9] , 11);
|
||||
FFF(bbb, ccc, ddd, eee, aaa, X[11] , 11);
|
||||
|
||||
|
||||
/* combine results */
|
||||
ddd += cc + md->state[1]; /* final result for md->state[0] */
|
||||
md->state[1] = md->state[2] + dd + eee;
|
||||
@ -545,7 +550,7 @@ static int32_t rmd160_vcompress(struct rmd160_vstate *md,uint8_t *buf)
|
||||
md->state[3] = md->state[4] + aa + bbb;
|
||||
md->state[4] = md->state[0] + bb + ccc;
|
||||
md->state[0] = ddd;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -622,10 +627,10 @@ int rmd160_vdone(struct rmd160_vstate * md, unsigned char *out)
|
||||
}
|
||||
/* increase the length of the message */
|
||||
md->length += md->curlen * 8;
|
||||
|
||||
|
||||
/* append the '1' bit */
|
||||
md->buf[md->curlen++] = (unsigned char)0x80;
|
||||
|
||||
|
||||
/* if the length is currently above 56 bytes we append zeros
|
||||
* then compress. Then we can fall back to padding zeros and length
|
||||
* encoding like normal.
|
||||
@ -724,13 +729,13 @@ static const uint32_t crc32_tab[] = {
|
||||
uint32_t calc_crc32(uint32_t crc,const void *buf,size_t size)
|
||||
{
|
||||
const uint8_t *p;
|
||||
|
||||
|
||||
p = (const uint8_t *)buf;
|
||||
crc = crc ^ ~0U;
|
||||
|
||||
|
||||
while (size--)
|
||||
crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
|
||||
|
||||
|
||||
return crc ^ ~0U;
|
||||
}
|
||||
|
||||
@ -1106,6 +1111,7 @@ double OS_milliseconds()
|
||||
return(millis);
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
void OS_randombytes(unsigned char *x,long xlen)
|
||||
{
|
||||
static int fd = -1;
|
||||
@ -1135,6 +1141,7 @@ void OS_randombytes(unsigned char *x,long xlen)
|
||||
xlen -= i;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void lock_queue(queue_t *queue)
|
||||
{
|
||||
@ -1181,7 +1188,11 @@ void *queue_delete(queue_t *queue,struct queueitem *copy,int32_t copysize)
|
||||
{
|
||||
DL_FOREACH(queue->list,item)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if ( item == copy || (item->allocsize == copysize && memcmp((void *)((intptr_t)item + sizeof(struct queueitem)),(void *)((intptr_t)copy + sizeof(struct queueitem)),copysize) == 0) )
|
||||
#else
|
||||
if ( item == copy || (item->allocsize == copysize && memcmp((void *)((long)item + sizeof(struct queueitem)),(void *)((long)copy + sizeof(struct queueitem)),copysize) == 0) )
|
||||
#endif
|
||||
{
|
||||
DL_DELETE(queue->list,item);
|
||||
portable_mutex_unlock(&queue->mutex);
|
||||
@ -1326,7 +1337,11 @@ void komodo_configfile(char *symbol,uint16_t port)
|
||||
memcpy(&buf[sizeof(r)],&r2,sizeof(r2));
|
||||
memcpy(&buf[sizeof(r)+sizeof(r2)],symbol,strlen(symbol));
|
||||
crc = calc_crc32(0,(uint8_t *)buf,(int32_t)(sizeof(r)+sizeof(r2)+strlen(symbol)));
|
||||
#ifdef _WIN32
|
||||
randombytes_buf(buf2,sizeof(buf2));
|
||||
#else
|
||||
OS_randombytes(buf2,sizeof(buf2));
|
||||
#endif
|
||||
for (i=0; i<sizeof(buf2); i++)
|
||||
sprintf(&password[i*2],"%02x",buf2[i]);
|
||||
password[i*2] = 0;
|
||||
@ -1460,7 +1475,7 @@ char *iguanafmtstr = (char *)"curl --url \"http://127.0.0.1:7778\" --data \"{\\\
|
||||
|
||||
int32_t komodo_whoami(char *pubkeystr,int32_t height)
|
||||
{
|
||||
int32_t i,notaryid;
|
||||
int32_t i,notaryid;
|
||||
for (i=0; i<33; i++)
|
||||
sprintf(&pubkeystr[i<<1],"%02x",NOTARY_PUBKEY33[i]);
|
||||
pubkeystr[66] = 0;
|
||||
@ -1468,20 +1483,10 @@ int32_t komodo_whoami(char *pubkeystr,int32_t height)
|
||||
return(notaryid);
|
||||
}
|
||||
|
||||
char *argv0suffix[] =
|
||||
{
|
||||
(char *)"mnzd", (char *)"mnz-cli", (char *)"mnzd.exe", (char *)"mnz-cli.exe"
|
||||
};
|
||||
|
||||
char *argv0names[] =
|
||||
{
|
||||
(char *)"MNZ", (char *)"MNZ", (char *)"MNZ", (char *)"MNZ"
|
||||
};
|
||||
|
||||
void komodo_args(char *argv0)
|
||||
void komodo_args()
|
||||
{
|
||||
extern int64_t MAX_MONEY;
|
||||
std::string name,addn; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4]; FILE *fp; int32_t i,baseid,len,n;
|
||||
std::string name,addn; char *dirname,fname[512],magicstr[9]; uint8_t magic[4]; FILE *fp; int32_t i,baseid,len;
|
||||
IS_KOMODO_NOTARY = GetBoolArg("-notary", false);
|
||||
if ( (KOMODO_EXCHANGEWALLET= GetBoolArg("-exchange", false)) != 0 )
|
||||
fprintf(stderr,"KOMODO_EXCHANGEWALLET mode active\n");
|
||||
@ -1492,20 +1497,6 @@ void komodo_args(char *argv0)
|
||||
KOMODO_PAX = 1;
|
||||
} else KOMODO_PAX = GetArg("-pax",0);
|
||||
name = GetArg("-ac_name","");
|
||||
if ( argv0 != 0 )
|
||||
{
|
||||
len = (int32_t)strlen(argv0);
|
||||
for (i=0; i<sizeof(argv0suffix)/sizeof(*argv0suffix); i++)
|
||||
{
|
||||
n = (int32_t)strlen(argv0suffix[i]);
|
||||
if ( strcmp(&argv0[len - n],argv0suffix[i]) == 0 )
|
||||
{
|
||||
printf("ARGV0.(%s) -> matches suffix (%s) -> ac_name.(%s)\n",argv0,argv0suffix[i],argv0names[i]);
|
||||
name = argv0names[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( (KOMODO_REWIND= GetArg("-rewind",0)) != 0 )
|
||||
{
|
||||
printf("KOMODO_REWIND %d\n",KOMODO_REWIND);
|
||||
@ -1525,7 +1516,11 @@ void komodo_args(char *argv0)
|
||||
while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 )
|
||||
{
|
||||
fprintf(stderr,"waiting for datadir\n");
|
||||
#ifndef _WIN32
|
||||
sleep(3);
|
||||
#else
|
||||
boost::this_thread::sleep(boost::posix_time::milliseconds(3000));
|
||||
#endif
|
||||
}
|
||||
//fprintf(stderr,"Got datadir.(%s)\n",dirname);
|
||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
@ -1534,7 +1529,6 @@ void komodo_args(char *argv0)
|
||||
extern int COINBASE_MATURITY;
|
||||
komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1);
|
||||
COINBASE_MATURITY = 1;
|
||||
LogPrintf("ASSETCHAINS_PORT %s %u\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT);
|
||||
}
|
||||
ASSETCHAINS_NOTARIES = GetArg("-ac_notaries","");
|
||||
komodo_assetchain_pubkeys((char *)ASSETCHAINS_NOTARIES.c_str());
|
||||
@ -1587,8 +1581,7 @@ void komodo_args(char *argv0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
BITCOIND_PORT = GetArg("-rpcport", BaseParams().RPCPort());
|
||||
//fprintf(stderr,"%s RPC %u\n",ASSETCHAINS_SYMBOL,BITCOIND_PORT);
|
||||
//fprintf(stderr,"%s chain params initialized\n",ASSETCHAINS_SYMBOL);
|
||||
}
|
||||
|
||||
void komodo_nameset(char *symbol,char *dest,char *source)
|
||||
@ -1621,6 +1614,3 @@ struct komodo_state *komodo_stateptr(char *symbol,char *dest)
|
||||
komodo_nameset(symbol,dest,ASSETCHAINS_SYMBOL);
|
||||
return(komodo_stateptrget(symbol));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -14,7 +14,12 @@
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/thread/synchronized_value.hpp>
|
||||
#include <string>
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
|
||||
void AtomicTimer::start()
|
||||
@ -406,11 +411,17 @@ void ThreadShowMetricsScreen()
|
||||
|
||||
// Get current window size
|
||||
if (isTTY) {
|
||||
struct winsize w;
|
||||
w.ws_col = 0;
|
||||
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1 && w.ws_col != 0) {
|
||||
cols = w.ws_col;
|
||||
}
|
||||
#ifdef WIN32
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
|
||||
cols = csbi.srWindow.Right - csbi.srWindow.Left + 1;
|
||||
#else
|
||||
struct winsize w;
|
||||
w.ws_col = 0;
|
||||
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1 && w.ws_col != 0) {
|
||||
cols = w.ws_col;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (isScreen) {
|
||||
|
@ -47,13 +47,13 @@ JSDescription JSDescription::Randomized(
|
||||
const uint256& anchor,
|
||||
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS>& inputs,
|
||||
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS>& outputs,
|
||||
#ifdef __APPLE__
|
||||
#ifdef __LP64__
|
||||
boost::array<uint64_t, ZC_NUM_JS_INPUTS>& inputMap,
|
||||
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS>& outputMap,
|
||||
#else
|
||||
#else
|
||||
boost::array<size_t, ZC_NUM_JS_INPUTS>& inputMap,
|
||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS>& outputMap,
|
||||
#endif
|
||||
#endif
|
||||
CAmount vpub_old,
|
||||
CAmount vpub_new,
|
||||
bool computeProof,
|
||||
@ -151,7 +151,7 @@ CMutableTransaction::CMutableTransaction() : nVersion(CTransaction::MIN_CURRENT_
|
||||
CMutableTransaction::CMutableTransaction(const CTransaction& tx) : nVersion(tx.nVersion), vin(tx.vin), vout(tx.vout), nLockTime(tx.nLockTime),
|
||||
vjoinsplit(tx.vjoinsplit), joinSplitPubKey(tx.joinSplitPubKey), joinSplitSig(tx.joinSplitSig)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
uint256 CMutableTransaction::GetHash() const
|
||||
|
@ -87,13 +87,13 @@ public:
|
||||
const uint256& rt,
|
||||
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS>& inputs,
|
||||
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS>& outputs,
|
||||
#ifdef __APPLE__
|
||||
#ifdef __LP64__
|
||||
boost::array<uint64_t, ZC_NUM_JS_INPUTS>& inputMap,
|
||||
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS>& outputMap,
|
||||
#else
|
||||
#else
|
||||
boost::array<size_t, ZC_NUM_JS_INPUTS>& inputMap,
|
||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS>& outputMap,
|
||||
#endif
|
||||
#endif
|
||||
CAmount vpub_old,
|
||||
CAmount vpub_new,
|
||||
bool computeProof = true, // Set to false in some tests
|
||||
|
@ -47,7 +47,7 @@ double GetDifficultyINTERNAL(const CBlockIndex* blockindex, bool networkDifficul
|
||||
int nShiftAmount = (powLimit >> 24) & 0xff;
|
||||
|
||||
double dDiff =
|
||||
(double)(powLimit & 0x00ffffff) /
|
||||
(double)(powLimit & 0x00ffffff) /
|
||||
(double)(bits & 0x00ffffff);
|
||||
|
||||
while (nShift < nShiftAmount)
|
||||
@ -606,14 +606,14 @@ UniValue minerids(const UniValue& params, bool fHelp)
|
||||
for (j=0; j<33; j++)
|
||||
sprintf(&hexstr[j*2],"%02x",pubkeys[i][j]);
|
||||
item.push_back(Pair("notaryid", i));
|
||||
|
||||
|
||||
bitcoin_address(kmdaddr,60,pubkeys[i],33);
|
||||
m = (int32_t)strlen(kmdaddr);
|
||||
kmdaddress.resize(m);
|
||||
ptr = (char *)kmdaddress.data();
|
||||
memcpy(ptr,kmdaddr,m);
|
||||
item.push_back(Pair("KMDaddress", kmdaddress));
|
||||
|
||||
|
||||
item.push_back(Pair("pubkey", hex));
|
||||
item.push_back(Pair("blocks", tally[i]));
|
||||
a.push_back(item);
|
||||
@ -775,7 +775,7 @@ UniValue paxprices(const UniValue& params, bool fHelp)
|
||||
else
|
||||
{
|
||||
CBlockIndex *pblockindex = chainActive[heights[i]];
|
||||
|
||||
|
||||
item.push_back(Pair("t", (int64_t)pblockindex->nTime));
|
||||
item.push_back(Pair("p", (double)prices[i] / COIN));
|
||||
a.push_back(item);
|
||||
@ -976,7 +976,11 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
|
||||
|
||||
ZCIncrementalMerkleTree tree;
|
||||
pcoinsTip->GetAnchorAt(pcoinsTip->GetBestAnchor(), tree);
|
||||
#ifdef __APPLE__
|
||||
obj.push_back(Pair("commitments", (uint64_t)tree.size()));
|
||||
#else
|
||||
obj.push_back(Pair("commitments", tree.size()));
|
||||
#endif
|
||||
|
||||
const Consensus::Params& consensusParams = Params().GetConsensus();
|
||||
CBlockIndex* tip = chainActive.Tip();
|
||||
@ -1055,9 +1059,7 @@ UniValue getchaintips(const UniValue& params, bool fHelp)
|
||||
setTips.insert(item.second);
|
||||
BOOST_FOREACH(const PAIRTYPE(const uint256, CBlockIndex*)& item, mapBlockIndex)
|
||||
{
|
||||
const CBlockIndex* pprev=0;
|
||||
if ( item.second != 0 )
|
||||
pprev = item.second->pprev;
|
||||
const CBlockIndex* pprev = item.second->pprev;
|
||||
if (pprev)
|
||||
setTips.erase(pprev);
|
||||
}
|
||||
@ -1066,40 +1068,38 @@ UniValue getchaintips(const UniValue& params, bool fHelp)
|
||||
setTips.insert(chainActive.Tip());
|
||||
|
||||
/* Construct the output array. */
|
||||
UniValue res(UniValue::VARR); const CBlockIndex *forked;
|
||||
UniValue res(UniValue::VARR);
|
||||
BOOST_FOREACH(const CBlockIndex* block, setTips)
|
||||
{
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("height", block->nHeight));
|
||||
obj.push_back(Pair("hash", block->phashBlock->GetHex()));
|
||||
forked = chainActive.FindFork(block);
|
||||
if ( forked != 0 )
|
||||
{
|
||||
const int branchLen = block->nHeight - forked->nHeight;
|
||||
obj.push_back(Pair("branchlen", branchLen));
|
||||
|
||||
string status;
|
||||
if (chainActive.Contains(block)) {
|
||||
// This block is part of the currently active chain.
|
||||
status = "active";
|
||||
} else if (block->nStatus & BLOCK_FAILED_MASK) {
|
||||
// This block or one of its ancestors is invalid.
|
||||
status = "invalid";
|
||||
} else if (block->nChainTx == 0) {
|
||||
// This block cannot be connected because full block data for it or one of its parents is missing.
|
||||
status = "headers-only";
|
||||
} else if (block->IsValid(BLOCK_VALID_SCRIPTS)) {
|
||||
// This block is fully validated, but no longer part of the active chain. It was probably the active block once, but was reorganized.
|
||||
status = "valid-fork";
|
||||
} else if (block->IsValid(BLOCK_VALID_TREE)) {
|
||||
// The headers for this block are valid, but it has not been validated. It was probably never part of the most-work chain.
|
||||
status = "valid-headers";
|
||||
} else {
|
||||
// No clue.
|
||||
status = "unknown";
|
||||
}
|
||||
obj.push_back(Pair("status", status));
|
||||
|
||||
const int branchLen = block->nHeight - chainActive.FindFork(block)->nHeight;
|
||||
obj.push_back(Pair("branchlen", branchLen));
|
||||
|
||||
string status;
|
||||
if (chainActive.Contains(block)) {
|
||||
// This block is part of the currently active chain.
|
||||
status = "active";
|
||||
} else if (block->nStatus & BLOCK_FAILED_MASK) {
|
||||
// This block or one of its ancestors is invalid.
|
||||
status = "invalid";
|
||||
} else if (block->nChainTx == 0) {
|
||||
// This block cannot be connected because full block data for it or one of its parents is missing.
|
||||
status = "headers-only";
|
||||
} else if (block->IsValid(BLOCK_VALID_SCRIPTS)) {
|
||||
// This block is fully validated, but no longer part of the active chain. It was probably the active block once, but was reorganized.
|
||||
status = "valid-fork";
|
||||
} else if (block->IsValid(BLOCK_VALID_TREE)) {
|
||||
// The headers for this block are valid, but it has not been validated. It was probably never part of the most-work chain.
|
||||
status = "valid-headers";
|
||||
} else {
|
||||
// No clue.
|
||||
status = "unknown";
|
||||
}
|
||||
obj.push_back(Pair("status", status));
|
||||
|
||||
res.push_back(obj);
|
||||
}
|
||||
|
||||
|
@ -643,9 +643,6 @@ void ReadConfigFile(map<string, string>& mapSettingsRet,
|
||||
}
|
||||
// If datadir is changed in .conf file:
|
||||
ClearDatadirCache();
|
||||
extern uint16_t BITCOIND_PORT;
|
||||
BITCOIND_PORT = GetArg("-rpcport",BaseParams().RPCPort());
|
||||
//fprintf(stderr,"from conf file %s RPC %u, used to be %u\n",ASSETCHAINS_SYMBOL,BITCOIND_PORT,BITCOIND_PORT);
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
|
@ -63,15 +63,15 @@ AsyncRPCOperation_sendmany::AsyncRPCOperation_sendmany(
|
||||
if (minDepth < 0) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Minconf cannot be negative");
|
||||
}
|
||||
|
||||
|
||||
if (fromAddress.size() == 0) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "From address parameter missing");
|
||||
}
|
||||
|
||||
|
||||
if (tOutputs.size() == 0 && zOutputs.size() == 0) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "No recipients");
|
||||
}
|
||||
|
||||
|
||||
fromtaddr_ = CBitcoinAddress(fromAddress);
|
||||
isfromtaddr_ = fromtaddr_.IsValid();
|
||||
isfromzaddr_ = false;
|
||||
@ -86,7 +86,7 @@ AsyncRPCOperation_sendmany::AsyncRPCOperation_sendmany(
|
||||
if (!pwalletMain->GetSpendingKey(addr, key)) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid from address, no spending key found for zaddr");
|
||||
}
|
||||
|
||||
|
||||
isfromzaddr_ = true;
|
||||
frompaymentaddress_ = addr;
|
||||
spendingkey_ = key;
|
||||
@ -199,13 +199,13 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Could not find any non-coinbase UTXOs to spend.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isfromzaddr_ && !find_unspent_notes()) {
|
||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds, no unspent notes found for zaddr from address.");
|
||||
}
|
||||
|
||||
|
||||
CAmount t_inputs_total = 0;
|
||||
for (SendManyInputUTXO & t : t_inputs_) {
|
||||
t_inputs_total += std::get<2>(t);
|
||||
@ -237,7 +237,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
strprintf("Insufficient transparent funds, have %s, need %s",
|
||||
FormatMoney(t_inputs_total), FormatMoney(targetAmount)));
|
||||
}
|
||||
|
||||
|
||||
if (isfromzaddr_ && (z_inputs_total < targetAmount)) {
|
||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS,
|
||||
strprintf("Insufficient protected funds, have %s, need %s",
|
||||
@ -306,18 +306,18 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
|
||||
/**
|
||||
* SCENARIO #1
|
||||
*
|
||||
*
|
||||
* taddr -> taddrs
|
||||
*
|
||||
*
|
||||
* There are no zaddrs or joinsplits involved.
|
||||
*/
|
||||
if (isPureTaddrOnlyTx) {
|
||||
add_taddr_outputs_to_tx();
|
||||
|
||||
|
||||
CAmount funds = selectedUTXOAmount;
|
||||
CAmount fundsSpent = t_outputs_total + minersFee;
|
||||
CAmount change = funds - fundsSpent;
|
||||
|
||||
|
||||
if (change > 0) {
|
||||
add_taddr_change_output_to_tx(0,change);
|
||||
|
||||
@ -326,7 +326,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
FormatMoney(change)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("rawtxn", EncodeHexTx(tx_)));
|
||||
sign_send_raw_transaction(obj);
|
||||
@ -336,7 +336,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
* END SCENARIO #1
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// Prepare raw transaction to handle JoinSplits
|
||||
CMutableTransaction mtx(tx_);
|
||||
mtx.nVersion = 2;
|
||||
@ -373,10 +373,10 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
|
||||
/**
|
||||
* SCENARIO #2
|
||||
*
|
||||
*
|
||||
* taddr -> taddrs
|
||||
* -> zaddrs
|
||||
*
|
||||
*
|
||||
* Note: Consensus rule states that coinbase utxos can only be sent to a zaddr.
|
||||
* Local wallet rule does not allow any change when sending coinbase utxos
|
||||
* since there is currently no way to specify a change address and we don't
|
||||
@ -384,11 +384,11 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
*/
|
||||
if (isfromtaddr_) {
|
||||
add_taddr_outputs_to_tx();
|
||||
|
||||
|
||||
CAmount funds = selectedUTXOAmount;
|
||||
CAmount fundsSpent = t_outputs_total + minersFee + z_outputs_total;
|
||||
CAmount change = funds - fundsSpent;
|
||||
|
||||
|
||||
if (change > 0) {
|
||||
if (selectedUTXOCoinbase) {
|
||||
assert(isSingleZaddrOutput);
|
||||
@ -425,7 +425,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
jso.memo = get_memo_from_hex_string(hexMemo);
|
||||
}
|
||||
info.vjsout.push_back(jso);
|
||||
|
||||
|
||||
// Funds are removed from the value pool and enter the private pool
|
||||
info.vpub_old += value;
|
||||
}
|
||||
@ -436,21 +436,21 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
}
|
||||
/**
|
||||
* END SCENARIO #2
|
||||
*/
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* SCENARIO #3
|
||||
*
|
||||
*
|
||||
* zaddr -> taddrs
|
||||
* -> zaddrs
|
||||
*
|
||||
*
|
||||
* Processing order:
|
||||
* Part 1: taddrs and miners fee
|
||||
* Part 2: zaddrs
|
||||
* Part 2: zaddrs
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* SCENARIO #3
|
||||
* Part 1: Add to the transparent value pool.
|
||||
@ -498,7 +498,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
wtxDepth
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Put value back into the value pool
|
||||
if (noteFunds >= taddrTargetAmount) {
|
||||
jsChange = noteFunds - taddrTargetAmount;
|
||||
@ -516,7 +516,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
if (jsChange > 0) {
|
||||
info.vjsout.push_back(JSOutput());
|
||||
info.vjsout.push_back(JSOutput(frompaymentaddress_, jsChange));
|
||||
|
||||
|
||||
LogPrint("zrpcunsafe", "%s: generating note for change (amount=%s)\n",
|
||||
getId(),
|
||||
FormatMoney(jsChange)
|
||||
@ -535,13 +535,13 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
/**
|
||||
* SCENARIO #3
|
||||
* Part 2: Send to zaddrs by chaining JoinSplits together and immediately consuming any change
|
||||
*/
|
||||
*/
|
||||
if (z_outputs_total>0) {
|
||||
|
||||
// Keep track of treestate within this transaction
|
||||
// Keep track of treestate within this transaction
|
||||
boost::unordered_map<uint256, ZCIncrementalMerkleTree, CCoinsKeyHasher> intermediates;
|
||||
std::vector<uint256> previousCommitments;
|
||||
|
||||
|
||||
while (zOutputsDeque.size() > 0) {
|
||||
AsyncJoinSplitInfo info;
|
||||
info.vpub_old = 0;
|
||||
@ -557,20 +557,20 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
if (tx_.vjoinsplit.size() > 0) {
|
||||
prevJoinSplit = tx_.vjoinsplit.back();
|
||||
}
|
||||
|
||||
|
||||
// If there is no change, the chain has terminated so we can reset the tracked treestate.
|
||||
if (jsChange==0 && tx_.vjoinsplit.size() > 0) {
|
||||
intermediates.clear();
|
||||
previousCommitments.clear();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Consume change as the first input of the JoinSplit.
|
||||
//
|
||||
if (jsChange > 0) {
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
// Update tree state with previous joinsplit
|
||||
// Update tree state with previous joinsplit
|
||||
ZCIncrementalMerkleTree tree;
|
||||
auto it = intermediates.find(prevJoinSplit.anchor);
|
||||
if (it != intermediates.end()) {
|
||||
@ -578,7 +578,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
} else if (!pcoinsTip->GetAnchorAt(prevJoinSplit.anchor, tree)) {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Could not find previous JoinSplit anchor");
|
||||
}
|
||||
|
||||
|
||||
assert(changeOutputIndex != -1);
|
||||
boost::optional<ZCIncrementalWitness> changeWitness;
|
||||
int n = 0;
|
||||
@ -610,9 +610,9 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
|
||||
Note note = plaintext.note(frompaymentaddress_);
|
||||
info.notes.push_back(note);
|
||||
|
||||
|
||||
jsInputValue += plaintext.value;
|
||||
|
||||
|
||||
LogPrint("zrpcunsafe", "%s: spending change (amount=%s)\n",
|
||||
getId(),
|
||||
FormatMoney(plaintext.value)
|
||||
@ -623,7 +623,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Consume spendable non-change notes
|
||||
//
|
||||
@ -649,9 +649,9 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
|
||||
vOutPoints.push_back(jso);
|
||||
vInputNotes.push_back(note);
|
||||
|
||||
|
||||
jsInputValue += noteFunds;
|
||||
|
||||
|
||||
int wtxHeight = -1;
|
||||
int wtxDepth = -1;
|
||||
{
|
||||
@ -670,14 +670,14 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
wtxDepth
|
||||
);
|
||||
}
|
||||
|
||||
// Add history of previous commitments to witness
|
||||
|
||||
// Add history of previous commitments to witness
|
||||
if (vInputNotes.size() > 0) {
|
||||
|
||||
if (vInputWitnesses.size()==0) {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Could not find witness for note commitment");
|
||||
}
|
||||
|
||||
|
||||
for (auto & optionalWitness : vInputWitnesses) {
|
||||
if (!optionalWitness) {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Witness for note commitment is null");
|
||||
@ -695,18 +695,18 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
}
|
||||
|
||||
// The jsAnchor is null if this JoinSplit is at the start of a new chain
|
||||
if (jsAnchor.IsNull()) {
|
||||
jsAnchor = inputAnchor;
|
||||
if (jsAnchor.IsNull()) {
|
||||
jsAnchor = inputAnchor;
|
||||
}
|
||||
|
||||
// Add spendable notes as inputs
|
||||
std::copy(vInputNotes.begin(), vInputNotes.end(), std::back_inserter(info.notes));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Find recipient to transfer funds to
|
||||
//
|
||||
//
|
||||
SendManyRecipient smr = zOutputsDeque.front();
|
||||
std::string address = std::get<0>(smr);
|
||||
CAmount value = std::get<1>(smr);
|
||||
@ -722,7 +722,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
}
|
||||
outAmount += minersFee;
|
||||
}
|
||||
|
||||
|
||||
if (jsInputValue > outAmount) {
|
||||
jsChange = jsInputValue - outAmount;
|
||||
} else if (outAmount > jsInputValue) {
|
||||
@ -737,12 +737,12 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
value -= minersFee;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!minersFeeProcessed) {
|
||||
minersFeeProcessed = true;
|
||||
info.vpub_new += minersFee; // funds flowing back to public pool
|
||||
}
|
||||
|
||||
|
||||
// create output for recipient
|
||||
PaymentAddress pa = CZCPaymentAddress(address).Get();
|
||||
JSOutput jso = JSOutput(pa, value);
|
||||
@ -750,7 +750,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
jso.memo = get_memo_from_hex_string(hexMemo);
|
||||
}
|
||||
info.vjsout.push_back(jso);
|
||||
|
||||
|
||||
// create output for any change
|
||||
if (jsChange>0) {
|
||||
info.vjsout.push_back(JSOutput(frompaymentaddress_, jsChange));
|
||||
@ -779,7 +779,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
* Raw transaction as hex string should be in object field "rawtxn"
|
||||
*/
|
||||
void AsyncRPCOperation_sendmany::sign_send_raw_transaction(UniValue obj)
|
||||
{
|
||||
{
|
||||
// Sign the raw transaction
|
||||
UniValue rawtxnValue = find_value(obj, "rawtxn");
|
||||
if (rawtxnValue.isNull()) {
|
||||
@ -870,7 +870,7 @@ bool AsyncRPCOperation_sendmany::find_utxos(bool fAcceptCoinbase=false) {
|
||||
if (isCoinbase && fAcceptCoinbase==false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
CAmount nValue = out.tx->vout[out.i].nValue;
|
||||
SendManyInputUTXO utxo(out.tx->GetHash(), out.i, nValue, isCoinbase);
|
||||
t_inputs_.push_back(utxo);
|
||||
@ -904,7 +904,7 @@ bool AsyncRPCOperation_sendmany::find_unspent_notes() {
|
||||
HexStr(data).substr(0, 10)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (z_inputs_.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
@ -986,13 +986,13 @@ UniValue AsyncRPCOperation_sendmany::perform_joinsplit(
|
||||
{info.vjsin[0], info.vjsin[1]};
|
||||
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs
|
||||
{info.vjsout[0], info.vjsout[1]};
|
||||
#ifdef __APPLE__
|
||||
#ifdef __LP64__
|
||||
boost::array<uint64_t, ZC_NUM_JS_INPUTS> inputMap;
|
||||
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
||||
#else
|
||||
#else
|
||||
boost::array<size_t, ZC_NUM_JS_INPUTS> inputMap;
|
||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
||||
#endif
|
||||
#endif
|
||||
JSDescription jsdesc = JSDescription::Randomized(
|
||||
*pzcashParams,
|
||||
joinSplitPubKey_,
|
||||
@ -1132,7 +1132,7 @@ void AsyncRPCOperation_sendmany::add_taddr_change_output_to_tx(CBitcoinAddress *
|
||||
|
||||
boost::array<unsigned char, ZC_MEMO_SIZE> AsyncRPCOperation_sendmany::get_memo_from_hex_string(std::string s) {
|
||||
boost::array<unsigned char, ZC_MEMO_SIZE> memo = {{0x00}};
|
||||
|
||||
|
||||
std::vector<unsigned char> rawMemo = ParseHex(s.c_str());
|
||||
|
||||
// If ParseHex comes across a non-hex char, it will stop but still return results so far.
|
||||
@ -1140,11 +1140,11 @@ boost::array<unsigned char, ZC_MEMO_SIZE> AsyncRPCOperation_sendmany::get_memo_f
|
||||
if (slen % 2 !=0 || (slen>0 && rawMemo.size()!=slen/2)) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Memo must be in hexadecimal format");
|
||||
}
|
||||
|
||||
|
||||
if (rawMemo.size() > ZC_MEMO_SIZE) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Memo size of %d is too big, maximum allowed is %d", rawMemo.size(), ZC_MEMO_SIZE));
|
||||
}
|
||||
|
||||
|
||||
// copy vector into boost array
|
||||
int lenMemo = rawMemo.size();
|
||||
for (int i = 0; i < ZC_MEMO_SIZE && i < lenMemo; i++) {
|
||||
@ -1167,4 +1167,3 @@ UniValue AsyncRPCOperation_sendmany::getStatus() const {
|
||||
obj.push_back(Pair("params", contextinfo_ ));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
110
src/wallet/gtest/test_transaction.cpp
Executable file
110
src/wallet/gtest/test_transaction.cpp
Executable file
@ -0,0 +1,110 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "primitives/transaction.h"
|
||||
#include "zcash/Note.hpp"
|
||||
#include "zcash/Address.hpp"
|
||||
|
||||
extern ZCJoinSplit* params;
|
||||
extern int GenZero(int n);
|
||||
extern int GenMax(int n);
|
||||
|
||||
TEST(Transaction, JSDescriptionRandomized) {
|
||||
// construct a merkle tree
|
||||
ZCIncrementalMerkleTree merkleTree;
|
||||
|
||||
libzcash::SpendingKey k = libzcash::SpendingKey::random();
|
||||
libzcash::PaymentAddress addr = k.address();
|
||||
|
||||
libzcash::Note note(addr.a_pk, 100, uint256(), uint256());
|
||||
|
||||
// commitment from coin
|
||||
uint256 commitment = note.cm();
|
||||
|
||||
// insert commitment into the merkle tree
|
||||
merkleTree.append(commitment);
|
||||
|
||||
// compute the merkle root we will be working with
|
||||
uint256 rt = merkleTree.root();
|
||||
|
||||
auto witness = merkleTree.witness();
|
||||
|
||||
// create JSDescription
|
||||
uint256 pubKeyHash;
|
||||
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS> inputs = {
|
||||
libzcash::JSInput(witness, note, k),
|
||||
libzcash::JSInput() // dummy input of zero value
|
||||
};
|
||||
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs = {
|
||||
libzcash::JSOutput(addr, 50),
|
||||
libzcash::JSOutput(addr, 50)
|
||||
};
|
||||
#ifdef __LP64__ // required for building on MacOS
|
||||
boost::array<uint64_t, ZC_NUM_JS_INPUTS> inputMap;
|
||||
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
||||
#else
|
||||
boost::array<size_t, ZC_NUM_JS_INPUTS> inputMap;
|
||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
||||
#endif
|
||||
|
||||
{
|
||||
auto jsdesc = JSDescription::Randomized(
|
||||
*params, pubKeyHash, rt,
|
||||
inputs, outputs,
|
||||
inputMap, outputMap,
|
||||
0, 0, false);
|
||||
|
||||
#ifdef __LP64__ // required for building on MacOS
|
||||
std::set<uint64_t> inputSet(inputMap.begin(), inputMap.end());
|
||||
std::set<uint64_t> expectedInputSet {0, 1};
|
||||
#else
|
||||
std::set<size_t> inputSet(inputMap.begin(), inputMap.end());
|
||||
std::set<size_t> expectedInputSet {0, 1};
|
||||
#endif
|
||||
EXPECT_EQ(expectedInputSet, inputSet);
|
||||
|
||||
#ifdef __LP64__ // required for building on MacOS
|
||||
std::set<uint64_t> outputSet(outputMap.begin(), outputMap.end());
|
||||
std::set<uint64_t> expectedOutputSet {0, 1};
|
||||
#else
|
||||
std::set<size_t> outputSet(outputMap.begin(), outputMap.end());
|
||||
std::set<size_t> expectedOutputSet {0, 1};
|
||||
#endif
|
||||
EXPECT_EQ(expectedOutputSet, outputSet);
|
||||
}
|
||||
|
||||
{
|
||||
auto jsdesc = JSDescription::Randomized(
|
||||
*params, pubKeyHash, rt,
|
||||
inputs, outputs,
|
||||
inputMap, outputMap,
|
||||
0, 0, false, GenZero);
|
||||
|
||||
#ifdef __LP64__ // required for building on MacOS
|
||||
boost::array<uint64_t, ZC_NUM_JS_INPUTS> expectedInputMap {1, 0};
|
||||
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {1, 0};
|
||||
#else
|
||||
boost::array<size_t, ZC_NUM_JS_INPUTS> expectedInputMap {1, 0};
|
||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {1, 0};
|
||||
#endif
|
||||
EXPECT_EQ(expectedInputMap, inputMap);
|
||||
EXPECT_EQ(expectedOutputMap, outputMap);
|
||||
}
|
||||
|
||||
{
|
||||
auto jsdesc = JSDescription::Randomized(
|
||||
*params, pubKeyHash, rt,
|
||||
inputs, outputs,
|
||||
inputMap, outputMap,
|
||||
0, 0, false, GenMax);
|
||||
|
||||
#ifdef __LP64__ // required for building on MacOS
|
||||
boost::array<uint64_t, ZC_NUM_JS_INPUTS> expectedInputMap {0, 1};
|
||||
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {0, 1};
|
||||
#else
|
||||
boost::array<size_t, ZC_NUM_JS_INPUTS> expectedInputMap {0, 1};
|
||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {0, 1};
|
||||
#endif
|
||||
EXPECT_EQ(expectedInputMap, inputMap);
|
||||
EXPECT_EQ(expectedOutputMap, outputMap);
|
||||
}
|
||||
}
|
@ -114,7 +114,7 @@ UniValue getnewaddress(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() > 1)
|
||||
throw runtime_error(
|
||||
"getnewaddress ( \"account\" )\n"
|
||||
@ -191,7 +191,7 @@ UniValue getaccountaddress(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() != 1)
|
||||
throw runtime_error(
|
||||
"getaccountaddress \"account\"\n"
|
||||
@ -223,7 +223,7 @@ UniValue getrawchangeaddress(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() > 1)
|
||||
throw runtime_error(
|
||||
"getrawchangeaddress\n"
|
||||
@ -258,7 +258,7 @@ UniValue setaccount(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||
throw runtime_error(
|
||||
"setaccount \"zcashaddress\" \"account\"\n"
|
||||
@ -304,7 +304,7 @@ UniValue getaccount(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() != 1)
|
||||
throw runtime_error(
|
||||
"getaccount \"zcashaddress\"\n"
|
||||
@ -336,7 +336,7 @@ UniValue getaddressesbyaccount(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() != 1)
|
||||
throw runtime_error(
|
||||
"getaddressesbyaccount \"account\"\n"
|
||||
@ -418,7 +418,7 @@ UniValue sendtoaddress(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() < 2 || params.size() > 5)
|
||||
throw runtime_error(
|
||||
"sendtoaddress \"zcashaddress\" amount ( \"comment\" \"comment-to\" subtractfeefromamount )\n"
|
||||
@ -689,7 +689,7 @@ UniValue listaddressgroupings(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp)
|
||||
throw runtime_error(
|
||||
"listaddressgroupings\n"
|
||||
@ -740,7 +740,7 @@ UniValue signmessage(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() != 2)
|
||||
throw runtime_error(
|
||||
"signmessage \"zcashaddress\" \"message\"\n"
|
||||
@ -796,7 +796,7 @@ UniValue getreceivedbyaddress(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||
throw runtime_error(
|
||||
"getreceivedbyaddress \"zcashaddress\" ( minconf )\n"
|
||||
@ -854,7 +854,7 @@ UniValue getreceivedbyaccount(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||
throw runtime_error(
|
||||
"getreceivedbyaccount \"account\" ( minconf )\n"
|
||||
@ -943,7 +943,7 @@ UniValue getbalance(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() > 3)
|
||||
throw runtime_error(
|
||||
"getbalance ( \"account\" minconf includeWatchonly )\n"
|
||||
@ -1015,7 +1015,7 @@ UniValue getunconfirmedbalance(const UniValue ¶ms, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() > 0)
|
||||
throw runtime_error(
|
||||
"getunconfirmedbalance\n"
|
||||
@ -1031,7 +1031,7 @@ UniValue movecmd(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() < 3 || params.size() > 5)
|
||||
throw runtime_error(
|
||||
"move \"fromaccount\" \"toaccount\" amount ( minconf \"comment\" )\n"
|
||||
@ -1103,7 +1103,7 @@ UniValue sendfrom(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() < 3 || params.size() > 6)
|
||||
throw runtime_error(
|
||||
"sendfrom \"fromaccount\" \"tozcashaddress\" amount ( minconf \"comment\" \"comment-to\" )\n"
|
||||
@ -1168,7 +1168,7 @@ UniValue sendmany(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() < 2 || params.size() > 5)
|
||||
throw runtime_error(
|
||||
"sendmany \"fromaccount\" {\"address\":amount,...} ( minconf \"comment\" [\"address\",...] )\n"
|
||||
@ -1282,7 +1282,7 @@ UniValue addmultisigaddress(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() < 2 || params.size() > 3)
|
||||
{
|
||||
string msg = "addmultisigaddress nrequired [\"key\",...] ( \"account\" )\n"
|
||||
@ -1463,7 +1463,7 @@ UniValue listreceivedbyaddress(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() > 3)
|
||||
throw runtime_error(
|
||||
"listreceivedbyaddress ( minconf includeempty includeWatchonly)\n"
|
||||
@ -1500,7 +1500,7 @@ UniValue listreceivedbyaccount(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() > 3)
|
||||
throw runtime_error(
|
||||
"listreceivedbyaccount ( minconf includeempty includeWatchonly)\n"
|
||||
@ -1567,7 +1567,11 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
|
||||
entry.push_back(Pair("fee", ValueFromAmount(-nFee)));
|
||||
if (fLong)
|
||||
WalletTxToJSON(wtx, entry);
|
||||
#ifdef __APPLE__
|
||||
entry.push_back(Pair("size", (uint64_t)static_cast<CTransaction>(wtx).GetSerializeSize(SER_NETWORK, PROTOCOL_VERSION)));
|
||||
#else
|
||||
entry.push_back(Pair("size", static_cast<CTransaction>(wtx).GetSerializeSize(SER_NETWORK, PROTOCOL_VERSION)));
|
||||
#endif
|
||||
ret.push_back(entry);
|
||||
}
|
||||
}
|
||||
@ -1604,7 +1608,11 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
|
||||
entry.push_back(Pair("vout", r.vout));
|
||||
if (fLong)
|
||||
WalletTxToJSON(wtx, entry);
|
||||
entry.push_back(Pair("size", static_cast<CTransaction>(wtx).GetSerializeSize(SER_NETWORK, PROTOCOL_VERSION)));
|
||||
#ifdef __APPLE__
|
||||
entry.push_back(Pair("size", (uint64_t)static_cast<CTransaction>(wtx).GetSerializeSize(SER_NETWORK, PROTOCOL_VERSION)));
|
||||
#else
|
||||
entry.push_back(Pair("size", static_cast<CTransaction>(wtx).GetSerializeSize(SER_NETWORK, PROTOCOL_VERSION)));
|
||||
#endif
|
||||
ret.push_back(entry);
|
||||
}
|
||||
}
|
||||
@ -1632,7 +1640,7 @@ UniValue listtransactions(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() > 4)
|
||||
throw runtime_error(
|
||||
"listtransactions ( \"account\" count from includeWatchonly)\n"
|
||||
@ -1754,7 +1762,7 @@ UniValue listaccounts(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() > 2)
|
||||
throw runtime_error(
|
||||
"listaccounts ( minconf includeWatchonly)\n"
|
||||
@ -1834,7 +1842,7 @@ UniValue listsinceblock(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp)
|
||||
throw runtime_error(
|
||||
"listsinceblock ( \"blockhash\" target-confirmations includeWatchonly)\n"
|
||||
@ -1925,7 +1933,7 @@ UniValue gettransaction(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||
throw runtime_error(
|
||||
"gettransaction \"txid\" ( includeWatchonly )\n"
|
||||
@ -2014,7 +2022,7 @@ UniValue backupwallet(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() != 1)
|
||||
throw runtime_error(
|
||||
"backupwallet \"destination\"\n"
|
||||
@ -2057,7 +2065,7 @@ UniValue keypoolrefill(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() > 1)
|
||||
throw runtime_error(
|
||||
"keypoolrefill ( newsize )\n"
|
||||
@ -2101,7 +2109,7 @@ UniValue walletpassphrase(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (pwalletMain->IsCrypted() && (fHelp || params.size() != 2))
|
||||
throw runtime_error(
|
||||
"walletpassphrase \"passphrase\" timeout\n"
|
||||
@ -2163,7 +2171,7 @@ UniValue walletpassphrasechange(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (pwalletMain->IsCrypted() && (fHelp || params.size() != 2))
|
||||
throw runtime_error(
|
||||
"walletpassphrasechange \"oldpassphrase\" \"newpassphrase\"\n"
|
||||
@ -2209,7 +2217,7 @@ UniValue walletlock(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (pwalletMain->IsCrypted() && (fHelp || params.size() != 0))
|
||||
throw runtime_error(
|
||||
"walletlock\n"
|
||||
@ -2316,7 +2324,7 @@ UniValue lockunspent(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() < 1 || params.size() > 2)
|
||||
throw runtime_error(
|
||||
"lockunspent unlock [{\"txid\":\"txid\",\"vout\":n},...]\n"
|
||||
@ -2400,7 +2408,7 @@ UniValue listlockunspent(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() > 0)
|
||||
throw runtime_error(
|
||||
"listlockunspent\n"
|
||||
@ -2449,7 +2457,7 @@ UniValue settxfee(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() < 1 || params.size() > 1)
|
||||
throw runtime_error(
|
||||
"settxfee amount\n"
|
||||
@ -2476,7 +2484,7 @@ UniValue getwalletinfo(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getwalletinfo\n"
|
||||
@ -2518,7 +2526,7 @@ UniValue resendwallettransactions(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"resendwallettransactions\n"
|
||||
@ -2545,7 +2553,7 @@ UniValue listunspent(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
|
||||
if (fHelp || params.size() > 3)
|
||||
throw runtime_error(
|
||||
"listunspent ( minconf maxconf [\"address\",...] )\n"
|
||||
@ -3241,8 +3249,8 @@ UniValue z_listaddresses(const UniValue& params, bool fHelp)
|
||||
CAmount getBalanceTaddr(std::string transparentAddress, int minDepth=1) {
|
||||
set<CBitcoinAddress> setAddress;
|
||||
vector<COutput> vecOutputs;
|
||||
CAmount balance = 0;
|
||||
|
||||
CAmount balance = 0;
|
||||
|
||||
if (transparentAddress.length() > 0) {
|
||||
CBitcoinAddress taddr = CBitcoinAddress(transparentAddress);
|
||||
if (!taddr.IsValid()) {
|
||||
@ -3250,7 +3258,7 @@ CAmount getBalanceTaddr(std::string transparentAddress, int minDepth=1) {
|
||||
}
|
||||
setAddress.insert(taddr);
|
||||
}
|
||||
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
|
||||
pwalletMain->AvailableCoins(vecOutputs, false, NULL, true);
|
||||
@ -3270,7 +3278,7 @@ CAmount getBalanceTaddr(std::string transparentAddress, int minDepth=1) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CAmount nValue = out.tx->vout[out.i].nValue; // komodo_interest
|
||||
balance += nValue;
|
||||
}
|
||||
@ -3318,7 +3326,7 @@ UniValue z_listreceivedbyaddress(const UniValue& params, bool fHelp)
|
||||
if (nMinDepth < 0) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Minimum number of confirmations cannot be less than 0");
|
||||
}
|
||||
|
||||
|
||||
// Check that the from address is valid.
|
||||
auto fromaddress = params[0].get_str();
|
||||
|
||||
@ -3333,8 +3341,8 @@ UniValue z_listreceivedbyaddress(const UniValue& params, bool fHelp)
|
||||
if (!pwalletMain->HaveSpendingKey(zaddr)) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "From address does not belong to this node, zaddr spending key not found.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
UniValue result(UniValue::VARR);
|
||||
std::vector<CNotePlaintextEntry> entries;
|
||||
pwalletMain->GetFilteredNotes(entries, fromaddress, nMinDepth, false);
|
||||
@ -3382,7 +3390,7 @@ UniValue z_getbalance(const UniValue& params, bool fHelp)
|
||||
if (nMinDepth < 0) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Minimum number of confirmations cannot be less than 0");
|
||||
}
|
||||
|
||||
|
||||
// Check that the from address is valid.
|
||||
auto fromaddress = params[0].get_str();
|
||||
bool fromTaddr = false;
|
||||
@ -3449,7 +3457,7 @@ UniValue z_gettotalbalance(const UniValue& params, bool fHelp)
|
||||
}
|
||||
|
||||
// getbalance and "getbalance * 1 true" should return the same number
|
||||
// but they don't because wtx.GetAmounts() does not handle tx where there are no outputs
|
||||
// but they don't because wtx.GetAmounts() does not handle tx where there are no outputs
|
||||
// pwalletMain->GetBalance() does not accept min depth parameter
|
||||
// so we use our own method to get balance of utxos.
|
||||
CAmount nBalance = getBalanceTaddr("", nMinDepth);
|
||||
@ -3479,7 +3487,7 @@ UniValue z_getoperationresult(const UniValue& params, bool fHelp)
|
||||
"\nResult:\n"
|
||||
"\" [object, ...]\" (array) A list of JSON objects\n"
|
||||
);
|
||||
|
||||
|
||||
// This call will remove finished operations
|
||||
return z_getoperationstatus_IMPL(params, true);
|
||||
}
|
||||
@ -3499,7 +3507,7 @@ UniValue z_getoperationstatus(const UniValue& params, bool fHelp)
|
||||
"\nResult:\n"
|
||||
"\" [object, ...]\" (array) A list of JSON objects\n"
|
||||
);
|
||||
|
||||
|
||||
// This call is idempotent so we don't want to remove finished operations
|
||||
return z_getoperationstatus_IMPL(params, false);
|
||||
}
|
||||
@ -3524,7 +3532,7 @@ UniValue z_getoperationstatus_IMPL(const UniValue& params, bool fRemoveFinishedO
|
||||
for (auto id : ids) {
|
||||
if (useFilter && !filter.count(id))
|
||||
continue;
|
||||
|
||||
|
||||
std::shared_ptr<AsyncRPCOperation> operation = q->getOperationForId(id);
|
||||
if (!operation) {
|
||||
continue;
|
||||
|
@ -161,7 +161,7 @@ public:
|
||||
// Transaction hash
|
||||
uint256 hash;
|
||||
// Index into CTransaction.vjoinsplit
|
||||
#ifdef __APPLE__
|
||||
#ifdef __LP64__
|
||||
uint64_t js;
|
||||
#else
|
||||
size_t js;
|
||||
@ -288,7 +288,7 @@ public:
|
||||
uint256 hashBlock;
|
||||
std::vector<uint256> vMerkleBranch;
|
||||
int nIndex;
|
||||
|
||||
|
||||
// memory only
|
||||
mutable bool fMerkleVerified;
|
||||
|
||||
@ -337,7 +337,7 @@ public:
|
||||
bool AcceptToMemoryPool(bool fLimitFree=true, bool fRejectAbsurdFee=true);
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* A transaction with a bunch of additional info that only the owner cares about.
|
||||
* It includes any unrecorded transactions needed to link it back to the block chain.
|
||||
*/
|
||||
@ -577,7 +577,7 @@ public:
|
||||
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,
|
||||
* and provides the ability to create new transactions.
|
||||
*/
|
||||
@ -880,7 +880,7 @@ public:
|
||||
//! Adds an encrypted spending key to the store, and saves it to disk (virtual method, declared in crypter.h)
|
||||
bool AddCryptedSpendingKey(const libzcash::PaymentAddress &address, const libzcash::ViewingKey &vk, const std::vector<unsigned char> &vchCryptedSecret);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Increment the next transaction order id
|
||||
* @return next transaction order id
|
||||
*/
|
||||
@ -1012,8 +1012,8 @@ public:
|
||||
|
||||
//! Verify the wallet database and perform salvage if required
|
||||
static bool Verify(const std::string& walletFile, std::string& warningString, std::string& errorString);
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Address book entry changed.
|
||||
* @note called with lock cs_wallet held.
|
||||
*/
|
||||
@ -1022,7 +1022,7 @@ public:
|
||||
const std::string &purpose,
|
||||
ChangeType status)> NotifyAddressBookChanged;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Wallet transaction added, removed or updated.
|
||||
* @note called with lock cs_wallet held.
|
||||
*/
|
||||
@ -1039,10 +1039,10 @@ public:
|
||||
bool GetBroadcastTransactions() const { return fBroadcastTransactions; }
|
||||
/** Set whether this wallet broadcasts transactions. */
|
||||
void SetBroadcastTransactions(bool broadcast) { fBroadcastTransactions = broadcast; }
|
||||
|
||||
|
||||
/* Find notes filtered by payment address, min depth, ability to spend */
|
||||
void GetFilteredNotes(std::vector<CNotePlaintextEntry> & outEntries, std::string address, int minDepth=1, bool ignoreSpent=true);
|
||||
|
||||
|
||||
};
|
||||
|
||||
/** A key allocated from the key pool. */
|
||||
@ -1070,7 +1070,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Account information.
|
||||
* Stored in wallet with key "acc"+string account name.
|
||||
*/
|
||||
@ -1101,7 +1101,7 @@ public:
|
||||
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Internal transfers.
|
||||
* Database key is acentry<account><counter>.
|
||||
*/
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "libsnark/common/profiling.hpp"
|
||||
char ASSETCHAINS_SYMBOL[16];
|
||||
int64_t MAX_MONEY = 200000000 * 100000000LL;
|
||||
uint16_t BITCOIND_PORT = 7771;
|
||||
|
||||
using namespace libzcash;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user