uni3
This commit is contained in:
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_CLI_BIN=$(top_builddir)/src/zcash-cli$(EXEEXT)
|
||||||
BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win$(WINDOWS_BITS)-setup$(EXEEXT)
|
BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win$(WINDOWS_BITS)-setup$(EXEEXT)
|
||||||
|
|
||||||
##OSX_APP=Bitcoin-Qt.app
|
if TARGET_DARWIN
|
||||||
##OSX_DMG=Bitcoin-Core.dmg
|
OSX_APP=Bitcoin-Qt.app
|
||||||
##OSX_BACKGROUND_IMAGE=background.tiff
|
OSX_DMG=Bitcoin-Core.dmg
|
||||||
##OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
|
OSX_BACKGROUND_IMAGE=background.tiff
|
||||||
##OSX_FANCY_PLIST=$(top_srcdir)/contrib/macdeploy/fancy.plist
|
OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
|
||||||
##OSX_BASE_LPROJ_DIR=$(top_srcdir)/contrib/macdeploy/Base.lproj/InfoPlist.strings
|
OSX_FANCY_PLIST=$(top_srcdir)/contrib/macdeploy/fancy.plist
|
||||||
##OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns
|
OSX_BASE_LPROJ_DIR=$(top_srcdir)/contrib/macdeploy/Base.lproj/InfoPlist.strings
|
||||||
##OSX_PLIST=$(top_srcdir)/share/qt/Info.plist #not installed
|
OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns
|
||||||
##OSX_QT_TRANSLATIONS = da,de,es,hu,ru,uk,zh_CN,zh_TW
|
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)
|
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-header.bmp \
|
||||||
$(top_srcdir)/share/pixmaps/nsis-wizard.bmp
|
$(top_srcdir)/share/pixmaps/nsis-wizard.bmp
|
||||||
|
|
||||||
##OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) $(OSX_BASE_LPROJ_DIR) \
|
if TARGET_DARWIN
|
||||||
## $(top_srcdir)/contrib/macdeploy/$(OSX_BACKGROUND_IMAGE) \
|
OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) $(OSX_BASE_LPROJ_DIR) \
|
||||||
## $(top_srcdir)/contrib/macdeploy/DS_Store \
|
$(top_srcdir)/contrib/macdeploy/$(OSX_BACKGROUND_IMAGE) \
|
||||||
## $(top_srcdir)/contrib/macdeploy/detached-sig-apply.sh \
|
$(top_srcdir)/contrib/macdeploy/DS_Store \
|
||||||
## $(top_srcdir)/contrib/macdeploy/detached-sig-create.sh
|
$(top_srcdir)/contrib/macdeploy/detached-sig-apply.sh \
|
||||||
|
$(top_srcdir)/contrib/macdeploy/detached-sig-create.sh
|
||||||
|
endif
|
||||||
|
|
||||||
|
if TARGET_DARWIN
|
||||||
if BUILD_DARWIN
|
|
||||||
COVERAGE_INFO = baseline_filtered_combined.info baseline.info block_test.info \
|
COVERAGE_INFO = baseline_filtered_combined.info baseline.info block_test.info \
|
||||||
leveldb_baseline.info test_bitcoin_filtered.info total_coverage.info \
|
leveldb_baseline.info test_bitcoin_filtered.info total_coverage.info \
|
||||||
baseline_filtered.info block_test_filtered.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 \
|
leveldb_baseline.info test_bitcoin_filtered.info total_coverage.info \
|
||||||
baseline_filtered.info block_test_filtered.info \
|
baseline_filtered.info block_test_filtered.info \
|
||||||
leveldb_baseline_filtered.info test_bitcoin_coverage.info test_bitcoin.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
|
endif
|
||||||
|
|
||||||
dist-hook:
|
dist-hook:
|
||||||
@@ -80,68 +83,73 @@ $(BITCOIN_WIN_INSTALLER): all-recursive
|
|||||||
$(if $(findstring src/,$(MAKECMDGOALS)),$(MAKECMDGOALS), none): FORCE
|
$(if $(findstring src/,$(MAKECMDGOALS)),$(MAKECMDGOALS), none): FORCE
|
||||||
$(MAKE) -C src $(patsubst src/%,%,$@)
|
$(MAKE) -C src $(patsubst src/%,%,$@)
|
||||||
|
|
||||||
##$(OSX_APP)/Contents/PkgInfo:
|
if TARGET_DARWIN
|
||||||
## $(MKDIR_P) $(@D)
|
|
||||||
## @echo "APPL????" > $@
|
$(OSX_APP)/Contents/PkgInfo:
|
||||||
##
|
$(MKDIR_P) $(@D)
|
||||||
##$(OSX_APP)/Contents/Resources/empty.lproj:
|
@echo "APPL????" > $@
|
||||||
## $(MKDIR_P) $(@D)
|
|
||||||
## @touch $@
|
$(OSX_APP)/Contents/Resources/empty.lproj:
|
||||||
##
|
$(MKDIR_P) $(@D)
|
||||||
##$(OSX_APP)/Contents/Info.plist: $(OSX_PLIST)
|
@touch $@
|
||||||
## $(MKDIR_P) $(@D)
|
|
||||||
## $(INSTALL_DATA) $< $@
|
$(OSX_APP)/Contents/Info.plist: $(OSX_PLIST)
|
||||||
##
|
$(MKDIR_P) $(@D)
|
||||||
##$(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS)
|
$(INSTALL_DATA) $< $@
|
||||||
## $(MKDIR_P) $(@D)
|
|
||||||
## $(INSTALL_DATA) $< $@
|
$(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS)
|
||||||
##
|
$(MKDIR_P) $(@D)
|
||||||
##$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(BITCOIN_QT_BIN)
|
$(INSTALL_DATA) $< $@
|
||||||
## $(MKDIR_P) $(@D)
|
|
||||||
## STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $< $@
|
$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(BITCOIN_QT_BIN)
|
||||||
##
|
$(MKDIR_P) $(@D)
|
||||||
##$(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings: $(OSX_BASE_LPROJ_DIR)
|
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $< $@
|
||||||
## $(MKDIR_P) $(@D)
|
|
||||||
## $(INSTALL_DATA) $< $@
|
$(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings: $(OSX_BASE_LPROJ_DIR)
|
||||||
##
|
$(MKDIR_P) $(@D)
|
||||||
##OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \
|
$(INSTALL_DATA) $< $@
|
||||||
## $(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
|
OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \
|
||||||
##
|
$(OSX_APP)/Contents/Resources/bitcoin.icns $(OSX_APP)/Contents/Info.plist \
|
||||||
##if BUILD_DARWIN
|
$(OSX_APP)/Contents/MacOS/Bitcoin-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings
|
||||||
##$(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
|
endif
|
||||||
##
|
|
||||||
##deploydir: $(OSX_DMG)
|
if BUILD_DARWIN
|
||||||
##else
|
$(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING)
|
||||||
##APP_DIST_DIR=$(top_builddir)/dist
|
$(OSX_DEPLOY_SCRIPT) $(OSX_APP) -add-qt-tr $(OSX_QT_TRANSLATIONS) -translations-dir=$(QT_TRANSLATION_DIR) -dmg -fancy $(OSX_FANCY_PLIST) -verbose 2
|
||||||
##APP_DIST_EXTRAS=$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE) $(APP_DIST_DIR)/.DS_Store $(APP_DIST_DIR)/Applications
|
deploydir: $(OSX_DMG)
|
||||||
##
|
else
|
||||||
##$(APP_DIST_DIR)/Applications:
|
APP_DIST_DIR=$(top_builddir)/dist
|
||||||
## @rm -f $@
|
APP_DIST_EXTRAS=$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE) $(APP_DIST_DIR)/.DS_Store $(APP_DIST_DIR)/Applications
|
||||||
## @cd $(@D); $(LN_S) /Applications $(@F)
|
endif
|
||||||
##
|
|
||||||
##$(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt
|
if TARGET_DARWIN
|
||||||
##
|
$(APP_DIST_DIR)/Applications:
|
||||||
##$(OSX_DMG): $(APP_DIST_EXTRAS)
|
@rm -f $@
|
||||||
## $(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "Bitcoin-Core" -no-pad -r -apple -o $@ dist
|
@cd $(@D); $(LN_S) /Applications $(@F)
|
||||||
##
|
|
||||||
##$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE): contrib/macdeploy/$(OSX_BACKGROUND_IMAGE)
|
$(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt
|
||||||
## $(MKDIR_P) $(@D)
|
|
||||||
## $(INSTALL) $< $@
|
$(OSX_DMG): $(APP_DIST_EXTRAS)
|
||||||
##$(APP_DIST_DIR)/.DS_Store: contrib/macdeploy/DS_Store
|
$(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "Bitcoin-Core" -no-pad -r -apple -o $@ dist
|
||||||
## $(INSTALL) $< $@
|
|
||||||
##
|
$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE): contrib/macdeploy/$(OSX_BACKGROUND_IMAGE)
|
||||||
##$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
|
$(MKDIR_P) $(@D)
|
||||||
## INSTALLNAMETOOL=$(INSTALLNAMETOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -translations-dir=$(QT_TRANSLATION_DIR) -add-qt-tr $(OSX_QT_TRANSLATIONS) -verbose 2
|
$(INSTALL) $< $@
|
||||||
##
|
$(APP_DIST_DIR)/.DS_Store: contrib/macdeploy/DS_Store
|
||||||
##deploydir: $(APP_DIST_EXTRAS)
|
$(INSTALL) $< $@
|
||||||
##endif
|
|
||||||
##
|
$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
|
||||||
##if TARGET_DARWIN
|
INSTALLNAMETOOL=$(INSTALLNAMETOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -translations-dir=$(QT_TRANSLATION_DIR) -add-qt-tr $(OSX_QT_TRANSLATIONS) -verbose 2
|
||||||
##appbundle: $(OSX_APP_BUILT)
|
|
||||||
##deploy: $(OSX_DMG)
|
deploydir: $(APP_DIST_EXTRAS)
|
||||||
##endif
|
endif
|
||||||
|
|
||||||
|
if TARGET_DARWIN
|
||||||
|
appbundle: $(OSX_APP_BUILT)
|
||||||
|
deploy: $(OSX_DMG)
|
||||||
|
endif
|
||||||
|
|
||||||
if TARGET_WINDOWS
|
if TARGET_WINDOWS
|
||||||
deploy: $(BITCOIN_WIN_INSTALLER)
|
deploy: $(BITCOIN_WIN_INSTALLER)
|
||||||
@@ -161,10 +169,14 @@ baseline.info:
|
|||||||
if BUILD_DARWIN
|
if BUILD_DARWIN
|
||||||
baseline_filtered.info: baseline.info
|
baseline_filtered.info: baseline.info
|
||||||
$(LCOV) -r $< "/usr/include/*" \
|
$(LCOV) -r $< "/usr/include/*" \
|
||||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
|
"$(abs_builddir)/depends/$(BUILD)/include/*.h" \
|
||||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \
|
"$(abs_builddir)/depends/$(BUILD)/include/boost/*" \
|
||||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \
|
"$(abs_builddir)/depends/$(BUILD)/include/gmock/*" \
|
||||||
|
"$(abs_builddir)/depends/$(BUILD)/include/gtest/*" \
|
||||||
|
"$(abs_builddir)/src/gtest/*" \
|
||||||
"$(abs_builddir)/src/test/*" \
|
"$(abs_builddir)/src/test/*" \
|
||||||
|
"$(abs_builddir)/src/wallet/gtest/*" \
|
||||||
|
"$(abs_builddir)/src/wallet/test/*" \
|
||||||
-o $@
|
-o $@
|
||||||
else
|
else
|
||||||
baseline_filtered.info: baseline.info
|
baseline_filtered.info: baseline.info
|
||||||
@@ -186,10 +198,14 @@ leveldb_baseline.info: baseline_filtered.info
|
|||||||
if BUILD_DARWIN
|
if BUILD_DARWIN
|
||||||
leveldb_baseline_filtered.info: leveldb_baseline.info
|
leveldb_baseline_filtered.info: leveldb_baseline.info
|
||||||
$(LCOV) -r $< "/usr/include/*" \
|
$(LCOV) -r $< "/usr/include/*" \
|
||||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
|
"$(abs_builddir)/depends/$(BUILD)/include/*.h" \
|
||||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \
|
"$(abs_builddir)/depends/$(BUILD)/include/boost/*" \
|
||||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \
|
"$(abs_builddir)/depends/$(BUILD)/include/gmock/*" \
|
||||||
|
"$(abs_builddir)/depends/$(BUILD)/include/gtest/*" \
|
||||||
|
"$(abs_builddir)/src/gtest/*" \
|
||||||
"$(abs_builddir)/src/test/*" \
|
"$(abs_builddir)/src/test/*" \
|
||||||
|
"$(abs_builddir)/src/wallet/gtest/*" \
|
||||||
|
"$(abs_builddir)/src/wallet/test/*" \
|
||||||
-o $@
|
-o $@
|
||||||
else
|
else
|
||||||
leveldb_baseline_filtered.info: leveldb_baseline.info
|
leveldb_baseline_filtered.info: leveldb_baseline.info
|
||||||
@@ -217,9 +233,11 @@ test_bitcoin.info: baseline_filtered_combined.info
|
|||||||
if BUILD_DARWIN
|
if BUILD_DARWIN
|
||||||
test_bitcoin_filtered.info: test_bitcoin.info
|
test_bitcoin_filtered.info: test_bitcoin.info
|
||||||
$(LCOV) -r $< "/usr/include/*" \
|
$(LCOV) -r $< "/usr/include/*" \
|
||||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
|
"$(abs_builddir)/depends/$(BUILD)/include/*.h" \
|
||||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \
|
"$(abs_builddir)/depends/$(BUILD)/include/boost/*" \
|
||||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \
|
"$(abs_builddir)/depends/$(BUILD)/include/gmock/*" \
|
||||||
|
"$(abs_builddir)/depends/$(BUILD)/include/gtest/*" \
|
||||||
|
"$(abs_builddir)/src/gtest/*" \
|
||||||
"$(abs_builddir)/src/test/*" \
|
"$(abs_builddir)/src/test/*" \
|
||||||
"$(abs_builddir)/src/wallet/gtest/*" \
|
"$(abs_builddir)/src/wallet/gtest/*" \
|
||||||
"$(abs_builddir)/src/wallet/test/*" \
|
"$(abs_builddir)/src/wallet/test/*" \
|
||||||
@@ -248,10 +266,14 @@ block_test.info: test_bitcoin_filtered.info
|
|||||||
if BUILD_DARWIN
|
if BUILD_DARWIN
|
||||||
block_test_filtered.info: block_test.info
|
block_test_filtered.info: block_test.info
|
||||||
$(LCOV) -r $< "/usr/include/*" \
|
$(LCOV) -r $< "/usr/include/*" \
|
||||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/*.h" \
|
"$(abs_builddir)/depends/$(BUILD)/include/*.h" \
|
||||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/boost/*" \
|
"$(abs_builddir)/depends/$(BUILD)/include/boost/*" \
|
||||||
"$(abs_builddir)/depends/x86_64-unknown-linux-gnu/include/gmock/*" \
|
"$(abs_builddir)/depends/$(BUILD)/include/gmock/*" \
|
||||||
|
"$(abs_builddir)/depends/$(BUILD)/include/gtest/*" \
|
||||||
|
"$(abs_builddir)/src/gtest/*" \
|
||||||
"$(abs_builddir)/src/test/*" \
|
"$(abs_builddir)/src/test/*" \
|
||||||
|
"$(abs_builddir)/src/wallet/gtest/*" \
|
||||||
|
"$(abs_builddir)/src/wallet/test/*" \
|
||||||
-o $@
|
-o $@
|
||||||
else
|
else
|
||||||
block_test_filtered.info: block_test.info
|
block_test_filtered.info: block_test.info
|
||||||
@@ -276,8 +298,8 @@ zcash-gtest_coverage.info: baseline_filtered_combined.info zcash-gtest_filtered.
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if BUILD_DARWIN
|
if BUILD_DARWIN
|
||||||
total_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info block_test_filtered.info
|
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 block_test_filtered.info -o $@ | $(GREP) "\%" | $(AWK) '{ print substr($$3,2,50) "/" $$5 }' > coverage_percent.txt
|
$(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
|
else
|
||||||
total_coverage.info: baseline_filtered_combined.info test_bitcoin_filtered.info zcash-gtest_filtered.info block_test_filtered.info
|
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
|
$(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)
|
$(GENHTML) -s $< -o $(@D)
|
||||||
@touch $@
|
@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
|
total.coverage/.dirstamp: total_coverage.info
|
||||||
$(GENHTML) -s $< -o $(@D)
|
$(GENHTML) -s $< -o $(@D)
|
||||||
@touch $@
|
@touch $@
|
||||||
|
|
||||||
if BUILD_DARWIN
|
if BUILD_DARWIN
|
||||||
cov: test_bitcoin.coverage/.dirstamp total.coverage/.dirstamp
|
cov: test_bitcoin.coverage/.dirstamp cov-zcash total.coverage/.dirstamp
|
||||||
else
|
else
|
||||||
cov: test_bitcoin.coverage/.dirstamp cov-zcash total.coverage/.dirstamp
|
cov: test_bitcoin.coverage/.dirstamp cov-zcash total.coverage/.dirstamp
|
||||||
endif
|
endif
|
||||||
|
|||||||
23
configure.ac
23
configure.ac
@@ -121,11 +121,20 @@ AC_ARG_ENABLE([comparison-tool-reorg-tests],
|
|||||||
[use_comparison_tool_reorg_tests=$enableval],
|
[use_comparison_tool_reorg_tests=$enableval],
|
||||||
[use_comparison_tool_reorg_tests=no])
|
[use_comparison_tool_reorg_tests=no])
|
||||||
|
|
||||||
|
if test x$TARGET_OS = xdarwin; then
|
||||||
AC_ARG_ENABLE([hardening],
|
AC_ARG_ENABLE([hardening],
|
||||||
[AS_HELP_STRING([--enable-hardening],
|
[AS_HELP_STRING([--enable-hardening],
|
||||||
[attempt to harden the resulting executables (default is yes)])],
|
[attempt to harden the resulting executables (default is yes)])],
|
||||||
[use_hardening=$enableval],
|
[use_hardening=$enableval],
|
||||||
[use_hardening=no])
|
[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],
|
AC_ARG_ENABLE([reduce-exports],
|
||||||
[AS_HELP_STRING([--enable-reduce-exports],
|
[AS_HELP_STRING([--enable-reduce-exports],
|
||||||
@@ -453,6 +462,8 @@ if test x$use_hardening != xno; then
|
|||||||
|
|
||||||
if test x$TARGET_OS != xwindows; then
|
if test x$TARGET_OS != xwindows; then
|
||||||
# All windows code is PIC, forcing it on just adds useless compile warnings
|
# 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_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)])
|
AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"],[AC_MSG_ERROR(Cannot enable -pie)])
|
||||||
else
|
else
|
||||||
@@ -754,11 +765,19 @@ fi
|
|||||||
|
|
||||||
# These packages don't provide pkgconfig config files across all
|
# These packages don't provide pkgconfig config files across all
|
||||||
# platforms, so we use older autoconf detection mechanisms:
|
# 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_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_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_HEADER([gmpxx.h],,AC_MSG_ERROR(libgmpxx headers missing))
|
||||||
AC_CHECK_LIB([gmpxx],[main],GMPXX_LIBS=-lgmpxx, [AC_MSG_ERROR(libgmpxx 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 header layout is broken unless cpp's -I is passed with the
|
||||||
# libsnark directory, so for now we use this hideous workaround:
|
# libsnark directory, so for now we use this hideous workaround:
|
||||||
@@ -773,8 +792,12 @@ fi
|
|||||||
CPPFLAGS="-I$LIBSNARK_INCDIR $CPPFLAGS"
|
CPPFLAGS="-I$LIBSNARK_INCDIR $CPPFLAGS"
|
||||||
|
|
||||||
# Now check for libsnark compilability using traditional autoconf tests:
|
# 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_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])
|
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=""
|
RUST_LIBS=""
|
||||||
if test x$enable_rust != xno; then
|
if test x$enable_rust != xno; then
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ BASE_CACHE ?= $(BASEDIR)/built
|
|||||||
SDK_PATH ?= $(BASEDIR)/SDKs
|
SDK_PATH ?= $(BASEDIR)/SDKs
|
||||||
NO_WALLET ?=
|
NO_WALLET ?=
|
||||||
NO_UPNP ?=
|
NO_UPNP ?=
|
||||||
FALLBACK_DOWNLOAD_PATH ?= https://z.cash/depends-sources
|
FALLBACK_DOWNLOAD_PATH ?= https://supernet/depends-sources
|
||||||
|
|
||||||
BUILD ?= $(shell ./config.guess)
|
BUILD ?= $(shell ./config.guess)
|
||||||
HOST ?= $(BUILD)
|
HOST ?= $(BUILD)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ build_darwin_OTOOL: = $(shell xcrun -f otool)
|
|||||||
build_darwin_NM: = $(shell xcrun -f nm)
|
build_darwin_NM: = $(shell xcrun -f nm)
|
||||||
build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
|
build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
|
||||||
build_darwin_SHA256SUM = shasum -a 256
|
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 host on darwin builder. overrides darwin host preferences.
|
||||||
darwin_CC= gcc-5
|
darwin_CC= gcc-5
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ endef
|
|||||||
define fetch_file
|
define fetch_file
|
||||||
(test -f $$($(1)_source_dir)/$(4) || \
|
(test -f $$($(1)_source_dir)/$(4) || \
|
||||||
( mkdir -p $$($(1)_download_dir) && echo Fetching $(1)... && \
|
( 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 && \
|
echo "$(5) $$($(1)_download_dir)/$(4).temp" > $$($(1)_download_dir)/.$(4).hash && \
|
||||||
$(build_SHA256SUM) -c $$($(1)_download_dir)/.$(4).hash && \
|
$(build_SHA256SUM) -c $$($(1)_download_dir)/.$(4).hash && \
|
||||||
mv $$($(1)_download_dir)/$(4).temp $$($(1)_source_dir)/$(4) && \
|
mv $$($(1)_download_dir)/$(4).temp $$($(1)_source_dir)/$(4) && \
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
mingw32_CFLAGS=-pipe
|
mingw32_CC=x86_64-w64-mingw32-gcc-posix
|
||||||
mingw32_CXXFLAGS=$(mingw32_CFLAGS)
|
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_CFLAGS=-O2
|
||||||
mingw32_release_CXXFLAGS=$(mingw32_release_CFLAGS)
|
mingw32_release_CXXFLAGS=$(mingw32_release_CFLAGS)
|
||||||
|
|||||||
@@ -15,6 +15,17 @@ define $(package)_config_cmds
|
|||||||
../dist/$($(package)_autoconf)
|
../dist/$($(package)_autoconf)
|
||||||
endef
|
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
|
define $(package)_build_cmds
|
||||||
$(MAKE) libdb_cxx-6.2.a libdb-6.2.a
|
$(MAKE) libdb_cxx-6.2.a libdb-6.2.a
|
||||||
endef
|
endef
|
||||||
|
|||||||
@@ -9,12 +9,29 @@ $(package)_file_name=$(package)-$($(package)_version).tar.gz
|
|||||||
$(package)_download_file=release-$($(package)_version).tar.gz
|
$(package)_download_file=release-$($(package)_version).tar.gz
|
||||||
$(package)_sha256_hash=3f20b6acb37e5a98e8c4518165711e3e35d47deb6cdb5a4dd4566563b5efd232
|
$(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
|
define $(package)_build_cmds
|
||||||
$(MAKE) -C make GTEST_DIR='$(host_prefix)' CXXFLAGS='-fPIC' gmock-all.o
|
$(MAKE) -C make GTEST_DIR='$(host_prefix)' CXXFLAGS='-fPIC' gmock-all.o
|
||||||
endef
|
endef
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
define $(package)_stage_cmds
|
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
|
cp -a ./include $($(package)_staging_dir)$(host_prefix)/include
|
||||||
endef
|
endef
|
||||||
|
|||||||
@@ -5,11 +5,25 @@ $(package)_file_name=$(package)-$($(package)_version).tar.gz
|
|||||||
$(package)_download_file=release-$($(package)_version).tar.gz
|
$(package)_download_file=release-$($(package)_version).tar.gz
|
||||||
$(package)_sha256_hash=f73a6546fdf9fce9ff93a5015e0333a8af3062a152a9ad6bcb772c96687016cc
|
$(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
|
define $(package)_build_cmds
|
||||||
$(MAKE) -C make CXXFLAGS=-fPIC gtest.a
|
$(MAKE) -C make CXXFLAGS=-fPIC gtest.a
|
||||||
endef
|
endef
|
||||||
|
endif
|
||||||
|
|
||||||
define $(package)_stage_cmds
|
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
|
cp -a ./include $($(package)_staging_dir)$(host_prefix)/include
|
||||||
endef
|
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
|
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)_version=6.1.1
|
||||||
$(package)_download_path=https://gmplib.org/download/gmp/
|
$(package)_download_path=https://gmplib.org/download/gmp/
|
||||||
$(package)_file_name=gmp-$($(package)_version).tar.bz2
|
$(package)_file_name=gmp-$($(package)_version).tar.bz2
|
||||||
$(package)_sha256_hash=a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95bbeffd6
|
$(package)_sha256_hash=a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95bbeffd6
|
||||||
$(package)_dependencies=
|
$(package)_dependencies=
|
||||||
$(package)_config_opts=--enable-cxx --disable-shared
|
$(package)_config_opts=--enable-cxx --disable-shared
|
||||||
|
endif
|
||||||
|
|
||||||
define $(package)_config_cmds
|
define $(package)_config_cmds
|
||||||
$($(package)_autoconf) --host=$(host) --build=$(build)
|
$($(package)_autoconf) --host=$(host) --build=$(build)
|
||||||
|
|||||||
@@ -7,13 +7,29 @@ $(package)_sha256_hash=a5760a90d4a1045c8944204f29fa2a3cf2f800afee400f88bf89bbfe2
|
|||||||
$(package)_git_commit=91348647a86201a9482ad4ad68398152dc3d635e
|
$(package)_git_commit=91348647a86201a9482ad4ad68398152dc3d635e
|
||||||
$(package)_dependencies=rust
|
$(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
|
define $(package)_build_cmds
|
||||||
cargo build --release
|
cargo build --release
|
||||||
endef
|
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
|
define $(package)_stage_cmds
|
||||||
mkdir $($(package)_staging_dir)$(host_prefix)/lib/ && \
|
mkdir $($(package)_staging_dir)$(host_prefix)/lib/ && \
|
||||||
mkdir $($(package)_staging_dir)$(host_prefix)/include/ && \
|
mkdir $($(package)_staging_dir)$(host_prefix)/include/ && \
|
||||||
cp target/release/librustzcash.a $($(package)_staging_dir)$(host_prefix)/lib/ && \
|
cp target/release/librustzcash.a $($(package)_staging_dir)$(host_prefix)/lib/ && \
|
||||||
cp include/librustzcash.h $($(package)_staging_dir)$(host_prefix)/include/
|
cp include/librustzcash.h $($(package)_staging_dir)$(host_prefix)/include/
|
||||||
endef
|
endef
|
||||||
|
endif
|
||||||
|
|||||||
@@ -12,19 +12,20 @@ ifeq ($(build_os),darwin)
|
|||||||
define $(package)_build_cmds
|
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
|
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
|
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
|
else
|
||||||
define $(package)_build_cmds
|
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
|
endef
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
define $(package)_stage_cmds
|
define $(package)_stage_cmds
|
||||||
$(MAKE) install STATIC=1 DEPINST=$(host_prefix) PREFIX=$($(package)_staging_dir)$(host_prefix) CURVE=ALT_BN128 NO_SUPERCOP=1
|
$(MAKE) install STATIC=1 DEPINST=$(host_prefix) PREFIX=$($(package)_staging_dir)$(host_prefix) CURVE=ALT_BN128 NO_SUPERCOP=1
|
||||||
endef
|
endef
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package=libsodium
|
package=libsodium
|
||||||
$(package)_version=1.0.11
|
$(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)_file_name=libsodium-1.0.11.tar.gz
|
||||||
$(package)_sha256_hash=a14549db3c49f6ae2170cbbf4664bd48ace50681045e8dbea7c8d9fb96f9c765
|
$(package)_sha256_hash=a14549db3c49f6ae2170cbbf4664bd48ace50681045e8dbea7c8d9fb96f9c765
|
||||||
$(package)_dependencies=
|
$(package)_dependencies=
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
rust_packages := rust librustzcash
|
rust_packages := rust librustzcash
|
||||||
zcash_packages := libsnark libgmp libsodium
|
zcash_packages := libsnark libgmp libsodium
|
||||||
|
|
||||||
ifeq ($(build_os),darwin)
|
ifeq ($(host_os),linux)
|
||||||
packages := boost openssl libevent zeromq $(zcash_packages)
|
packages := boost openssl libevent zeromq $(zcash_packages) googletest googlemock
|
||||||
else
|
else
|
||||||
packages := boost openssl libevent zeromq $(zcash_packages) googletest googlemock
|
packages := boost openssl libevent zeromq $(zcash_packages) googletest googlemock libcurl
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,16 @@
|
|||||||
package=rust
|
package=rust
|
||||||
$(package)_version=1.16.0
|
$(package)_version=1.16.0
|
||||||
$(package)_download_path=https://static.rust-lang.org/dist
|
$(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)_file_name=rust-$($(package)_version)-x86_64-unknown-linux-gnu.tar.gz
|
||||||
$(package)_sha256_hash=48621912c242753ba37cad5145df375eeba41c81079df46f93ffb4896542e8fd
|
$(package)_sha256_hash=48621912c242753ba37cad5145df375eeba41c81079df46f93ffb4896542e8fd
|
||||||
|
endif
|
||||||
|
|
||||||
define $(package)_stage_cmds
|
define $(package)_stage_cmds
|
||||||
./install.sh --destdir=$($(package)_staging_dir) --prefix=$(host_prefix)/native --disable-ldconfig
|
./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=zeromq
|
||||||
$(package)_version=4.2.1
|
$(package)_version=4.2.1
|
||||||
$(package)_download_path=https://github.com/zeromq/libzmq/releases/download/v$($(package)_version)/
|
$(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=--without-documentation --disable-shared --disable-curve
|
||||||
$(package)_config_opts_linux=--with-pic
|
$(package)_config_opts_linux=--with-pic
|
||||||
endef
|
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
|
define $(package)_config_cmds
|
||||||
$($(package)_autoconf)
|
$($(package)_autoconf)
|
||||||
endef
|
endef
|
||||||
|
endif
|
||||||
|
|
||||||
define $(package)_build_cmds
|
define $(package)_build_cmds
|
||||||
$(MAKE) src/libzmq.la
|
$(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)/secp256k1/include
|
||||||
BITCOIN_INCLUDES += -I$(srcdir)/univalue/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
|
LIBBITCOIN_SERVER=libbitcoin_server.a
|
||||||
|
endif
|
||||||
|
|
||||||
LIBBITCOIN_WALLET=libbitcoin_wallet.a
|
LIBBITCOIN_WALLET=libbitcoin_wallet.a
|
||||||
LIBBITCOIN_COMMON=libbitcoin_common.a
|
LIBBITCOIN_COMMON=libbitcoin_common.a
|
||||||
LIBBITCOIN_CLI=libbitcoin_cli.a
|
LIBBITCOIN_CLI=libbitcoin_cli.a
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ komodo_asset WLC 210000000
|
|||||||
komodo_asset KV 1000000
|
komodo_asset KV 1000000
|
||||||
komodo_asset CEAL 366666666
|
komodo_asset CEAL 366666666
|
||||||
komodo_asset MESH 1000007
|
komodo_asset MESH 1000007
|
||||||
komodo_asset MNZ 257142858
|
|
||||||
|
|
||||||
komodo_asset USD
|
komodo_asset USD
|
||||||
komodo_asset EUR
|
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=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=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=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
|
sleep $delay
|
||||||
|
|
||||||
./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 &
|
./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 &
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ static bool AppInitRPC(int argc, char* argv[])
|
|||||||
// Parameters
|
// Parameters
|
||||||
//
|
//
|
||||||
ParseParameters(argc, argv);
|
ParseParameters(argc, argv);
|
||||||
komodo_args(argv[0]);
|
komodo_args();
|
||||||
if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) {
|
if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version")) {
|
||||||
std::string strUsage = _("Komodo RPC client version") + " " + FormatFullVersion() + "\n" + PrivacyInfo();
|
std::string strUsage = _("Komodo RPC client version") + " " + FormatFullVersion() + "\n" + PrivacyInfo();
|
||||||
if (!mapArgs.count("-version")) {
|
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");
|
std::string host = GetArg("-rpcconnect", "127.0.0.1");
|
||||||
int port = GetArg("-rpcport", BaseParams().RPCPort());
|
int port = GetArg("-rpcport", BaseParams().RPCPort());
|
||||||
BITCOIND_PORT = port;
|
|
||||||
// Obtain event base
|
// Obtain event base
|
||||||
raii_event_base base = obtain_event_base();
|
raii_event_base base = obtain_event_base();
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,11 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define frpintf(...)
|
||||||
|
#define printf(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Introduction text for doxygen: */
|
/* Introduction text for doxygen: */
|
||||||
|
|
||||||
/*! \mainpage Developer documentation
|
/*! \mainpage Developer documentation
|
||||||
@@ -106,14 +111,18 @@ bool AppInit(int argc, char* argv[])
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
void komodo_args(char *argv0);
|
void komodo_args();
|
||||||
komodo_args(argv[0]);
|
komodo_args();
|
||||||
fprintf(stderr,"call komodo_args.(%s) NOTARY_PUBKEY.(%s)\n",argv[0],NOTARY_PUBKEY.c_str());
|
fprintf(stderr,"call komodo_args NOTARY_PUBKEY.(%s)\n",NOTARY_PUBKEY.c_str());
|
||||||
while ( ASSETCHAIN_INIT == 0 )
|
while ( ASSETCHAIN_INIT == 0 )
|
||||||
{
|
{
|
||||||
//if ( komodo_is_issuer() != 0 )
|
//if ( komodo_is_issuer() != 0 )
|
||||||
// komodo_passport_iteration();
|
// komodo_passport_iteration();
|
||||||
|
#ifdef _WIN32
|
||||||
|
boost::this_thread::sleep_for(boost::chrono::seconds(1));
|
||||||
|
#else
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
printf("initialized %s\n",ASSETCHAINS_SYMBOL);
|
printf("initialized %s\n",ASSETCHAINS_SYMBOL);
|
||||||
if (!boost::filesystem::is_directory(GetDataDir(false)))
|
if (!boost::filesystem::is_directory(GetDataDir(false)))
|
||||||
|
|||||||
@@ -141,7 +141,11 @@ void *chainparams_commandline(void *ptr)
|
|||||||
{
|
{
|
||||||
while ( ASSETCHAINS_PORT == 0 )
|
while ( ASSETCHAINS_PORT == 0 )
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
|
||||||
|
#else
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
//fprintf(stderr,">>>>>>>> port.%u\n",ASSETCHAINS_PORT);
|
//fprintf(stderr,">>>>>>>> port.%u\n",ASSETCHAINS_PORT);
|
||||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
|
|
||||||
#include "crypto/equihash.h"
|
#include "crypto/equihash.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#ifndef __linux__
|
||||||
|
#include "compat/endian.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#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\":\"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\":\"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\":\"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\"}"
|
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 kv; fiat/kv $1 $2 $3 $4
|
||||||
echo ceal; fiat/ceal $1 $2 $3 $4
|
echo ceal; fiat/ceal $1 $2 $3 $4
|
||||||
echo mesh; fiat/mesh $1 $2 $3 $4
|
echo mesh; fiat/mesh $1 $2 $3 $4
|
||||||
echo mnz; fiat/mnz $1 $2 $3 $4
|
|
||||||
|
|||||||
@@ -127,15 +127,6 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &)
|
|||||||
if (valRequest.isObject()) {
|
if (valRequest.isObject()) {
|
||||||
jreq.parse(valRequest);
|
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);
|
UniValue result = tableRPC.execute(jreq.strMethod, jreq.params);
|
||||||
|
|
||||||
// Send reply
|
// Send reply
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
// komodo functions that interact with bitcoind C++
|
// komodo functions that interact with bitcoind C++
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <curl.h>
|
#include <curl/curl.h>
|
||||||
#include <easy.h>
|
#include <curl/easy.h>
|
||||||
#else
|
#else
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include <curl/easy.h>
|
#include <curl/easy.h>
|
||||||
@@ -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(url,(char *)"http://127.0.0.1:%u",port);
|
||||||
sprintf(postdata,"{\"method\":\"%s\",\"params\":%s}",method,params);
|
sprintf(postdata,"{\"method\":\"%s\",\"params\":%s}",method,params);
|
||||||
//printf("postdata.(%s) USERPASS.(%s)\n",postdata,KMDUSERPASS);
|
//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);
|
retstr2 = bitcoind_RPC(&retstr,(char *)"debug",url,userpass,method,params);
|
||||||
//retstr = curl_post(&cHandle,url,USERPASS,postdata,0,0,0,0);
|
//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 )
|
if ( KMDUSERPASS[0] != 0 )
|
||||||
jsonstr = komodo_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,7771);
|
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 return(0); // need universal way to issue DEX* API, since notaries mine most blocks, this ok
|
||||||
}
|
}
|
||||||
else if ( strcmp(dest,"BTC") == 0 )
|
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];
|
uint256 hash; char params[128],*hexstr,*jsonstr; cJSON *result; int32_t i; uint8_t revbuf[32];
|
||||||
memset(&hash,0,sizeof(hash));
|
memset(&hash,0,sizeof(hash));
|
||||||
sprintf(params,"[%d]",height);
|
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 )
|
if ( (result= cJSON_Parse(jsonstr)) != 0 )
|
||||||
{
|
{
|
||||||
@@ -883,4 +883,3 @@ int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_
|
|||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,9 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <sodium.h>
|
||||||
|
#endif
|
||||||
bits320 fmul(const bits320 in2,const bits320 in);
|
bits320 fmul(const bits320 in2,const bits320 in);
|
||||||
bits320 fexpand(bits256 basepoint);
|
bits320 fexpand(bits256 basepoint);
|
||||||
bits256 fcontract(const bits320 input);
|
bits256 fcontract(const bits320 input);
|
||||||
@@ -882,12 +884,18 @@ inline bits320 crecip(const bits320 z)
|
|||||||
/* 2^255 - 21 */ return(fmul(t0, a));
|
/* 2^255 - 21 */ return(fmul(t0, a));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
void OS_randombytes(unsigned char *x,long xlen);
|
void OS_randombytes(unsigned char *x,long xlen);
|
||||||
|
#endif
|
||||||
|
|
||||||
bits256 rand256(int32_t privkeyflag)
|
bits256 rand256(int32_t privkeyflag)
|
||||||
{
|
{
|
||||||
bits256 randval;
|
bits256 randval;
|
||||||
|
#ifndef __WIN32
|
||||||
OS_randombytes(randval.bytes,sizeof(randval));
|
OS_randombytes(randval.bytes,sizeof(randval));
|
||||||
|
#else
|
||||||
|
randombytes_buf(randval.bytes,sizeof(randval));
|
||||||
|
#endif
|
||||||
if ( privkeyflag != 0 )
|
if ( privkeyflag != 0 )
|
||||||
randval.bytes[0] &= 0xf8, randval.bytes[31] &= 0x7f, randval.bytes[31] |= 0x40;
|
randval.bytes[0] &= 0xf8, randval.bytes[31] &= 0x7f, randval.bytes[31] |= 0x40;
|
||||||
return(randval);
|
return(randval);
|
||||||
|
|||||||
@@ -1352,8 +1352,8 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
|||||||
void komodo_passport_iteration()
|
void komodo_passport_iteration()
|
||||||
{
|
{
|
||||||
static long lastpos[34]; static char userpass[33][1024]; static uint32_t lasttime;
|
static long lastpos[34]; static char userpass[33][1024]; static uint32_t lasttime;
|
||||||
int32_t maxseconds = 10;
|
int32_t maxseconds = 30;
|
||||||
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;
|
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);
|
//printf("PASSPORT.(%s)\n",ASSETCHAINS_SYMBOL);
|
||||||
expired = 0;
|
expired = 0;
|
||||||
while ( KOMODO_INITDONE == 0 )
|
while ( KOMODO_INITDONE == 0 )
|
||||||
@@ -1365,12 +1365,10 @@ void komodo_passport_iteration()
|
|||||||
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
||||||
{
|
{
|
||||||
refid = 33;
|
refid = 33;
|
||||||
limit = 1000000;
|
|
||||||
jumblr_iteration();
|
jumblr_iteration();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
limit = 10000;
|
|
||||||
refid = komodo_baseid(ASSETCHAINS_SYMBOL)+1; // illegal base -> baseid.-1 -> 0
|
refid = komodo_baseid(ASSETCHAINS_SYMBOL)+1; // illegal base -> baseid.-1 -> 0
|
||||||
if ( refid == 0 )
|
if ( refid == 0 )
|
||||||
{
|
{
|
||||||
@@ -1384,7 +1382,7 @@ void komodo_passport_iteration()
|
|||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
starttime = (uint32_t)time(NULL);
|
starttime = (uint32_t)time(NULL);
|
||||||
if ( 0 && starttime == lasttime )
|
if ( starttime == lasttime )
|
||||||
{
|
{
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
return;
|
return;
|
||||||
@@ -1415,9 +1413,9 @@ void komodo_passport_iteration()
|
|||||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
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]);
|
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);
|
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 )
|
if ( time(NULL) < starttime+maxseconds )
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|||||||
@@ -24,6 +24,10 @@
|
|||||||
z_sendmany "fromaddress" [{"address":... ,"amount":..., "memo":"<hex>"},...] ( minconf ) ( fee )
|
z_sendmany "fromaddress" [{"address":... ,"amount":..., "memo":"<hex>"},...] ( minconf ) ( fee )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <wincrypt.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define JUMBLR_ADDR "RGhxXpXSSBTBm9EvNsXnTQczthMCxHX91t"
|
#define JUMBLR_ADDR "RGhxXpXSSBTBm9EvNsXnTQczthMCxHX91t"
|
||||||
#define JUMBLR_BTCADDR "18RmTJe9qMech8siuhYfMtHo8RtcN1obC6"
|
#define JUMBLR_BTCADDR "18RmTJe9qMech8siuhYfMtHo8RtcN1obC6"
|
||||||
#define JUMBLR_MAXSECRETADDRS 777
|
#define JUMBLR_MAXSECRETADDRS 777
|
||||||
@@ -78,7 +82,7 @@ char *jumblr_importaddress(char *address)
|
|||||||
{
|
{
|
||||||
char params[1024];
|
char params[1024];
|
||||||
sprintf(params,"[\"%s\", \"%s\", false]",address,address);
|
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)
|
char *jumblr_validateaddress(char *addr)
|
||||||
@@ -86,7 +90,7 @@ char *jumblr_validateaddress(char *addr)
|
|||||||
char params[1024];
|
char params[1024];
|
||||||
sprintf(params,"[\"%s\"]",addr);
|
sprintf(params,"[\"%s\"]",addr);
|
||||||
printf("validateaddress.%s\n",params);
|
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)
|
int32_t Jumblr_secretaddrfind(char *searchaddr)
|
||||||
@@ -155,6 +159,16 @@ int32_t Jumblr_depositaddradd(char *depositaddr) // external
|
|||||||
return(retval);
|
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)
|
int32_t Jumblr_secretaddr(char *secretaddr)
|
||||||
{
|
{
|
||||||
uint32_t r;
|
uint32_t r;
|
||||||
@@ -207,28 +221,28 @@ char *jumblr_zgetnewaddress()
|
|||||||
{
|
{
|
||||||
char params[1024];
|
char params[1024];
|
||||||
sprintf(params,"[]");
|
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 *jumblr_zlistoperationids()
|
||||||
{
|
{
|
||||||
char params[1024];
|
char params[1024];
|
||||||
sprintf(params,"[]");
|
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 *jumblr_zgetoperationresult(char *opid)
|
||||||
{
|
{
|
||||||
char params[1024];
|
char params[1024];
|
||||||
sprintf(params,"[[\"%s\"]]",opid);
|
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 *jumblr_zgetoperationstatus(char *opid)
|
||||||
{
|
{
|
||||||
char params[1024];
|
char params[1024];
|
||||||
sprintf(params,"[[\"%s\"]]",opid);
|
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)
|
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\"}"));
|
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);
|
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);
|
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)
|
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}, {\"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);
|
sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",zaddrS,zaddrD,amount-fee-JUMBLR_TXFEE,JUMBLR_TXFEE);
|
||||||
printf("z -> z: %s\n",params);
|
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)
|
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\"}"));
|
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);
|
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);
|
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 *jumblr_zlistaddresses()
|
||||||
{
|
{
|
||||||
char params[1024];
|
char params[1024];
|
||||||
sprintf(params,"[]");
|
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 *jumblr_zlistreceivedbyaddress(char *addr)
|
||||||
{
|
{
|
||||||
char params[1024];
|
char params[1024];
|
||||||
sprintf(params,"[\"%s\", 1]",addr);
|
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 *jumblr_getreceivedbyaddress(char *addr)
|
||||||
{
|
{
|
||||||
char params[1024];
|
char params[1024];
|
||||||
sprintf(params,"[\"%s\", 1]",addr);
|
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 *jumblr_importprivkey(char *wifstr)
|
||||||
{
|
{
|
||||||
char params[1024];
|
char params[1024];
|
||||||
sprintf(params,"[\"%s\", \"\", false]",wifstr);
|
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 *jumblr_zgetbalance(char *addr)
|
||||||
{
|
{
|
||||||
char params[1024];
|
char params[1024];
|
||||||
sprintf(params,"[\"%s\", 1]",addr);
|
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 *jumblr_listunspent(char *coinaddr)
|
||||||
{
|
{
|
||||||
char params[1024];
|
char params[1024];
|
||||||
sprintf(params,"[1, 99999999, [\"%s\"]]",coinaddr);
|
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 *jumblr_gettransaction(char *txidstr)
|
||||||
{
|
{
|
||||||
char params[1024];
|
char params[1024];
|
||||||
sprintf(params,"[\"%s\", 1]",txidstr);
|
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)
|
int32_t jumblr_numvins(bits256 txid)
|
||||||
@@ -769,4 +783,3 @@ void jumblr_iteration()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,11 @@
|
|||||||
* Removal or modification of this copyright notice is prohibited. *
|
* 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 SATOSHIDEN ((uint64_t)100000000L)
|
||||||
#define dstr(x) ((double)(x) / SATOSHIDEN)
|
#define dstr(x) ((double)(x) / SATOSHIDEN)
|
||||||
@@ -1106,6 +1111,7 @@ double OS_milliseconds()
|
|||||||
return(millis);
|
return(millis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
void OS_randombytes(unsigned char *x,long xlen)
|
void OS_randombytes(unsigned char *x,long xlen)
|
||||||
{
|
{
|
||||||
static int fd = -1;
|
static int fd = -1;
|
||||||
@@ -1135,6 +1141,7 @@ void OS_randombytes(unsigned char *x,long xlen)
|
|||||||
xlen -= i;
|
xlen -= i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void lock_queue(queue_t *queue)
|
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)
|
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) )
|
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);
|
DL_DELETE(queue->list,item);
|
||||||
portable_mutex_unlock(&queue->mutex);
|
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)],&r2,sizeof(r2));
|
||||||
memcpy(&buf[sizeof(r)+sizeof(r2)],symbol,strlen(symbol));
|
memcpy(&buf[sizeof(r)+sizeof(r2)],symbol,strlen(symbol));
|
||||||
crc = calc_crc32(0,(uint8_t *)buf,(int32_t)(sizeof(r)+sizeof(r2)+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));
|
OS_randombytes(buf2,sizeof(buf2));
|
||||||
|
#endif
|
||||||
for (i=0; i<sizeof(buf2); i++)
|
for (i=0; i<sizeof(buf2); i++)
|
||||||
sprintf(&password[i*2],"%02x",buf2[i]);
|
sprintf(&password[i*2],"%02x",buf2[i]);
|
||||||
password[i*2] = 0;
|
password[i*2] = 0;
|
||||||
@@ -1468,20 +1483,10 @@ int32_t komodo_whoami(char *pubkeystr,int32_t height)
|
|||||||
return(notaryid);
|
return(notaryid);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *argv0suffix[] =
|
void komodo_args()
|
||||||
{
|
|
||||||
(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)
|
|
||||||
{
|
{
|
||||||
extern int64_t MAX_MONEY;
|
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);
|
IS_KOMODO_NOTARY = GetBoolArg("-notary", false);
|
||||||
if ( (KOMODO_EXCHANGEWALLET= GetBoolArg("-exchange", false)) != 0 )
|
if ( (KOMODO_EXCHANGEWALLET= GetBoolArg("-exchange", false)) != 0 )
|
||||||
fprintf(stderr,"KOMODO_EXCHANGEWALLET mode active\n");
|
fprintf(stderr,"KOMODO_EXCHANGEWALLET mode active\n");
|
||||||
@@ -1492,20 +1497,6 @@ void komodo_args(char *argv0)
|
|||||||
KOMODO_PAX = 1;
|
KOMODO_PAX = 1;
|
||||||
} else KOMODO_PAX = GetArg("-pax",0);
|
} else KOMODO_PAX = GetArg("-pax",0);
|
||||||
name = GetArg("-ac_name","");
|
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 )
|
if ( (KOMODO_REWIND= GetArg("-rewind",0)) != 0 )
|
||||||
{
|
{
|
||||||
printf("KOMODO_REWIND %d\n",KOMODO_REWIND);
|
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 )
|
while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"waiting for datadir\n");
|
fprintf(stderr,"waiting for datadir\n");
|
||||||
|
#ifndef _WIN32
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
#else
|
||||||
|
boost::this_thread::sleep(boost::posix_time::milliseconds(3000));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
//fprintf(stderr,"Got datadir.(%s)\n",dirname);
|
//fprintf(stderr,"Got datadir.(%s)\n",dirname);
|
||||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
@@ -1534,7 +1529,6 @@ void komodo_args(char *argv0)
|
|||||||
extern int COINBASE_MATURITY;
|
extern int COINBASE_MATURITY;
|
||||||
komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1);
|
komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1);
|
||||||
COINBASE_MATURITY = 1;
|
COINBASE_MATURITY = 1;
|
||||||
LogPrintf("ASSETCHAINS_PORT %s %u\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT);
|
|
||||||
}
|
}
|
||||||
ASSETCHAINS_NOTARIES = GetArg("-ac_notaries","");
|
ASSETCHAINS_NOTARIES = GetArg("-ac_notaries","");
|
||||||
komodo_assetchain_pubkeys((char *)ASSETCHAINS_NOTARIES.c_str());
|
komodo_assetchain_pubkeys((char *)ASSETCHAINS_NOTARIES.c_str());
|
||||||
@@ -1587,8 +1581,7 @@ void komodo_args(char *argv0)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BITCOIND_PORT = GetArg("-rpcport", BaseParams().RPCPort());
|
//fprintf(stderr,"%s chain params initialized\n",ASSETCHAINS_SYMBOL);
|
||||||
//fprintf(stderr,"%s RPC %u\n",ASSETCHAINS_SYMBOL,BITCOIND_PORT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void komodo_nameset(char *symbol,char *dest,char *source)
|
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);
|
komodo_nameset(symbol,dest,ASSETCHAINS_SYMBOL);
|
||||||
return(komodo_stateptrget(symbol));
|
return(komodo_stateptrget(symbol));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,12 @@
|
|||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
#include <boost/thread/synchronized_value.hpp>
|
#include <boost/thread/synchronized_value.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <io.h>
|
||||||
|
#include <windows.h>
|
||||||
|
#else
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
void AtomicTimer::start()
|
void AtomicTimer::start()
|
||||||
@@ -406,11 +411,17 @@ void ThreadShowMetricsScreen()
|
|||||||
|
|
||||||
// Get current window size
|
// Get current window size
|
||||||
if (isTTY) {
|
if (isTTY) {
|
||||||
|
#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;
|
struct winsize w;
|
||||||
w.ws_col = 0;
|
w.ws_col = 0;
|
||||||
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1 && w.ws_col != 0) {
|
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1 && w.ws_col != 0) {
|
||||||
cols = w.ws_col;
|
cols = w.ws_col;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isScreen) {
|
if (isScreen) {
|
||||||
|
|||||||
@@ -47,13 +47,13 @@ JSDescription JSDescription::Randomized(
|
|||||||
const uint256& anchor,
|
const uint256& anchor,
|
||||||
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS>& inputs,
|
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS>& inputs,
|
||||||
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS>& outputs,
|
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_INPUTS>& inputMap,
|
||||||
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS>& outputMap,
|
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_INPUTS>& inputMap,
|
||||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS>& outputMap,
|
boost::array<size_t, ZC_NUM_JS_OUTPUTS>& outputMap,
|
||||||
#endif
|
#endif
|
||||||
CAmount vpub_old,
|
CAmount vpub_old,
|
||||||
CAmount vpub_new,
|
CAmount vpub_new,
|
||||||
bool computeProof,
|
bool computeProof,
|
||||||
|
|||||||
@@ -87,13 +87,13 @@ public:
|
|||||||
const uint256& rt,
|
const uint256& rt,
|
||||||
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS>& inputs,
|
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS>& inputs,
|
||||||
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS>& outputs,
|
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_INPUTS>& inputMap,
|
||||||
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS>& outputMap,
|
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_INPUTS>& inputMap,
|
||||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS>& outputMap,
|
boost::array<size_t, ZC_NUM_JS_OUTPUTS>& outputMap,
|
||||||
#endif
|
#endif
|
||||||
CAmount vpub_old,
|
CAmount vpub_old,
|
||||||
CAmount vpub_new,
|
CAmount vpub_new,
|
||||||
bool computeProof = true, // Set to false in some tests
|
bool computeProof = true, // Set to false in some tests
|
||||||
|
|||||||
@@ -976,7 +976,11 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
|
|||||||
|
|
||||||
ZCIncrementalMerkleTree tree;
|
ZCIncrementalMerkleTree tree;
|
||||||
pcoinsTip->GetAnchorAt(pcoinsTip->GetBestAnchor(), 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()));
|
obj.push_back(Pair("commitments", tree.size()));
|
||||||
|
#endif
|
||||||
|
|
||||||
const Consensus::Params& consensusParams = Params().GetConsensus();
|
const Consensus::Params& consensusParams = Params().GetConsensus();
|
||||||
CBlockIndex* tip = chainActive.Tip();
|
CBlockIndex* tip = chainActive.Tip();
|
||||||
@@ -1055,9 +1059,7 @@ UniValue getchaintips(const UniValue& params, bool fHelp)
|
|||||||
setTips.insert(item.second);
|
setTips.insert(item.second);
|
||||||
BOOST_FOREACH(const PAIRTYPE(const uint256, CBlockIndex*)& item, mapBlockIndex)
|
BOOST_FOREACH(const PAIRTYPE(const uint256, CBlockIndex*)& item, mapBlockIndex)
|
||||||
{
|
{
|
||||||
const CBlockIndex* pprev=0;
|
const CBlockIndex* pprev = item.second->pprev;
|
||||||
if ( item.second != 0 )
|
|
||||||
pprev = item.second->pprev;
|
|
||||||
if (pprev)
|
if (pprev)
|
||||||
setTips.erase(pprev);
|
setTips.erase(pprev);
|
||||||
}
|
}
|
||||||
@@ -1066,16 +1068,14 @@ UniValue getchaintips(const UniValue& params, bool fHelp)
|
|||||||
setTips.insert(chainActive.Tip());
|
setTips.insert(chainActive.Tip());
|
||||||
|
|
||||||
/* Construct the output array. */
|
/* Construct the output array. */
|
||||||
UniValue res(UniValue::VARR); const CBlockIndex *forked;
|
UniValue res(UniValue::VARR);
|
||||||
BOOST_FOREACH(const CBlockIndex* block, setTips)
|
BOOST_FOREACH(const CBlockIndex* block, setTips)
|
||||||
{
|
{
|
||||||
UniValue obj(UniValue::VOBJ);
|
UniValue obj(UniValue::VOBJ);
|
||||||
obj.push_back(Pair("height", block->nHeight));
|
obj.push_back(Pair("height", block->nHeight));
|
||||||
obj.push_back(Pair("hash", block->phashBlock->GetHex()));
|
obj.push_back(Pair("hash", block->phashBlock->GetHex()));
|
||||||
forked = chainActive.FindFork(block);
|
|
||||||
if ( forked != 0 )
|
const int branchLen = block->nHeight - chainActive.FindFork(block)->nHeight;
|
||||||
{
|
|
||||||
const int branchLen = block->nHeight - forked->nHeight;
|
|
||||||
obj.push_back(Pair("branchlen", branchLen));
|
obj.push_back(Pair("branchlen", branchLen));
|
||||||
|
|
||||||
string status;
|
string status;
|
||||||
@@ -1099,7 +1099,7 @@ UniValue getchaintips(const UniValue& params, bool fHelp)
|
|||||||
status = "unknown";
|
status = "unknown";
|
||||||
}
|
}
|
||||||
obj.push_back(Pair("status", status));
|
obj.push_back(Pair("status", status));
|
||||||
}
|
|
||||||
res.push_back(obj);
|
res.push_back(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -643,9 +643,6 @@ void ReadConfigFile(map<string, string>& mapSettingsRet,
|
|||||||
}
|
}
|
||||||
// If datadir is changed in .conf file:
|
// If datadir is changed in .conf file:
|
||||||
ClearDatadirCache();
|
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
|
#ifndef WIN32
|
||||||
|
|||||||
@@ -986,13 +986,13 @@ UniValue AsyncRPCOperation_sendmany::perform_joinsplit(
|
|||||||
{info.vjsin[0], info.vjsin[1]};
|
{info.vjsin[0], info.vjsin[1]};
|
||||||
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs
|
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs
|
||||||
{info.vjsout[0], info.vjsout[1]};
|
{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_INPUTS> inputMap;
|
||||||
boost::array<uint64_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
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_INPUTS> inputMap;
|
||||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
boost::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
||||||
#endif
|
#endif
|
||||||
JSDescription jsdesc = JSDescription::Randomized(
|
JSDescription jsdesc = JSDescription::Randomized(
|
||||||
*pzcashParams,
|
*pzcashParams,
|
||||||
joinSplitPubKey_,
|
joinSplitPubKey_,
|
||||||
@@ -1167,4 +1167,3 @@ UniValue AsyncRPCOperation_sendmany::getStatus() const {
|
|||||||
obj.push_back(Pair("params", contextinfo_ ));
|
obj.push_back(Pair("params", contextinfo_ ));
|
||||||
return obj;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1567,7 +1567,11 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
|
|||||||
entry.push_back(Pair("fee", ValueFromAmount(-nFee)));
|
entry.push_back(Pair("fee", ValueFromAmount(-nFee)));
|
||||||
if (fLong)
|
if (fLong)
|
||||||
WalletTxToJSON(wtx, entry);
|
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)));
|
entry.push_back(Pair("size", static_cast<CTransaction>(wtx).GetSerializeSize(SER_NETWORK, PROTOCOL_VERSION)));
|
||||||
|
#endif
|
||||||
ret.push_back(entry);
|
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));
|
entry.push_back(Pair("vout", r.vout));
|
||||||
if (fLong)
|
if (fLong)
|
||||||
WalletTxToJSON(wtx, entry);
|
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)));
|
entry.push_back(Pair("size", static_cast<CTransaction>(wtx).GetSerializeSize(SER_NETWORK, PROTOCOL_VERSION)));
|
||||||
|
#endif
|
||||||
ret.push_back(entry);
|
ret.push_back(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ public:
|
|||||||
// Transaction hash
|
// Transaction hash
|
||||||
uint256 hash;
|
uint256 hash;
|
||||||
// Index into CTransaction.vjoinsplit
|
// Index into CTransaction.vjoinsplit
|
||||||
#ifdef __APPLE__
|
#ifdef __LP64__
|
||||||
uint64_t js;
|
uint64_t js;
|
||||||
#else
|
#else
|
||||||
size_t js;
|
size_t js;
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#include "libsnark/common/profiling.hpp"
|
#include "libsnark/common/profiling.hpp"
|
||||||
char ASSETCHAINS_SYMBOL[16];
|
char ASSETCHAINS_SYMBOL[16];
|
||||||
int64_t MAX_MONEY = 200000000 * 100000000LL;
|
int64_t MAX_MONEY = 200000000 * 100000000LL;
|
||||||
uint16_t BITCOIND_PORT = 7771;
|
|
||||||
|
|
||||||
using namespace libzcash;
|
using namespace libzcash;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user