From 0e3d20a1b496153b60dbe1fe9e6832a85dcd557c Mon Sep 17 00:00:00 2001 From: Ra's Al Ghul Date: Sat, 23 Feb 2019 00:00:48 -0800 Subject: [PATCH 01/26] Depencies, change to macOS and macOS version bump --- doc/{build-osx.md => build-macos.md} | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) rename doc/{build-osx.md => build-macos.md} (89%) diff --git a/doc/build-osx.md b/doc/build-macos.md similarity index 89% rename from doc/build-osx.md rename to doc/build-macos.md index 692f73247..2dcff088e 100755 --- a/doc/build-osx.md +++ b/doc/build-macos.md @@ -1,11 +1,11 @@ -Mac OS X Build Instructions and Notes +MacOS Build Instructions and Notes ==================================== This guide will show you how to build vitaed (headless client) for OSX. Notes ----- -* Tested on OS X 10.7 through 10.10 on 64-bit Intel processors only. +* Tested on macOS 10.11 through 10.14 on 64-bit Intel processors only. * All of the commands should be executed in a Terminal application. The built-in one is located in `/Applications/Utilities`. @@ -15,7 +15,7 @@ Preparation You need to install XCode with all the options checked so that the compiler and everything is available in /usr not just /Developer. XCode should be -available on your OS X installation media, but if not, you can get the +available on your macOS installation media, but if not, you can get the current version from https://developer.apple.com/xcode/. If you install Xcode 4.3 or later, you'll need to install its command line tools. This can be done in `Xcode > Preferences > Downloads > Components` and generally must @@ -23,8 +23,8 @@ be re-done or updated every time Xcode is updated. There's also an assumption that you already have `git` installed. If not, it's the path of least resistance to install [Github for Mac](https://mac.github.com/) -(OS X 10.7+) or -[Git for OS X](https://code.google.com/p/git-osx-installer/). It is also +(macOS 10.11+) or +[Git for macOS](https://code.google.com/p/git-osx-installer/). It is also available via Homebrew. You will also need to install [Homebrew](http://brew.sh) in order to install library @@ -38,7 +38,7 @@ Instructions: Homebrew #### Install dependencies using Homebrew - brew install autoconf automake berkeley-db4 libtool boost@1.57 miniupnpc openssl pkg-config protobuf qt5 zeromq libevent + brew install autoconf automake berkeley-db4 libtool boost@1.57 miniupnpc openssl pkg-config protobuf qt5 zeromq libevent qrencode brew link boost@1.57 --force @@ -51,9 +51,7 @@ Instructions: Homebrew 2. Build vitaed: - ./autogen.sh - ./configure --with-gui=qt5 - make + ./autogen.sh && ./configure --with-gui=qt5 /configure CPPFLAGS='-I/usr/local/opt/openssl/include' LDFLAGS='-L/usr/local/opt/openssl/lib' && make 3. It is also a good idea to build and run the unit tests: @@ -90,9 +88,9 @@ as follows for maximum compatibility: All dependencies should be compiled with these flags: - -mmacosx-version-min=10.7 + -mmacosx-version-min=10.10 -arch x86_64 - -isysroot $(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk + -isysroot $(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk Once dependencies are compiled, see release-process.md for how the VITAE-Qt.app bundle is packaged and signed to create the .dmg disk image that is distributed. From 20cd9e243c89e9cdf109ecc3c4a191baab4be610 Mon Sep 17 00:00:00 2001 From: Ra's Al Ghul Date: Sat, 23 Feb 2019 00:28:13 -0800 Subject: [PATCH 02/26] Update MacOSX to macOS --- doc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/README.md b/doc/README.md index bab28114b..d769d767a 100755 --- a/doc/README.md +++ b/doc/README.md @@ -36,7 +36,7 @@ Building --------------------- The following are developer notes on how to build VITAE on your native platform. They are not complete guides, but include notes on the necessary libraries, compile flags, etc. -- [OSX Build Notes](build-osx.md) +- [macOS Build Notes](build-macos.md) - [Unix Build Notes](build-unix.md) - [Gitian Building Guide](gitian-building.md) From 93aa98011f76cc2ef390ef9f6035a1950c54e080 Mon Sep 17 00:00:00 2001 From: Ra's Al Ghul Date: Sat, 23 Feb 2019 09:24:04 -0800 Subject: [PATCH 03/26] Fix typo and unneeded var --- doc/build-macos.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/build-macos.md b/doc/build-macos.md index 2dcff088e..d68b4216f 100755 --- a/doc/build-macos.md +++ b/doc/build-macos.md @@ -51,7 +51,7 @@ Instructions: Homebrew 2. Build vitaed: - ./autogen.sh && ./configure --with-gui=qt5 /configure CPPFLAGS='-I/usr/local/opt/openssl/include' LDFLAGS='-L/usr/local/opt/openssl/lib' && make + ./autogen.sh && ./configure CPPFLAGS='-I/usr/local/opt/openssl/include' LDFLAGS='-L/usr/local/opt/openssl/lib' && make 3. It is also a good idea to build and run the unit tests: From fe75057bb337d7893b5469639fbe9918bc313d89 Mon Sep 17 00:00:00 2001 From: Ra's Al Ghul Date: Sat, 23 Feb 2019 21:05:33 -0800 Subject: [PATCH 04/26] Added Make Deploy for Portable Installs --- doc/build-macos.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/build-macos.md b/doc/build-macos.md index d68b4216f..c6851cd22 100755 --- a/doc/build-macos.md +++ b/doc/build-macos.md @@ -57,10 +57,14 @@ Instructions: Homebrew make check -4. (Optional) You can also install vitaed to your path: +4. (Optional) You can also install vitaed to your path or skip to step 5 to create portable package: make install +5. (Optional) Portable package: + + make deploy + Use Qt Creator as IDE ------------------------ You can use Qt Creator as IDE, for debugging and for manipulating forms, etc. From a0a2b166a15c4433ca298c3d2269ef924489537f Mon Sep 17 00:00:00 2001 From: Ra's Al Ghul Date: Sun, 8 Sep 2019 14:56:58 -0700 Subject: [PATCH 05/26] Build System Fix(Gitain) * Give error if pow phase is finished * Force Sync to allow for staking without mnsync * Fix error * Update rpcmisc.cpp * Update rpcmisc.cpp * more ignore * Update fundamentalnode-sync.cpp * Add gitian build python script * Update Univalue * add missing gencpp * Add missing includes * Fix Gitian build Update Univalue add missing gencpp Add missing includes * Revert "Update fundamentalnode-sync.cpp" This reverts commit 323b13fc599b03982b0ca7c3f32342537a6b992f * Fix gitian build and minor updates * remove forcesync --- .gitignore | 4 +- contrib/gitian-build.py | 262 ++++++++ src/Makefile.am | 4 + src/config/vitae-config.h | 340 ----------- src/rpcmining.cpp | 6 +- src/univalue/.travis.yml | 0 src/univalue/COPYING | 0 src/univalue/Makefile.am | 0 src/univalue/README.md | 0 src/univalue/TODO | 0 src/univalue/build-aux/m4/ax_boost_base.m4 | 281 --------- src/univalue/build-aux/m4/ax_boost_chrono.m4 | 119 ---- .../build-aux/m4/ax_boost_filesystem.m4 | 119 ---- .../build-aux/m4/ax_boost_program_options.m4 | 109 ---- src/univalue/build-aux/m4/ax_boost_system.m4 | 121 ---- src/univalue/build-aux/m4/ax_boost_thread.m4 | 150 ----- .../m4/ax_boost_unit_test_framework.m4 | 138 ----- .../build-aux/m4/ax_check_compile_flag.m4 | 72 --- .../build-aux/m4/ax_check_link_flag.m4 | 71 --- .../build-aux/m4/ax_check_preproc_flag.m4 | 72 --- .../build-aux/m4/ax_cxx_compile_stdcxx.m4 | 562 ------------------ .../build-aux/m4/ax_gcc_func_attribute.m4 | 217 ------- src/univalue/build-aux/m4/ax_pthread.m4 | 332 ----------- .../build-aux/m4/bitcoin_find_bdb48.m4 | 66 -- src/univalue/build-aux/m4/bitcoin_qt.m4 | 512 ---------------- .../build-aux/m4/bitcoin_subdir_to_include.m4 | 14 - src/univalue/configure.ac | 0 src/univalue/gen/gen.cpp | 84 +++ src/univalue/include/univalue.h | 0 src/univalue/lib/univalue.cpp | 0 src/univalue/lib/univalue_escapes.h | 0 src/univalue/lib/univalue_read.cpp | 0 src/univalue/lib/univalue_utffilter.h | 0 src/univalue/lib/univalue_write.cpp | 0 src/univalue/pc/libunivalue-uninstalled.pc.in | 0 src/univalue/pc/libunivalue.pc.in | 0 src/univalue/test/fail1.json | 0 src/univalue/test/fail10.json | 0 src/univalue/test/fail11.json | 0 src/univalue/test/fail12.json | 0 src/univalue/test/fail13.json | 0 src/univalue/test/fail14.json | 0 src/univalue/test/fail15.json | 0 src/univalue/test/fail16.json | 0 src/univalue/test/fail17.json | 0 src/univalue/test/fail18.json | 0 src/univalue/test/fail19.json | 0 src/univalue/test/fail2.json | 0 src/univalue/test/fail20.json | 0 src/univalue/test/fail21.json | 0 src/univalue/test/fail22.json | 0 src/univalue/test/fail23.json | 0 src/univalue/test/fail24.json | 0 src/univalue/test/fail25.json | 0 src/univalue/test/fail26.json | 0 src/univalue/test/fail27.json | 0 src/univalue/test/fail28.json | 0 src/univalue/test/fail29.json | 0 src/univalue/test/fail3.json | 0 src/univalue/test/fail30.json | 0 src/univalue/test/fail31.json | 0 src/univalue/test/fail32.json | 0 src/univalue/test/fail33.json | 0 src/univalue/test/fail34.json | 0 src/univalue/test/fail35.json | 0 src/univalue/test/fail36.json | 0 src/univalue/test/fail37.json | 0 src/univalue/test/fail38.json | 0 src/univalue/test/fail39.json | 0 src/univalue/test/fail4.json | 0 src/univalue/test/fail40.json | 0 src/univalue/test/fail41.json | 0 src/univalue/test/fail42.json | Bin src/univalue/test/fail44.json | 0 src/univalue/test/fail5.json | 0 src/univalue/test/fail6.json | 0 src/univalue/test/fail7.json | 0 src/univalue/test/fail8.json | 0 src/univalue/test/fail9.json | 0 src/univalue/test/no_nul.cpp | 0 src/univalue/test/object.cpp | 0 src/univalue/test/pass1.json | 0 src/univalue/test/pass2.json | 0 src/univalue/test/pass3.json | 0 src/univalue/test/round1.json | 0 src/univalue/test/round2.json | 0 src/univalue/test/round3.json | 0 src/univalue/test/round4.json | 0 src/univalue/test/round5.json | 0 src/univalue/test/round6.json | 0 src/univalue/test/round7.json | 0 src/univalue/test/test_json.cpp | 0 src/univalue/test/unitester.cpp | 0 93 files changed, 358 insertions(+), 3297 deletions(-) create mode 100644 contrib/gitian-build.py delete mode 100755 src/config/vitae-config.h mode change 100755 => 100644 src/univalue/.travis.yml mode change 100755 => 100644 src/univalue/COPYING mode change 100755 => 100644 src/univalue/Makefile.am mode change 100755 => 100644 src/univalue/README.md mode change 100755 => 100644 src/univalue/TODO delete mode 100755 src/univalue/build-aux/m4/ax_boost_base.m4 delete mode 100755 src/univalue/build-aux/m4/ax_boost_chrono.m4 delete mode 100755 src/univalue/build-aux/m4/ax_boost_filesystem.m4 delete mode 100755 src/univalue/build-aux/m4/ax_boost_program_options.m4 delete mode 100755 src/univalue/build-aux/m4/ax_boost_system.m4 delete mode 100755 src/univalue/build-aux/m4/ax_boost_thread.m4 delete mode 100755 src/univalue/build-aux/m4/ax_boost_unit_test_framework.m4 delete mode 100755 src/univalue/build-aux/m4/ax_check_compile_flag.m4 delete mode 100755 src/univalue/build-aux/m4/ax_check_link_flag.m4 delete mode 100755 src/univalue/build-aux/m4/ax_check_preproc_flag.m4 delete mode 100755 src/univalue/build-aux/m4/ax_cxx_compile_stdcxx.m4 delete mode 100755 src/univalue/build-aux/m4/ax_gcc_func_attribute.m4 delete mode 100755 src/univalue/build-aux/m4/ax_pthread.m4 delete mode 100755 src/univalue/build-aux/m4/bitcoin_find_bdb48.m4 delete mode 100755 src/univalue/build-aux/m4/bitcoin_qt.m4 delete mode 100755 src/univalue/build-aux/m4/bitcoin_subdir_to_include.m4 mode change 100755 => 100644 src/univalue/configure.ac create mode 100644 src/univalue/gen/gen.cpp mode change 100755 => 100644 src/univalue/include/univalue.h mode change 100755 => 100644 src/univalue/lib/univalue.cpp mode change 100755 => 100644 src/univalue/lib/univalue_escapes.h mode change 100755 => 100644 src/univalue/lib/univalue_read.cpp mode change 100755 => 100644 src/univalue/lib/univalue_utffilter.h mode change 100755 => 100644 src/univalue/lib/univalue_write.cpp mode change 100755 => 100644 src/univalue/pc/libunivalue-uninstalled.pc.in mode change 100755 => 100644 src/univalue/pc/libunivalue.pc.in mode change 100755 => 100644 src/univalue/test/fail1.json mode change 100755 => 100644 src/univalue/test/fail10.json mode change 100755 => 100644 src/univalue/test/fail11.json mode change 100755 => 100644 src/univalue/test/fail12.json mode change 100755 => 100644 src/univalue/test/fail13.json mode change 100755 => 100644 src/univalue/test/fail14.json mode change 100755 => 100644 src/univalue/test/fail15.json mode change 100755 => 100644 src/univalue/test/fail16.json mode change 100755 => 100644 src/univalue/test/fail17.json mode change 100755 => 100644 src/univalue/test/fail18.json mode change 100755 => 100644 src/univalue/test/fail19.json mode change 100755 => 100644 src/univalue/test/fail2.json mode change 100755 => 100644 src/univalue/test/fail20.json mode change 100755 => 100644 src/univalue/test/fail21.json mode change 100755 => 100644 src/univalue/test/fail22.json mode change 100755 => 100644 src/univalue/test/fail23.json mode change 100755 => 100644 src/univalue/test/fail24.json mode change 100755 => 100644 src/univalue/test/fail25.json mode change 100755 => 100644 src/univalue/test/fail26.json mode change 100755 => 100644 src/univalue/test/fail27.json mode change 100755 => 100644 src/univalue/test/fail28.json mode change 100755 => 100644 src/univalue/test/fail29.json mode change 100755 => 100644 src/univalue/test/fail3.json mode change 100755 => 100644 src/univalue/test/fail30.json mode change 100755 => 100644 src/univalue/test/fail31.json mode change 100755 => 100644 src/univalue/test/fail32.json mode change 100755 => 100644 src/univalue/test/fail33.json mode change 100755 => 100644 src/univalue/test/fail34.json mode change 100755 => 100644 src/univalue/test/fail35.json mode change 100755 => 100644 src/univalue/test/fail36.json mode change 100755 => 100644 src/univalue/test/fail37.json mode change 100755 => 100644 src/univalue/test/fail38.json mode change 100755 => 100644 src/univalue/test/fail39.json mode change 100755 => 100644 src/univalue/test/fail4.json mode change 100755 => 100644 src/univalue/test/fail40.json mode change 100755 => 100644 src/univalue/test/fail41.json mode change 100755 => 100644 src/univalue/test/fail42.json mode change 100755 => 100644 src/univalue/test/fail44.json mode change 100755 => 100644 src/univalue/test/fail5.json mode change 100755 => 100644 src/univalue/test/fail6.json mode change 100755 => 100644 src/univalue/test/fail7.json mode change 100755 => 100644 src/univalue/test/fail8.json mode change 100755 => 100644 src/univalue/test/fail9.json mode change 100755 => 100644 src/univalue/test/no_nul.cpp mode change 100755 => 100644 src/univalue/test/object.cpp mode change 100755 => 100644 src/univalue/test/pass1.json mode change 100755 => 100644 src/univalue/test/pass2.json mode change 100755 => 100644 src/univalue/test/pass3.json mode change 100755 => 100644 src/univalue/test/round1.json mode change 100755 => 100644 src/univalue/test/round2.json mode change 100755 => 100644 src/univalue/test/round3.json mode change 100755 => 100644 src/univalue/test/round4.json mode change 100755 => 100644 src/univalue/test/round5.json mode change 100755 => 100644 src/univalue/test/round6.json mode change 100755 => 100644 src/univalue/test/round7.json mode change 100755 => 100644 src/univalue/test/test_json.cpp mode change 100755 => 100644 src/univalue/test/unitester.cpp diff --git a/.gitignore b/.gitignore index 3e77b5ca0..55f5c799a 100644 --- a/.gitignore +++ b/.gitignore @@ -150,4 +150,6 @@ libbitcoinconsensus.pc CMakeLists.txt cmake-build-debug -vitae-qt.pro \ No newline at end of file +vitae-qt.pro +src/config/vitae-config.h +src/config/vitae-config.h.in diff --git a/contrib/gitian-build.py b/contrib/gitian-build.py new file mode 100644 index 000000000..6831c313f --- /dev/null +++ b/contrib/gitian-build.py @@ -0,0 +1,262 @@ +#!/usr/bin/env python3 + +import argparse +import os +import subprocess +import sys + +def setup(): + global args, workdir + programs = ['ruby', 'git', 'make', 'wget', 'curl'] + if args.kvm: + programs += ['apt-cacher-ng', 'python-vm-builder', 'qemu-kvm', 'qemu-utils'] + elif args.docker and not os.path.isfile('/lib/systemd/system/docker.service'): + dockers = ['docker.io', 'docker-ce'] + for i in dockers: + return_code = subprocess.call(['sudo', 'apt-get', 'install', '-qq', i]) + if return_code == 0: + break + if return_code != 0: + print('Cannot find any way to install Docker.', file=sys.stderr) + sys.exit(1) + else: + programs += ['apt-cacher-ng', 'lxc', 'debootstrap'] + subprocess.check_call(['sudo', 'apt-get', 'install', '-qq'] + programs) + if not os.path.isdir('gitian.sigs'): + subprocess.check_call(['git', 'clone', 'https://github.com/pivx-Project/gitian.sigs.git']) + if not os.path.isdir('pivx-detached-sigs'): + subprocess.check_call(['git', 'clone', 'https://github.com/pivx-Project/pivx-detached-sigs.git']) + if not os.path.isdir('gitian-builder'): + subprocess.check_call(['git', 'clone', 'https://github.com/devrandom/gitian-builder.git']) + if not os.path.isdir('vitae'): + subprocess.check_call(['git', 'clone', 'https://github.com/VitaeTeam/Vitae.git']) + os.chdir('gitian-builder') + make_image_prog = ['bin/make-base-vm', '--suite', 'bionic', '--arch', 'amd64'] + if args.docker: + make_image_prog += ['--docker'] + elif not args.kvm: + make_image_prog += ['--lxc'] + subprocess.check_call(make_image_prog) + os.chdir(workdir) + if args.is_bionic and not args.kvm and not args.docker: + subprocess.check_call(['sudo', 'sed', '-i', 's/lxcbr0/br0/', '/etc/default/lxc-net']) + print('Reboot is required') + sys.exit(0) + +def build(): + global args, workdir + + os.makedirs('vitae-binaries/' + args.version, exist_ok=True) + print('\nBuilding Dependencies\n') + os.chdir('gitian-builder') + os.makedirs('inputs', exist_ok=True) + + subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://downloads.sourceforge.net/project/osslsigncode/osslsigncode/osslsigncode-1.7.1.tar.gz']) + subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://bitcoincore.org/cfields/osslsigncode-Backports-to-1.7.1.patch']) + subprocess.check_call(["echo 'a8c4e9cafba922f89de0df1f2152e7be286aba73f78505169bc351a7938dd911 inputs/osslsigncode-Backports-to-1.7.1.patch' | sha256sum -c"], shell=True) + subprocess.check_call(["echo 'f9a8cdb38b9c309326764ebc937cba1523a3a751a7ab05df3ecc99d18ae466c9 inputs/osslsigncode-1.7.1.tar.gz' | sha256sum -c"], shell=True) + subprocess.check_call(['make', '-C', '../vitae/depends', 'download', 'SOURCES_PATH=' + os.getcwd() + '/cache/common']) + + if args.linux: + print('\nCompiling ' + args.version + ' Linux') + subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'vitae='+args.commit, '--url', 'vitae='+args.url, '../vitae/contrib/gitian-descriptors/gitian-linux.yml']) + subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-linux', '--destination', '../gitian.sigs/', '../vitae/contrib/gitian-descriptors/gitian-linux.yml']) + subprocess.check_call('mv build/out/vitae-*.tar.gz build/out/src/vitae-*.tar.gz ../vitae-binaries/'+args.version, shell=True) + + if args.windows: + print('\nCompiling ' + args.version + ' Windows') + subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'vitae='+args.commit, '--url', 'vitae='+args.url, '../vitae/contrib/gitian-descriptors/gitian-win.yml']) + subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-win-unsigned', '--destination', '../gitian.sigs/', '../vitae/contrib/gitian-descriptors/gitian-win.yml']) + subprocess.check_call('mv build/out/vitae-*-win-unsigned.tar.gz inputs/', shell=True) + subprocess.check_call('mv build/out/vitae-*.zip build/out/vitae-*.exe build/out/src/vitae-*.tar.gz ../vitae-binaries/'+args.version, shell=True) + + if args.macos: + print('\nCompiling ' + args.version + ' MacOS') + subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'vitae='+args.commit, '--url', 'vitae='+args.url, '../vitae/contrib/gitian-descriptors/gitian-osx.yml']) + subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-osx-unsigned', '--destination', '../gitian.sigs/', '../vitae/contrib/gitian-descriptors/gitian-osx.yml']) + subprocess.check_call('mv build/out/vitae-*-osx-unsigned.tar.gz inputs/', shell=True) + subprocess.check_call('mv build/out/vitae-*.tar.gz build/out/vitae-*.dmg build/out/src/vitae-*.tar.gz ../vitae-binaries/'+args.version, shell=True) + + os.chdir(workdir) + + if args.commit_files: + print('\nCommitting '+args.version+' Unsigned Sigs\n') + os.chdir('gitian.sigs') + subprocess.check_call(['git', 'add', args.version+'-linux/'+args.signer]) + subprocess.check_call(['git', 'add', args.version+'-win-unsigned/'+args.signer]) + subprocess.check_call(['git', 'add', args.version+'-osx-unsigned/'+args.signer]) + subprocess.check_call(['git', 'commit', '-m', 'Add '+args.version+' unsigned sigs for '+args.signer]) + os.chdir(workdir) + +def sign(): + global args, workdir + os.chdir('gitian-builder') + + if args.windows: + print('\nSigning ' + args.version + ' Windows') + subprocess.check_call('cp inputs/vitae-' + args.version + '-win-unsigned.tar.gz inputs/vitae-win-unsigned.tar.gz', shell=True) + subprocess.check_call(['bin/gbuild', '--skip-image', '--upgrade', '--commit', 'signature='+args.commit, '../vitae/contrib/gitian-descriptors/gitian-win-signer.yml']) + subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-win-signed', '--destination', '../gitian.sigs/', '../vitae/contrib/gitian-descriptors/gitian-win-signer.yml']) + subprocess.check_call('mv build/out/vitae-*win64-setup.exe ../vitae-binaries/'+args.version, shell=True) + subprocess.check_call('mv build/out/vitae-*win32-setup.exe ../vitae-binaries/'+args.version, shell=True) + + if args.macos: + print('\nSigning ' + args.version + ' MacOS') + subprocess.check_call('cp inputs/vitae-' + args.version + '-osx-unsigned.tar.gz inputs/vitae-osx-unsigned.tar.gz', shell=True) + subprocess.check_call(['bin/gbuild', '--skip-image', '--upgrade', '--commit', 'signature='+args.commit, '../vitae/contrib/gitian-descriptors/gitian-osx-signer.yml']) + subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-osx-signed', '--destination', '../gitian.sigs/', '../vitae/contrib/gitian-descriptors/gitian-osx-signer.yml']) + subprocess.check_call('mv build/out/vitae-osx-signed.dmg ../vitae-binaries/'+args.version+'/vitae-'+args.version+'-osx.dmg', shell=True) + + os.chdir(workdir) + + if args.commit_files: + print('\nCommitting '+args.version+' Signed Sigs\n') + os.chdir('gitian.sigs') + subprocess.check_call(['git', 'add', args.version+'-win-signed/'+args.signer]) + subprocess.check_call(['git', 'add', args.version+'-osx-signed/'+args.signer]) + subprocess.check_call(['git', 'commit', '-a', '-m', 'Add '+args.version+' signed binary sigs for '+args.signer]) + os.chdir(workdir) + +def verify(): + global args, workdir + rc = 0 + os.chdir('gitian-builder') + + print('\nVerifying v'+args.version+' Linux\n') + if subprocess.call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-linux', '../vitae/contrib/gitian-descriptors/gitian-linux.yml']): + print('Verifying v'+args.version+' Linux FAILED\n') + rc = 1 + + print('\nVerifying v'+args.version+' Windows\n') + if subprocess.call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-win-unsigned', '../vitae/contrib/gitian-descriptors/gitian-win.yml']): + print('Verifying v'+args.version+' Windows FAILED\n') + rc = 1 + + print('\nVerifying v'+args.version+' MacOS\n') + if subprocess.call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-win-signed', '../vitae/contrib/gitian-descriptors/gitian-osx.yml']): + print('Verifying v'+args.version+' MacOS FAILED\n') + rc = 1 + + print('\nVerifying v'+args.version+' Signed Windows\n') + if subprocess.call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-win-signed', '../vitae/contrib/gitian-descriptors/gitian-win-signer.yml']): + print('Verifying v'+args.version+' Signed Windows FAILED\n') + rc = 1 + + print('\nVerifying v'+args.version+' Signed MacOS\n') + if subprocess.call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-osx-signed', '../vitae/contrib/gitian-descriptors/gitian-osx-signer.yml']): + print('Verifying v'+args.version+' Signed MacOS FAILED\n') + rc = 1 + + os.chdir(workdir) + return rc + +def main(): + global args, workdir + + parser = argparse.ArgumentParser(description='Script for running full Gitian builds.') + parser.add_argument('-c', '--commit', action='store_true', dest='commit', help='Indicate that the version argument is for a commit or branch') + parser.add_argument('-p', '--pull', action='store_true', dest='pull', help='Indicate that the version argument is the number of a github repository pull request') + parser.add_argument('-u', '--url', dest='url', default='https://github.com/VitaeTeam/Vitae', help='Specify the URL of the repository. Default is %(default)s') + parser.add_argument('-v', '--verify', action='store_true', dest='verify', help='Verify the Gitian build') + parser.add_argument('-b', '--build', action='store_true', dest='build', help='Do a Gitian build') + parser.add_argument('-s', '--sign', action='store_true', dest='sign', help='Make signed binaries for Windows and MacOS') + parser.add_argument('-B', '--buildsign', action='store_true', dest='buildsign', help='Build both signed and unsigned binaries') + parser.add_argument('-o', '--os', dest='os', default='lwm', help='Specify which Operating Systems the build is for. Default is %(default)s. l for Linux, w for Windows, m for MacOS') + parser.add_argument('-j', '--jobs', dest='jobs', default='2', help='Number of processes to use. Default %(default)s') + parser.add_argument('-m', '--memory', dest='memory', default='2000', help='Memory to allocate in MiB. Default %(default)s') + parser.add_argument('-k', '--kvm', action='store_true', dest='kvm', help='Use KVM instead of LXC') + parser.add_argument('-d', '--docker', action='store_true', dest='docker', help='Use Docker instead of LXC') + parser.add_argument('-S', '--setup', action='store_true', dest='setup', help='Set up the Gitian building environment. Only works on Debian-based systems (Ubuntu, Debian)') + parser.add_argument('-D', '--detach-sign', action='store_true', dest='detach_sign', help='Create the assert file for detached signing. Will not commit anything.') + parser.add_argument('-n', '--no-commit', action='store_false', dest='commit_files', help='Do not commit anything to git') + parser.add_argument('signer', nargs='?', help='GPG signer to sign each build assert file') + parser.add_argument('version', nargs='?', help='Version number, commit, or branch to build. If building a commit or branch, the -c option must be specified') + + args = parser.parse_args() + workdir = os.getcwd() + + args.is_bionic = b'bionic' in subprocess.check_output(['lsb_release', '-cs']) + + if args.kvm and args.docker: + raise Exception('Error: cannot have both kvm and docker') + + # Ensure no more than one environment variable for gitian-builder (USE_LXC, USE_VBOX, USE_DOCKER) is set as they + # can interfere (e.g., USE_LXC being set shadows USE_DOCKER; for details see gitian-builder/libexec/make-clean-vm). + os.environ['USE_LXC'] = '' + os.environ['USE_VBOX'] = '' + os.environ['USE_DOCKER'] = '' + if args.docker: + os.environ['USE_DOCKER'] = '1' + elif not args.kvm: + os.environ['USE_LXC'] = '1' + if 'GITIAN_HOST_IP' not in os.environ.keys(): + os.environ['GITIAN_HOST_IP'] = '10.0.3.1' + if 'LXC_GUEST_IP' not in os.environ.keys(): + os.environ['LXC_GUEST_IP'] = '10.0.3.5' + + if args.setup: + setup() + + if args.buildsign: + args.build = True + args.sign = True + + if not args.build and not args.sign and not args.verify: + sys.exit(0) + + args.linux = 'l' in args.os + args.windows = 'w' in args.os + args.macos = 'm' in args.os + + # Disable for MacOS if no SDK found + if args.macos and not os.path.isfile('gitian-builder/inputs/MacOSX10.11.sdk.tar.gz'): + print('Cannot build for MacOS, SDK does not exist. Will build for other OSes') + args.macos = False + + args.sign_prog = 'true' if args.detach_sign else 'gpg --detach-sign' + + script_name = os.path.basename(sys.argv[0]) + if not args.signer: + print(script_name+': Missing signer') + print('Try '+script_name+' --help for more information') + sys.exit(1) + if not args.version: + print(script_name+': Missing version') + print('Try '+script_name+' --help for more information') + sys.exit(1) + + # Add leading 'v' for tags + if args.commit and args.pull: + raise Exception('Cannot have both commit and pull') + args.commit = ('' if args.commit else 'v') + args.version + + os.chdir('vitae') + if args.pull: + subprocess.check_call(['git', 'fetch', args.url, 'refs/pull/'+args.version+'/merge']) + os.chdir('../gitian-builder/inputs/vitae') + subprocess.check_call(['git', 'fetch', args.url, 'refs/pull/'+args.version+'/merge']) + args.commit = subprocess.check_output(['git', 'show', '-s', '--format=%H', 'FETCH_HEAD'], universal_newlines=True, encoding='utf8').strip() + args.version = 'pull-' + args.version + print(args.commit) + subprocess.check_call(['git', 'fetch']) + subprocess.check_call(['git', 'checkout', args.commit]) + os.chdir(workdir) + + os.chdir('gitian-builder') + subprocess.check_call(['git', 'pull']) + os.chdir(workdir) + + if args.build: + build() + + if args.sign: + sign() + + if args.verify: + os.chdir('gitian.sigs') + subprocess.check_call(['git', 'pull']) + os.chdir(workdir) + sys.exit(verify()) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/src/Makefile.am b/src/Makefile.am index 8d08b4f6b..444e9d3a4 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -127,6 +127,10 @@ BITCOIN_CORE_H = \ limitedmap.h \ main.h \ masternode.h \ + masternode-sync.h \ + masternode-payments.h \ + masternode-budget.h \ + masternodeman.h \ masternode-pos.h \ masternodeman.h \ masternodeconfig.h \ diff --git a/src/config/vitae-config.h b/src/config/vitae-config.h deleted file mode 100755 index 39b9ed874..000000000 --- a/src/config/vitae-config.h +++ /dev/null @@ -1,340 +0,0 @@ -/* src/config/vitae-config.h. Generated from vitae-config.h.in by configure. */ -/* src/config/vitae-config.h.in. Generated from configure.ac by autoheader. */ - -#ifndef VIT_CONFIG_H - -#define VIT_CONFIG_H - -/* Define if building universal (internal helper macro) */ -/* #undef AC_APPLE_UNIVERSAL_BUILD */ - -/* Version is release */ -#define CLIENT_VERSION_IS_RELEASE true - -/* Major version */ -#define CLIENT_VERSION_MAJOR 4 - -/* Minor version */ -#define CLIENT_VERSION_MINOR 4 - -/* Build revision */ -#define CLIENT_VERSION_REVISION 0 - -/* Version Build */ -#define CLIENT_VERSION_BUILD 3 - -/* Version is release */ -#define COPYRIGHT_YEAR 2019 - -/* Define to 1 to enable wallet functions */ -#define ENABLE_WALLET 1 - -/* Define to 1 to enable ZMQ functions */ -#define ENABLE_ZMQ 0 - -/* parameter and return value type for __fdelt_chk */ -/* #undef FDELT_TYPE */ - -/* define if the Boost library is available */ -#define HAVE_BOOST /**/ - -/* define if the Boost::Chrono library is available */ -#define HAVE_BOOST_CHRONO /**/ - -/* define if the Boost::Filesystem library is available */ -#define HAVE_BOOST_FILESYSTEM /**/ - -/* define if the Boost::PROGRAM_OPTIONS library is available */ -#define HAVE_BOOST_PROGRAM_OPTIONS /**/ - -/* define if the Boost::System library is available */ -#define HAVE_BOOST_SYSTEM /**/ - -/* define if the Boost::Thread library is available */ -#define HAVE_BOOST_THREAD /**/ - -/* define if the Boost::Unit_Test_Framework library is available */ -/* #undef HAVE_BOOST_UNIT_TEST_FRAMEWORK */ - -/* Define this symbol if the consensus lib has been built */ -/* #undef HAVE_CONSENSUS_LIB */ - -/* define if the compiler supports basic C++11 syntax */ -#define HAVE_CXX11 1 - -/* Define to 1 if you have the declaration of `be32toh', and to 0 if you - don't. */ -#define HAVE_DECL_BE32TOH 0 - -/* Define to 1 if you have the declaration of `be64toh', and to 0 if you - don't. */ -#define HAVE_DECL_BE64TOH 0 - -/* Define to 1 if you have the declaration of `htobe32', and to 0 if you - don't. */ -#define HAVE_DECL_HTOBE32 0 - -/* Define to 1 if you have the declaration of `htobe64', and to 0 if you - don't. */ -#define HAVE_DECL_HTOBE64 0 - -/* Define to 1 if you have the declaration of `htole32', and to 0 if you - don't. */ -#define HAVE_DECL_HTOLE32 0 - -/* Define to 1 if you have the declaration of `htole64', and to 0 if you - don't. */ -#define HAVE_DECL_HTOLE64 0 - -/* Define to 1 if you have the declaration of `le32toh', and to 0 if you - don't. */ -#define HAVE_DECL_LE32TOH 0 - -/* Define to 1 if you have the declaration of `le64toh', and to 0 if you - don't. */ -#define HAVE_DECL_LE64TOH 0 - -/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you - don't. */ -#define HAVE_DECL_STRERROR_R 0 - -/* Define to 1 if you have the declaration of `strnlen', and to 0 if you - don't. */ -#define HAVE_DECL_STRNLEN 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_DLFCN_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_ENDIAN_H */ - -/* Define to 1 if the system has the `dllexport' function attribute */ -#define HAVE_FUNC_ATTRIBUTE_DLLEXPORT 1 - -/* Define to 1 if the system has the `dllimport' function attribute */ -#define HAVE_FUNC_ATTRIBUTE_DLLIMPORT 1 - -/* Define to 1 if the system has the `visibility' function attribute */ -#define HAVE_FUNC_ATTRIBUTE_VISIBILITY 1 - -/* Define this symbol if you have getaddrinfo_a */ -/* #undef HAVE_GETADDRINFO_A */ - -/* Define this symbol if you have inet_pton */ -/* #undef HAVE_INET_PTON */ - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `advapi32' library (-ladvapi32). */ -#define HAVE_LIBADVAPI32 1 - -/* Define to 1 if you have the `comctl32' library (-lcomctl32). */ -#define HAVE_LIBCOMCTL32 1 - -/* Define to 1 if you have the `comdlg32' library (-lcomdlg32). */ -#define HAVE_LIBCOMDLG32 1 - -/* Define to 1 if you have the `crypt32' library (-lcrypt32). */ -#define HAVE_LIBCRYPT32 1 - -/* Define to 1 if you have the `crypto' library (-lcrypto). */ -#define HAVE_LIBCRYPTO 1 - -/* Define to 1 if you have the `gdi32' library (-lgdi32). */ -#define HAVE_LIBGDI32 1 - -/* Define to 1 if you have the `imm32' library (-limm32). */ -#define HAVE_LIBIMM32 1 - -/* Define to 1 if you have the `iphlpapi' library (-liphlpapi). */ -#define HAVE_LIBIPHLPAPI 1 - -/* Define to 1 if you have the `kernel32' library (-lkernel32). */ -#define HAVE_LIBKERNEL32 1 - -/* Define to 1 if you have the `mingwthrd' library (-lmingwthrd). */ -#define HAVE_LIBMINGWTHRD 1 - -/* Define to 1 if you have the `mswsock' library (-lmswsock). */ -#define HAVE_LIBMSWSOCK 1 - -/* Define to 1 if you have the `ole32' library (-lole32). */ -#define HAVE_LIBOLE32 1 - -/* Define to 1 if you have the `oleaut32' library (-loleaut32). */ -#define HAVE_LIBOLEAUT32 1 - -/* Define to 1 if you have the `rpcrt4' library (-lrpcrt4). */ -#define HAVE_LIBRPCRT4 1 - -/* Define to 1 if you have the `shell32' library (-lshell32). */ -#define HAVE_LIBSHELL32 1 - -/* Define to 1 if you have the `shlwapi' library (-lshlwapi). */ -#define HAVE_LIBSHLWAPI 1 - -/* Define to 1 if you have the `ssp' library (-lssp). */ -#define HAVE_LIBSSP 1 - -/* Define to 1 if you have the `user32' library (-luser32). */ -#define HAVE_LIBUSER32 1 - -/* Define to 1 if you have the `uuid' library (-luuid). */ -#define HAVE_LIBUUID 1 - -/* Define to 1 if you have the `winmm' library (-lwinmm). */ -#define HAVE_LIBWINMM 1 - -/* Define to 1 if you have the `winspool' library (-lwinspool). */ -#define HAVE_LIBWINSPOOL 1 - -/* Define to 1 if you have the `ws2_32' library (-lws2_32). */ -#define HAVE_LIBWS2_32 1 - -/* Define to 1 if you have the `z ' library (-lz ). */ -#define HAVE_LIBZ_ 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MINIUPNPC_MINIUPNPC_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MINIUPNPC_MINIWGET_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MINIUPNPC_UPNPCOMMANDS_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MINIUPNPC_UPNPERRORS_H */ - -/* Define this symbol if you have MSG_NOSIGNAL */ -/* #undef HAVE_MSG_NOSIGNAL */ - -/* Define if you have POSIX threads libraries and header files. */ -#define HAVE_PTHREAD 1 - -/* Have PTHREAD_PRIO_INHERIT. */ -#define HAVE_PTHREAD_PRIO_INHERIT 1 - -/* Define to 1 to enable trading dialog */ -#define HAVE_QT5 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDIO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strerror_r' function. */ -/* #undef HAVE_STRERROR_R */ - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_PRCTL_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SELECT_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define if the visibility attribute is supported. */ -#define HAVE_VISIBILITY_ATTRIBUTE 1 - -/* Define this symbol if boost sleep works */ -/* #undef HAVE_WORKING_BOOST_SLEEP */ - -/* Define this symbol if boost sleep_for works */ -#define HAVE_WORKING_BOOST_SLEEP_FOR 1 - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "https://github.com/VitaeTeam/Vitae/issues" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "Vitae Core" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "Vitae Core 4.4.0" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "vitae" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "vitaetoken.io" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "4.4.0" - -/* Define to necessary symbol if this constant - uses a non-standard name on - your system. */ -/* #undef PTHREAD_CREATE_JOINABLE */ - -/* Define this symbol if the qt platform is cocoa */ -/* #undef QT_QPA_PLATFORM_COCOA */ - -/* Define this symbol if the qt platform is windows */ -#define QT_QPA_PLATFORM_WINDOWS 1 - -/* Define this symbol if the qt platform is xcb */ -/* #undef QT_QPA_PLATFORM_XCB */ - -/* Define this symbol if qt plugins are static */ -#define QT_STATICPLUGIN 1 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define to 1 if strerror_r returns char *. */ -/* #undef STRERROR_R_CHAR_P */ - -/* Define if dbus support should be compiled in */ -/* #undef USE_DBUS */ - -/* Define if QR support should be compiled in */ -/* #undef USE_QRCODE */ - -/* UPnP support not compiled if undefined, otherwise value (0 or 1) determines - default state */ -/* #undef USE_UPNP */ - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -/* # undef WORDS_BIGENDIAN */ -# endif -#endif - -/* Number of bits in a file offset, on hosts where this is settable. */ -#define _FILE_OFFSET_BITS 64 - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ - -#endif //VIT_CONFIG_H diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 09491320e..eddd136f4 100755 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -133,7 +133,8 @@ UniValue setgenerate(const UniValue& params, bool fHelp) if (pwalletMain == NULL) throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found (disabled)"); - + if((int)chainActive.Height() >= Params().LAST_POW_BLOCK()) + throw JSONRPCError(RPC_INTERNAL_ERROR, "Proof of work phase is complete"); bool fGenerate = true; if (params.size() > 0) fGenerate = params[0].get_bool(); @@ -370,6 +371,9 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) std::string strMode = "template"; UniValue lpval = NullUniValue; + if((int)chainActive.Height() >= Params().LAST_POW_BLOCK()) + throw JSONRPCError(RPC_INTERNAL_ERROR, "Proof of work phase is complete"); + if (params.size() > 0) { const UniValue& oparam = params[0].get_obj(); const UniValue& modeval = find_value(oparam, "mode"); diff --git a/src/univalue/.travis.yml b/src/univalue/.travis.yml old mode 100755 new mode 100644 diff --git a/src/univalue/COPYING b/src/univalue/COPYING old mode 100755 new mode 100644 diff --git a/src/univalue/Makefile.am b/src/univalue/Makefile.am old mode 100755 new mode 100644 diff --git a/src/univalue/README.md b/src/univalue/README.md old mode 100755 new mode 100644 diff --git a/src/univalue/TODO b/src/univalue/TODO old mode 100755 new mode 100644 diff --git a/src/univalue/build-aux/m4/ax_boost_base.m4 b/src/univalue/build-aux/m4/ax_boost_base.m4 deleted file mode 100755 index 3f24d5ddc..000000000 --- a/src/univalue/build-aux/m4/ax_boost_base.m4 +++ /dev/null @@ -1,281 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_boost_base.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -# DESCRIPTION -# -# Test for the Boost C++ libraries of a particular version (or newer) -# -# If no path to the installed boost library is given the macro searchs -# under /usr, /usr/local, /opt and /opt/local and evaluates the -# $BOOST_ROOT environment variable. Further documentation is available at -# . -# -# This macro calls: -# -# AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS) -# -# And sets: -# -# HAVE_BOOST -# -# LICENSE -# -# Copyright (c) 2008 Thomas Porschberg -# Copyright (c) 2009 Peter Adolphs -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 23 - -AC_DEFUN([AX_BOOST_BASE], -[ -AC_ARG_WITH([boost], - [AS_HELP_STRING([--with-boost@<:@=ARG@:>@], - [use Boost library from a standard location (ARG=yes), - from the specified location (ARG=), - or disable it (ARG=no) - @<:@ARG=yes@:>@ ])], - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ac_boost_path="" - else - want_boost="yes" - ac_boost_path="$withval" - fi - ], - [want_boost="yes"]) - - -AC_ARG_WITH([boost-libdir], - AS_HELP_STRING([--with-boost-libdir=LIB_DIR], - [Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]), - [ - if test -d "$withval" - then - ac_boost_lib_path="$withval" - else - AC_MSG_ERROR(--with-boost-libdir expected directory name) - fi - ], - [ac_boost_lib_path=""] -) - -if test "x$want_boost" = "xyes"; then - boost_lib_version_req=ifelse([$1], ,1.20.0,$1) - boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'` - boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'` - boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'` - boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` - if test "x$boost_lib_version_req_sub_minor" = "x" ; then - boost_lib_version_req_sub_minor="0" - fi - WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor` - AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req) - succeeded=no - - dnl On 64-bit systems check for system libraries in both lib64 and lib. - dnl The former is specified by FHS, but e.g. Debian does not adhere to - dnl this (as it rises problems for generic multi-arch support). - dnl The last entry in the list is chosen by default when no libraries - dnl are found, e.g. when only header-only libraries are installed! - libsubdirs="lib" - ax_arch=`uname -m` - case $ax_arch in - x86_64) - libsubdirs="lib64 libx32 lib lib64" - ;; - ppc64|s390x|sparc64|aarch64) - libsubdirs="lib64 lib lib64" - ;; - esac - - dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give - dnl them priority over the other paths since, if libs are found there, they - dnl are almost assuredly the ones desired. - AC_REQUIRE([AC_CANONICAL_HOST]) - libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs" - - case ${host_cpu} in - i?86) - libsubdirs="lib/i386-${host_os} $libsubdirs" - ;; - esac - - dnl some arches may advertise a cpu type that doesn't line up with their - dnl prefix's cpu type. For example, uname may report armv7l while libs are - dnl installed to /usr/lib/arm-linux-gnueabihf. Try getting the compiler's - dnl value for an extra chance of finding the correct path. - libsubdirs="lib/`$CXX -dumpmachine 2>/dev/null` $libsubdirs" - - dnl first we check the system location for boost libraries - dnl this location ist chosen if boost libraries are installed with the --layout=system option - dnl or if you install boost with RPM - if test "$ac_boost_path" != ""; then - BOOST_CPPFLAGS="-I$ac_boost_path/include" - for ac_boost_path_tmp in $libsubdirs; do - if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then - BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp" - break - fi - done - elif test "$cross_compiling" != yes; then - for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do - if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then - for libsubdir in $libsubdirs ; do - if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi - done - BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir" - BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include" - break; - fi - done - fi - - dnl overwrite ld flags if we have required special directory with - dnl --with-boost-libdir parameter - if test "$ac_boost_lib_path" != ""; then - BOOST_LDFLAGS="-L$ac_boost_lib_path" - fi - - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - export LDFLAGS - - AC_REQUIRE([AC_PROG_CXX]) - AC_LANG_PUSH(C++) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - @%:@include - ]], [[ - #if BOOST_VERSION >= $WANT_BOOST_VERSION - // Everything is okay - #else - # error Boost version is too old - #endif - ]])],[ - AC_MSG_RESULT(yes) - succeeded=yes - found_system=yes - ],[: - ]) - AC_LANG_POP([C++]) - - - - dnl if we found no boost with system layout we search for boost libraries - dnl built and installed without the --layout=system option or for a staged(not installed) version - if test "x$succeeded" != "xyes"; then - _version=0 - if test "$ac_boost_path" != ""; then - if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then - for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do - _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` - V_CHECK=`expr $_version_tmp \> $_version` - if test "$V_CHECK" = "1" ; then - _version=$_version_tmp - fi - VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` - BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE" - done - fi - else - if test "$cross_compiling" != yes; then - for ac_boost_path in /usr /usr/local /opt /opt/local ; do - if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then - for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do - _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` - V_CHECK=`expr $_version_tmp \> $_version` - if test "$V_CHECK" = "1" ; then - _version=$_version_tmp - best_path=$ac_boost_path - fi - done - fi - done - - VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` - BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" - if test "$ac_boost_lib_path" = ""; then - for libsubdir in $libsubdirs ; do - if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi - done - BOOST_LDFLAGS="-L$best_path/$libsubdir" - fi - fi - - if test "x$BOOST_ROOT" != "x"; then - for libsubdir in $libsubdirs ; do - if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi - done - if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then - version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'` - stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'` - stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'` - V_CHECK=`expr $stage_version_shorten \>\= $_version` - if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then - AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT) - BOOST_CPPFLAGS="-I$BOOST_ROOT" - BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir" - fi - fi - fi - fi - - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - export LDFLAGS - - AC_LANG_PUSH(C++) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - @%:@include - ]], [[ - #if BOOST_VERSION >= $WANT_BOOST_VERSION - // Everything is okay - #else - # error Boost version is too old - #endif - ]])],[ - AC_MSG_RESULT(yes) - succeeded=yes - found_system=yes - ],[: - ]) - AC_LANG_POP([C++]) - fi - - if test "$succeeded" != "yes" ; then - if test "$_version" = "0" ; then - AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation.]]) - else - AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).]) - fi - # execute ACTION-IF-NOT-FOUND (if present): - ifelse([$3], , :, [$3]) - else - AC_SUBST(BOOST_CPPFLAGS) - AC_SUBST(BOOST_LDFLAGS) - AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available]) - # execute ACTION-IF-FOUND (if present): - ifelse([$2], , :, [$2]) - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" -fi - -]) diff --git a/src/univalue/build-aux/m4/ax_boost_chrono.m4 b/src/univalue/build-aux/m4/ax_boost_chrono.m4 deleted file mode 100755 index 318ecea17..000000000 --- a/src/univalue/build-aux/m4/ax_boost_chrono.m4 +++ /dev/null @@ -1,119 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_boost_chrono.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BOOST_CHRONO -# -# DESCRIPTION -# -# Test for System library from the Boost C++ libraries. The macro requires -# a preceding call to AX_BOOST_BASE. Further documentation is available at -# . -# -# This macro calls: -# -# AC_SUBST(BOOST_CHRONO_LIB) -# -# And sets: -# -# HAVE_BOOST_CHRONO -# -# LICENSE -# -# Copyright (c) 2012 Xiyue Deng -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 1 - -AC_DEFUN([AX_BOOST_CHRONO], -[ - AC_ARG_WITH([boost-chrono], - AS_HELP_STRING([--with-boost-chrono@<:@=special-lib@:>@], - [use the Chrono library from boost - it is possible to specify a certain library for the linker - e.g. --with-boost-chrono=boost_chrono-gcc-mt ]), - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ax_boost_user_chrono_lib="" - else - want_boost="yes" - ax_boost_user_chrono_lib="$withval" - fi - ], - [want_boost="yes"] - ) - - if test "x$want_boost" = "xyes"; then - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_BUILD]) - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - export LDFLAGS - - AC_CACHE_CHECK(whether the Boost::Chrono library is available, - ax_cv_boost_chrono, - [AC_LANG_PUSH([C++]) - CXXFLAGS_SAVE=$CXXFLAGS - - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], - [[boost::chrono::system_clock::time_point time;]])], - ax_cv_boost_chrono=yes, ax_cv_boost_chrono=no) - CXXFLAGS=$CXXFLAGS_SAVE - AC_LANG_POP([C++]) - ]) - if test "x$ax_cv_boost_chrono" = "xyes"; then - AC_SUBST(BOOST_CPPFLAGS) - - AC_DEFINE(HAVE_BOOST_CHRONO,,[define if the Boost::Chrono library is available]) - BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` - - LDFLAGS_SAVE=$LDFLAGS - if test "x$ax_boost_user_chrono_lib" = "x"; then - ax_lib= - for libextension in `ls $BOOSTLIBDIR/libboost_chrono*.so* $BOOSTLIBDIR/libboost_chrono*.dylib* $BOOSTLIBDIR/libboost_chrono*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_chrono.*\)\.so.*$;\1;' -e 's;^lib\(boost_chrono.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_chrono.*\)\.a.*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_CHRONO_LIB="-l$ax_lib"; AC_SUBST(BOOST_CHRONO_LIB) link_chrono="yes"; break], - [link_chrono="no"]) - done - if test "x$link_chrono" != "xyes"; then - for libextension in `ls $BOOSTLIBDIR/boost_chrono*.dll* $BOOSTLIBDIR/boost_chrono*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_chrono.*\)\.dll.*$;\1;' -e 's;^\(boost_chrono.*\)\.a.*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_CHRONO_LIB="-l$ax_lib"; AC_SUBST(BOOST_CHRONO_LIB) link_chrono="yes"; break], - [link_chrono="no"]) - done - fi - - else - for ax_lib in $ax_boost_user_chrono_lib boost_chrono-$ax_boost_user_chrono_lib; do - AC_CHECK_LIB($ax_lib, exit, - [BOOST_CHRONO_LIB="-l$ax_lib"; AC_SUBST(BOOST_CHRONO_LIB) link_chrono="yes"; break], - [link_chrono="no"]) - done - - fi - if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the boost_chrono library!) - fi - if test "x$link_chrono" = "xno"; then - AC_MSG_ERROR(Could not link against $ax_lib !) - fi - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" - fi -]) diff --git a/src/univalue/build-aux/m4/ax_boost_filesystem.m4 b/src/univalue/build-aux/m4/ax_boost_filesystem.m4 deleted file mode 100755 index f5c9d5647..000000000 --- a/src/univalue/build-aux/m4/ax_boost_filesystem.m4 +++ /dev/null @@ -1,119 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BOOST_FILESYSTEM -# -# DESCRIPTION -# -# Test for Filesystem library from the Boost C++ libraries. The macro -# requires a preceding call to AX_BOOST_BASE. Further documentation is -# available at . -# -# This macro calls: -# -# AC_SUBST(BOOST_FILESYSTEM_LIB) -# -# And sets: -# -# HAVE_BOOST_FILESYSTEM -# -# LICENSE -# -# Copyright (c) 2009 Thomas Porschberg -# Copyright (c) 2009 Michael Tindal -# Copyright (c) 2009 Roman Rybalko -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 26 - -AC_DEFUN([AX_BOOST_FILESYSTEM], -[ - AC_ARG_WITH([boost-filesystem], - AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@], - [use the Filesystem library from boost - it is possible to specify a certain library for the linker - e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]), - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ax_boost_user_filesystem_lib="" - else - want_boost="yes" - ax_boost_user_filesystem_lib="$withval" - fi - ], - [want_boost="yes"] - ) - - if test "x$want_boost" = "xyes"; then - AC_REQUIRE([AC_PROG_CC]) - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - export LDFLAGS - - LIBS_SAVED=$LIBS - LIBS="$LIBS $BOOST_SYSTEM_LIB" - export LIBS - - AC_CACHE_CHECK(whether the Boost::Filesystem library is available, - ax_cv_boost_filesystem, - [AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], - [[using namespace boost::filesystem; - path my_path( "foo/bar/data.txt" ); - return 0;]])], - ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no) - AC_LANG_POP([C++]) - ]) - if test "x$ax_cv_boost_filesystem" = "xyes"; then - AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available]) - BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` - ax_lib= - if test "x$ax_boost_user_filesystem_lib" = "x"; then - for libextension in `ls -r $BOOSTLIBDIR/libboost_filesystem* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], - [link_filesystem="no"]) - done - if test "x$link_filesystem" != "xyes"; then - for libextension in `ls -r $BOOSTLIBDIR/boost_filesystem* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], - [link_filesystem="no"]) - done - fi - else - for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do - AC_CHECK_LIB($ax_lib, exit, - [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], - [link_filesystem="no"]) - done - - fi - if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the boost_filesystem library!) - fi - if test "x$link_filesystem" != "xyes"; then - AC_MSG_ERROR(Could not link against $ax_lib !) - fi - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" - LIBS="$LIBS_SAVED" - fi -]) diff --git a/src/univalue/build-aux/m4/ax_boost_program_options.m4 b/src/univalue/build-aux/m4/ax_boost_program_options.m4 deleted file mode 100755 index f59144185..000000000 --- a/src/univalue/build-aux/m4/ax_boost_program_options.m4 +++ /dev/null @@ -1,109 +0,0 @@ -# ============================================================================ -# http://www.gnu.org/software/autoconf-archive/ax_boost_program_options.html -# ============================================================================ -# -# SYNOPSIS -# -# AX_BOOST_PROGRAM_OPTIONS -# -# DESCRIPTION -# -# Test for program options library from the Boost C++ libraries. The macro -# requires a preceding call to AX_BOOST_BASE. Further documentation is -# available at . -# -# This macro calls: -# -# AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) -# -# And sets: -# -# HAVE_BOOST_PROGRAM_OPTIONS -# -# LICENSE -# -# Copyright (c) 2009 Thomas Porschberg -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 22 - -AC_DEFUN([AX_BOOST_PROGRAM_OPTIONS], -[ - AC_ARG_WITH([boost-program-options], - AS_HELP_STRING([--with-boost-program-options@<:@=special-lib@:>@], - [use the program options library from boost - it is possible to specify a certain library for the linker - e.g. --with-boost-program-options=boost_program_options-gcc-mt-1_33_1 ]), - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ax_boost_user_program_options_lib="" - else - want_boost="yes" - ax_boost_user_program_options_lib="$withval" - fi - ], - [want_boost="yes"] - ) - - if test "x$want_boost" = "xyes"; then - AC_REQUIRE([AC_PROG_CC]) - export want_boost - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - export LDFLAGS - AC_CACHE_CHECK([whether the Boost::Program_Options library is available], - ax_cv_boost_program_options, - [AC_LANG_PUSH(C++) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include - ]], - [[boost::program_options::options_description generic("Generic options"); - return 0;]])], - ax_cv_boost_program_options=yes, ax_cv_boost_program_options=no) - AC_LANG_POP([C++]) - ]) - if test "$ax_cv_boost_program_options" = yes; then - AC_DEFINE(HAVE_BOOST_PROGRAM_OPTIONS,,[define if the Boost::PROGRAM_OPTIONS library is available]) - BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` - if test "x$ax_boost_user_program_options_lib" = "x"; then - ax_lib= - for libextension in `ls $BOOSTLIBDIR/libboost_program_options*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_program_options*.dylib* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.dylib.*$;\1;'` `ls $BOOSTLIBDIR/libboost_program_options*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.a.*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break], - [link_program_options="no"]) - done - if test "x$link_program_options" != "xyes"; then - for libextension in `ls $BOOSTLIBDIR/boost_program_options*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_program_options.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/boost_program_options*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_program_options.*\)\.a.*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break], - [link_program_options="no"]) - done - fi - else - for ax_lib in $ax_boost_user_program_options_lib boost_program_options-$ax_boost_user_program_options_lib; do - AC_CHECK_LIB($ax_lib, main, - [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break], - [link_program_options="no"]) - done - fi - if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the boost_program_options library!) - fi - if test "x$link_program_options" != "xyes"; then - AC_MSG_ERROR([Could not link against [$ax_lib] !]) - fi - fi - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" - fi -]) diff --git a/src/univalue/build-aux/m4/ax_boost_system.m4 b/src/univalue/build-aux/m4/ax_boost_system.m4 deleted file mode 100755 index 9c78280fc..000000000 --- a/src/univalue/build-aux/m4/ax_boost_system.m4 +++ /dev/null @@ -1,121 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_boost_system.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BOOST_SYSTEM -# -# DESCRIPTION -# -# Test for System library from the Boost C++ libraries. The macro requires -# a preceding call to AX_BOOST_BASE. Further documentation is available at -# . -# -# This macro calls: -# -# AC_SUBST(BOOST_SYSTEM_LIB) -# -# And sets: -# -# HAVE_BOOST_SYSTEM -# -# LICENSE -# -# Copyright (c) 2008 Thomas Porschberg -# Copyright (c) 2008 Michael Tindal -# Copyright (c) 2008 Daniel Casimiro -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 17 - -AC_DEFUN([AX_BOOST_SYSTEM], -[ - AC_ARG_WITH([boost-system], - AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@], - [use the System library from boost - it is possible to specify a certain library for the linker - e.g. --with-boost-system=boost_system-gcc-mt ]), - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ax_boost_user_system_lib="" - else - want_boost="yes" - ax_boost_user_system_lib="$withval" - fi - ], - [want_boost="yes"] - ) - - if test "x$want_boost" = "xyes"; then - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_BUILD]) - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - export LDFLAGS - - AC_CACHE_CHECK(whether the Boost::System library is available, - ax_cv_boost_system, - [AC_LANG_PUSH([C++]) - CXXFLAGS_SAVE=$CXXFLAGS - - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], - [[boost::system::system_category]])], - ax_cv_boost_system=yes, ax_cv_boost_system=no) - CXXFLAGS=$CXXFLAGS_SAVE - AC_LANG_POP([C++]) - ]) - if test "x$ax_cv_boost_system" = "xyes"; then - AC_SUBST(BOOST_CPPFLAGS) - - AC_DEFINE(HAVE_BOOST_SYSTEM,,[define if the Boost::System library is available]) - BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` - - LDFLAGS_SAVE=$LDFLAGS - if test "x$ax_boost_user_system_lib" = "x"; then - ax_lib= - for libextension in `ls -r $BOOSTLIBDIR/libboost_system* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], - [link_system="no"]) - done - if test "x$link_system" != "xyes"; then - for libextension in `ls -r $BOOSTLIBDIR/boost_system* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], - [link_system="no"]) - done - fi - - else - for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do - AC_CHECK_LIB($ax_lib, exit, - [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], - [link_system="no"]) - done - - fi - if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the boost_system library!) - fi - if test "x$link_system" = "xno"; then - AC_MSG_ERROR(Could not link against $ax_lib !) - fi - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" - fi -]) diff --git a/src/univalue/build-aux/m4/ax_boost_thread.m4 b/src/univalue/build-aux/m4/ax_boost_thread.m4 deleted file mode 100755 index 9f0bd0b23..000000000 --- a/src/univalue/build-aux/m4/ax_boost_thread.m4 +++ /dev/null @@ -1,150 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_boost_thread.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BOOST_THREAD -# -# DESCRIPTION -# -# Test for Thread library from the Boost C++ libraries. The macro requires -# a preceding call to AX_BOOST_BASE. Further documentation is available at -# . -# -# This macro calls: -# -# AC_SUBST(BOOST_THREAD_LIB) -# -# And sets: -# -# HAVE_BOOST_THREAD -# -# LICENSE -# -# Copyright (c) 2009 Thomas Porschberg -# Copyright (c) 2009 Michael Tindal -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 27 - -AC_DEFUN([AX_BOOST_THREAD], -[ - AC_ARG_WITH([boost-thread], - AS_HELP_STRING([--with-boost-thread@<:@=special-lib@:>@], - [use the Thread library from boost - it is possible to specify a certain library for the linker - e.g. --with-boost-thread=boost_thread-gcc-mt ]), - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ax_boost_user_thread_lib="" - else - want_boost="yes" - ax_boost_user_thread_lib="$withval" - fi - ], - [want_boost="yes"] - ) - - if test "x$want_boost" = "xyes"; then - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_BUILD]) - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - export LDFLAGS - - AC_CACHE_CHECK(whether the Boost::Thread library is available, - ax_cv_boost_thread, - [AC_LANG_PUSH([C++]) - CXXFLAGS_SAVE=$CXXFLAGS - - if test "x$host_os" = "xsolaris" ; then - CXXFLAGS="-pthreads $CXXFLAGS" - elif test "x$host_os" = "xmingw32" ; then - CXXFLAGS="-mthreads $CXXFLAGS" - else - CXXFLAGS="-pthread $CXXFLAGS" - fi - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], - [[boost::thread_group thrds; - return 0;]])], - ax_cv_boost_thread=yes, ax_cv_boost_thread=no) - CXXFLAGS=$CXXFLAGS_SAVE - AC_LANG_POP([C++]) - ]) - if test "x$ax_cv_boost_thread" = "xyes"; then - if test "x$host_os" = "xsolaris" ; then - BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS" - elif test "x$host_os" = "xmingw32" ; then - BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS" - else - BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS" - fi - - AC_SUBST(BOOST_CPPFLAGS) - - AC_DEFINE(HAVE_BOOST_THREAD,,[define if the Boost::Thread library is available]) - BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` - - LDFLAGS_SAVE=$LDFLAGS - case "x$host_os" in - *bsd* ) - LDFLAGS="-pthread $LDFLAGS" - break; - ;; - esac - if test "x$ax_boost_user_thread_lib" = "x"; then - ax_lib= - for libextension in `ls -r $BOOSTLIBDIR/libboost_thread* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'`; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break], - [link_thread="no"]) - done - if test "x$link_thread" != "xyes"; then - for libextension in `ls -r $BOOSTLIBDIR/boost_thread* 2>/dev/null | sed 's,.*/,,' | sed 's,\..*,,'`; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break], - [link_thread="no"]) - done - fi - - else - for ax_lib in $ax_boost_user_thread_lib boost_thread-$ax_boost_user_thread_lib; do - AC_CHECK_LIB($ax_lib, exit, - [BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break], - [link_thread="no"]) - done - - fi - if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the boost_thread library!) - fi - if test "x$link_thread" = "xno"; then - AC_MSG_ERROR(Could not link against $ax_lib !) - else - case "x$host_os" in - *bsd* ) - BOOST_LDFLAGS="-pthread $BOOST_LDFLAGS" - break; - ;; - esac - - fi - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" - fi -]) diff --git a/src/univalue/build-aux/m4/ax_boost_unit_test_framework.m4 b/src/univalue/build-aux/m4/ax_boost_unit_test_framework.m4 deleted file mode 100755 index 4efd1e2f1..000000000 --- a/src/univalue/build-aux/m4/ax_boost_unit_test_framework.m4 +++ /dev/null @@ -1,138 +0,0 @@ -# ================================================================================ -# http://www.gnu.org/software/autoconf-archive/ax_boost_unit_test_framework.html -# ================================================================================ -# -# SYNOPSIS -# -# AX_BOOST_UNIT_TEST_FRAMEWORK -# -# DESCRIPTION -# -# Test for Unit_Test_Framework library from the Boost C++ libraries. The -# macro requires a preceding call to AX_BOOST_BASE. Further documentation -# is available at . -# -# This macro calls: -# -# AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB) -# -# And sets: -# -# HAVE_BOOST_UNIT_TEST_FRAMEWORK -# -# LICENSE -# -# Copyright (c) 2008 Thomas Porschberg -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 19 - -AC_DEFUN([AX_BOOST_UNIT_TEST_FRAMEWORK], -[ - AC_ARG_WITH([boost-unit-test-framework], - AS_HELP_STRING([--with-boost-unit-test-framework@<:@=special-lib@:>@], - [use the Unit_Test_Framework library from boost - it is possible to specify a certain library for the linker - e.g. --with-boost-unit-test-framework=boost_unit_test_framework-gcc ]), - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ax_boost_user_unit_test_framework_lib="" - else - want_boost="yes" - ax_boost_user_unit_test_framework_lib="$withval" - fi - ], - [want_boost="yes"] - ) - - if test "x$want_boost" = "xyes"; then - AC_REQUIRE([AC_PROG_CC]) - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - export LDFLAGS - - AC_CACHE_CHECK(whether the Boost::Unit_Test_Framework library is available, - ax_cv_boost_unit_test_framework, - [AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], - [[using boost::unit_test::test_suite; - test_suite* test= BOOST_TEST_SUITE( "Unit test example 1" ); return 0;]])], - ax_cv_boost_unit_test_framework=yes, ax_cv_boost_unit_test_framework=no) - AC_LANG_POP([C++]) - ]) - if test "x$ax_cv_boost_unit_test_framework" = "xyes"; then - AC_DEFINE(HAVE_BOOST_UNIT_TEST_FRAMEWORK,,[define if the Boost::Unit_Test_Framework library is available]) - BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` - - if test "x$ax_boost_user_unit_test_framework_lib" = "x"; then - saved_ldflags="${LDFLAGS}" - ax_lib= - for monitor_library in `ls $BOOSTLIBDIR/libboost_unit_test_framework*.so* $BOOSTLIBDIR/libboost_unit_test_framework*.dylib* $BOOSTLIBDIR/libboost_unit_test_framework*.a* 2>/dev/null` ; do - if test -r $monitor_library ; then - libextension=`echo $monitor_library | sed 's,.*/,,' | sed -e 's;^lib\(boost_unit_test_framework.*\)\.so.*$;\1;' -e 's;^lib\(boost_unit_test_framework.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_unit_test_framework.*\)\.a.*$;\1;'` - ax_lib=${libextension} - link_unit_test_framework="yes" - else - link_unit_test_framework="no" - fi - - if test "x$link_unit_test_framework" = "xyes"; then - BOOST_UNIT_TEST_FRAMEWORK_LIB="-l$ax_lib" - AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB) - break - fi - done - if test "x$link_unit_test_framework" != "xyes"; then - for libextension in `ls $BOOSTLIBDIR/boost_unit_test_framework*.dll* $BOOSTLIBDIR/boost_unit_test_framework*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_unit_test_framework.*\)\.dll.*$;\1;' -e 's;^\(boost_unit_test_framework.*\)\.a.*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_UNIT_TEST_FRAMEWORK_LIB="-l$ax_lib"; AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB) link_unit_test_framework="yes"; break], - [link_unit_test_framework="no"]) - done - fi - else - link_unit_test_framework="no" - saved_ldflags="${LDFLAGS}" - for ax_lib in boost_unit_test_framework-$ax_boost_user_unit_test_framework_lib $ax_boost_user_unit_test_framework_lib ; do - if test "x$link_unit_test_framework" = "xyes"; then - break; - fi - for unittest_library in `ls $BOOSTLIBDIR/lib${ax_lib}.so* $BOOSTLIBDIR/lib${ax_lib}.a* 2>/dev/null` ; do - if test -r $unittest_library ; then - libextension=`echo $unittest_library | sed 's,.*/,,' | sed -e 's;^lib\(boost_unit_test_framework.*\)\.so.*$;\1;' -e 's;^lib\(boost_unit_test_framework.*\)\.a*$;\1;'` - ax_lib=${libextension} - link_unit_test_framework="yes" - else - link_unit_test_framework="no" - fi - - if test "x$link_unit_test_framework" = "xyes"; then - BOOST_UNIT_TEST_FRAMEWORK_LIB="-l$ax_lib" - AC_SUBST(BOOST_UNIT_TEST_FRAMEWORK_LIB) - break - fi - done - done - fi - if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the boost_unit_test_framework library!) - fi - if test "x$link_unit_test_framework" != "xyes"; then - AC_MSG_ERROR(Could not link against $ax_lib !) - fi - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" - fi -]) diff --git a/src/univalue/build-aux/m4/ax_check_compile_flag.m4 b/src/univalue/build-aux/m4/ax_check_compile_flag.m4 deleted file mode 100755 index c3a8d695a..000000000 --- a/src/univalue/build-aux/m4/ax_check_compile_flag.m4 +++ /dev/null @@ -1,72 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) -# -# DESCRIPTION -# -# Check whether the given FLAG works with the current language's compiler -# or gives an error. (Warnings, however, are ignored) -# -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on -# success/failure. -# -# If EXTRA-FLAGS is defined, it is added to the current language's default -# flags (e.g. CFLAGS) when the check is done. The check is thus made with -# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to -# force the compiler to issue an error when a bad flag is given. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this -# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 2 - -AC_DEFUN([AX_CHECK_COMPILE_FLAG], -[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX -AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl -AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ - ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], - [AS_VAR_SET(CACHEVAR,[yes])], - [AS_VAR_SET(CACHEVAR,[no])]) - _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) -AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl AX_CHECK_COMPILE_FLAGS diff --git a/src/univalue/build-aux/m4/ax_check_link_flag.m4 b/src/univalue/build-aux/m4/ax_check_link_flag.m4 deleted file mode 100755 index e2d0d363e..000000000 --- a/src/univalue/build-aux/m4/ax_check_link_flag.m4 +++ /dev/null @@ -1,71 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) -# -# DESCRIPTION -# -# Check whether the given FLAG works with the linker or gives an error. -# (Warnings, however, are ignored) -# -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on -# success/failure. -# -# If EXTRA-FLAGS is defined, it is added to the linker's default flags -# when the check is done. The check is thus made with the flags: "LDFLAGS -# EXTRA-FLAGS FLAG". This can for example be used to force the linker to -# issue an error when a bad flag is given. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this -# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 2 - -AC_DEFUN([AX_CHECK_LINK_FLAG], -[AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl -AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ - ax_check_save_flags=$LDFLAGS - LDFLAGS="$LDFLAGS $4 $1" - AC_LINK_IFELSE([AC_LANG_PROGRAM()], - [AS_VAR_SET(CACHEVAR,[yes])], - [AS_VAR_SET(CACHEVAR,[no])]) - LDFLAGS=$ax_check_save_flags]) -AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl AX_CHECK_LINK_FLAGS diff --git a/src/univalue/build-aux/m4/ax_check_preproc_flag.m4 b/src/univalue/build-aux/m4/ax_check_preproc_flag.m4 deleted file mode 100755 index b1cfef6b8..000000000 --- a/src/univalue/build-aux/m4/ax_check_preproc_flag.m4 +++ /dev/null @@ -1,72 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_preproc_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_PREPROC_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) -# -# DESCRIPTION -# -# Check whether the given FLAG works with the current language's -# preprocessor or gives an error. (Warnings, however, are ignored) -# -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on -# success/failure. -# -# If EXTRA-FLAGS is defined, it is added to the preprocessor's default -# flags when the check is done. The check is thus made with the flags: -# "CPPFLAGS EXTRA-FLAGS FLAG". This can for example be used to force the -# preprocessor to issue an error when a bad flag is given. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this -# macro in sync with AX_CHECK_{COMPILE,LINK}_FLAG. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 2 - -AC_DEFUN([AX_CHECK_PREPROC_FLAG], -[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX -AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]cppflags_$4_$1])dnl -AC_CACHE_CHECK([whether _AC_LANG preprocessor accepts $1], CACHEVAR, [ - ax_check_save_flags=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $4 $1" - AC_PREPROC_IFELSE([AC_LANG_PROGRAM()], - [AS_VAR_SET(CACHEVAR,[yes])], - [AS_VAR_SET(CACHEVAR,[no])]) - CPPFLAGS=$ax_check_save_flags]) -AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl AX_CHECK_PREPROC_FLAGS diff --git a/src/univalue/build-aux/m4/ax_cxx_compile_stdcxx.m4 b/src/univalue/build-aux/m4/ax_cxx_compile_stdcxx.m4 deleted file mode 100755 index 2c18e49c5..000000000 --- a/src/univalue/build-aux/m4/ax_cxx_compile_stdcxx.m4 +++ /dev/null @@ -1,562 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the specified -# version of the C++ standard. If necessary, add switches to CXX and -# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) -# or '14' (for the C++14 standard). -# -# The second argument, if specified, indicates whether you insist on an -# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -# -std=c++11). If neither is specified, you get whatever works, with -# preference for an extended mode. -# -# The third argument, if specified 'mandatory' or if left unspecified, -# indicates that baseline support for the specified C++ standard is -# required and that the macro should error out if no mode with that -# support is found. If specified 'optional', then configuration proceeds -# regardless, after defining HAVE_CXX${VERSION} if and only if a -# supporting mode is found. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik -# Copyright (c) 2012 Zack Weinberg -# Copyright (c) 2013 Roy Stogner -# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov -# Copyright (c) 2015 Paul Norman -# Copyright (c) 2015 Moritz Klammler -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 4 - -dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro -dnl (serial version number 13). - -AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl - m4_if([$1], [11], [], - [$1], [14], [], - [$1], [17], [m4_fatal([support for C++17 not yet implemented in AX_CXX_COMPILE_STDCXX])], - [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$2], [], [], - [$2], [ext], [], - [$2], [noext], [], - [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], - [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], - [$3], [optional], [ax_cxx_compile_cxx$1_required=false], - [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) - AC_LANG_PUSH([C++])dnl - ac_success=no - AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, - ax_cv_cxx_compile_cxx$1, - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [ax_cv_cxx_compile_cxx$1=yes], - [ax_cv_cxx_compile_cxx$1=no])]) - if test x$ax_cv_cxx_compile_cxx$1 = xyes; then - ac_success=yes - fi - - m4_if([$2], [noext], [], [dnl - if test x$ac_success = xno; then - for switch in -std=gnu++$1 -std=gnu++0x; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - fi]) - - m4_if([$2], [ext], [], [dnl - if test x$ac_success = xno; then - dnl HP's aCC needs +std=c++11 according to: - dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf - dnl Cray's crayCC needs "-h std=c++11" - for switch in -std=c++$1 -std=c++0x +std=c++$1 "-h std=c++$1"; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - fi]) - AC_LANG_POP([C++]) - if test x$ax_cxx_compile_cxx$1_required = xtrue; then - if test x$ac_success = xno; then - AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) - fi - fi - if test x$ac_success = xno; then - HAVE_CXX$1=0 - AC_MSG_NOTICE([No compiler with C++$1 support was found]) - else - HAVE_CXX$1=1 - AC_DEFINE(HAVE_CXX$1,1, - [define if the compiler supports basic C++$1 syntax]) - fi - AC_SUBST(HAVE_CXX$1) -]) - - -dnl Test body for checking C++11 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 -) - - -dnl Test body for checking C++14 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 -) - - -dnl Tests for new features in C++11 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ - -// If the compiler admits that it is not ready for C++11, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201103L - -#error "This is not a C++11 compiler" - -#else - -namespace cxx11 -{ - - namespace test_static_assert - { - - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - } - - namespace test_final_override - { - - struct Base - { - virtual void f() {} - }; - - struct Derived : public Base - { - virtual void f() override {} - }; - - } - - namespace test_double_right_angle_brackets - { - - template < typename T > - struct check {}; - - typedef check single_type; - typedef check> double_type; - typedef check>> triple_type; - typedef check>>> quadruple_type; - - } - - namespace test_decltype - { - - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } - - } - - namespace test_type_deduction - { - - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - - template < typename T > - struct is_same - { - static const bool value = true; - }; - - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } - - int - test(const int c, volatile int v) - { - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } - - } - - namespace test_noexcept - { - - int f() { return 0; } - int g() noexcept { return 0; } - - static_assert(noexcept(f()) == false, ""); - static_assert(noexcept(g()) == true, ""); - - } - - namespace test_constexpr - { - - template < typename CharT > - unsigned long constexpr - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept - { - return *s ? strlen_c_r(s + 1, acc + 1) : acc; - } - - template < typename CharT > - unsigned long constexpr - strlen_c(const CharT *const s) noexcept - { - return strlen_c_r(s, 0UL); - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("1") == 1UL, ""); - static_assert(strlen_c("example") == 7UL, ""); - static_assert(strlen_c("another\0example") == 7UL, ""); - - } - - namespace test_rvalue_references - { - - template < int N > - struct answer - { - static constexpr int value = N; - }; - - answer<1> f(int&) { return answer<1>(); } - answer<2> f(const int&) { return answer<2>(); } - answer<3> f(int&&) { return answer<3>(); } - - void - test() - { - int i = 0; - const int c = 0; - static_assert(decltype(f(i))::value == 1, ""); - static_assert(decltype(f(c))::value == 2, ""); - static_assert(decltype(f(0))::value == 3, ""); - } - - } - - namespace test_uniform_initialization - { - - struct test - { - static const int zero {}; - static const int one {1}; - }; - - static_assert(test::zero == 0, ""); - static_assert(test::one == 1, ""); - - } - - namespace test_lambdas - { - - void - test1() - { - auto lambda1 = [](){}; - auto lambda2 = lambda1; - lambda1(); - lambda2(); - } - - int - test2() - { - auto a = [](int i, int j){ return i + j; }(1, 2); - auto b = []() -> int { return '0'; }(); - auto c = [=](){ return a + b; }(); - auto d = [&](){ return c; }(); - auto e = [a, &b](int x) mutable { - const auto identity = [](int y){ return y; }; - for (auto i = 0; i < a; ++i) - a += b--; - return x + identity(a + b); - }(0); - return a + b + c + d + e; - } - - int - test3() - { - const auto nullary = [](){ return 0; }; - const auto unary = [](int x){ return x; }; - using nullary_t = decltype(nullary); - using unary_t = decltype(unary); - const auto higher1st = [](nullary_t f){ return f(); }; - const auto higher2nd = [unary](nullary_t f1){ - return [unary, f1](unary_t f2){ return f2(unary(f1())); }; - }; - return higher1st(nullary) + higher2nd(nullary)(unary); - } - - } - - namespace test_variadic_templates - { - - template - struct sum; - - template - struct sum - { - static constexpr auto value = N0 + sum::value; - }; - - template <> - struct sum<> - { - static constexpr auto value = 0; - }; - - static_assert(sum<>::value == 0, ""); - static_assert(sum<1>::value == 1, ""); - static_assert(sum<23>::value == 23, ""); - static_assert(sum<1, 2>::value == 3, ""); - static_assert(sum<5, 5, 11>::value == 21, ""); - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - - } - - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function - // because of this. - namespace test_template_alias_sfinae - { - - struct foo {}; - - template - using member = typename T::member_type; - - template - void func(...) {} - - template - void func(member*) {} - - void test(); - - void test() { func(0); } - - } - -} // namespace cxx11 - -#endif // __cplusplus >= 201103L - -]]) - - -dnl Tests for new features in C++14 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ - -// If the compiler admits that it is not ready for C++14, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201402L - -#error "This is not a C++14 compiler" - -#else - -namespace cxx14 -{ - - namespace test_polymorphic_lambdas - { - - int - test() - { - const auto lambda = [](auto&&... args){ - const auto istiny = [](auto x){ - return (sizeof(x) == 1UL) ? 1 : 0; - }; - const int aretiny[] = { istiny(args)... }; - return aretiny[0]; - }; - return lambda(1, 1L, 1.0f, '1'); - } - - } - - namespace test_binary_literals - { - - constexpr auto ivii = 0b0000000000101010; - static_assert(ivii == 42, "wrong value"); - - } - - namespace test_generalized_constexpr - { - - template < typename CharT > - constexpr unsigned long - strlen_c(const CharT *const s) noexcept - { - auto length = 0UL; - for (auto p = s; *p; ++p) - ++length; - return length; - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("x") == 1UL, ""); - static_assert(strlen_c("test") == 4UL, ""); - static_assert(strlen_c("another\0test") == 7UL, ""); - - } - - namespace test_lambda_init_capture - { - - int - test() - { - auto x = 0; - const auto lambda1 = [a = x](int b){ return a + b; }; - const auto lambda2 = [a = lambda1(x)](){ return a; }; - return lambda2(); - } - - } - - namespace test_digit_seperators - { - - constexpr auto ten_million = 100'000'000; - static_assert(ten_million == 100000000, ""); - - } - - namespace test_return_type_deduction - { - - auto f(int& x) { return x; } - decltype(auto) g(int& x) { return x; } - - template < typename T1, typename T2 > - struct is_same - { - static constexpr auto value = false; - }; - - template < typename T > - struct is_same - { - static constexpr auto value = true; - }; - - int - test() - { - auto x = 0; - static_assert(is_same::value, ""); - static_assert(is_same::value, ""); - return x; - } - - } - -} // namespace cxx14 - -#endif // __cplusplus >= 201402L - -]]) diff --git a/src/univalue/build-aux/m4/ax_gcc_func_attribute.m4 b/src/univalue/build-aux/m4/ax_gcc_func_attribute.m4 deleted file mode 100755 index 275ca63a2..000000000 --- a/src/univalue/build-aux/m4/ax_gcc_func_attribute.m4 +++ /dev/null @@ -1,217 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE) -# -# DESCRIPTION -# -# This macro checks if the compiler supports one of GCC's function -# attributes; many other compilers also provide function attributes with -# the same syntax. Compiler warnings are used to detect supported -# attributes as unsupported ones are ignored by default so quieting -# warnings when using this macro will yield false positives. -# -# The ATTRIBUTE parameter holds the name of the attribute to be checked. -# -# If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_. -# -# The macro caches its result in the ax_cv_have_func_attribute_ -# variable. -# -# The macro currently supports the following function attributes: -# -# alias -# aligned -# alloc_size -# always_inline -# artificial -# cold -# const -# constructor -# deprecated -# destructor -# dllexport -# dllimport -# error -# externally_visible -# flatten -# format -# format_arg -# gnu_inline -# hot -# ifunc -# leaf -# malloc -# noclone -# noinline -# nonnull -# noreturn -# nothrow -# optimize -# pure -# unused -# used -# visibility -# warning -# warn_unused_result -# weak -# weakref -# -# Unsuppored function attributes will be tested with a prototype returning -# an int and not accepting any arguments and the result of the check might -# be wrong or meaningless so use with care. -# -# LICENSE -# -# Copyright (c) 2013 Gabriele Svelto -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 2 - -AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [ - AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1]) - - AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [ - AC_LINK_IFELSE([AC_LANG_PROGRAM([ - m4_case([$1], - [alias], [ - int foo( void ) { return 0; } - int bar( void ) __attribute__(($1("foo"))); - ], - [aligned], [ - int foo( void ) __attribute__(($1(32))); - ], - [alloc_size], [ - void *foo(int a) __attribute__(($1(1))); - ], - [always_inline], [ - inline __attribute__(($1)) int foo( void ) { return 0; } - ], - [artificial], [ - inline __attribute__(($1)) int foo( void ) { return 0; } - ], - [cold], [ - int foo( void ) __attribute__(($1)); - ], - [const], [ - int foo( void ) __attribute__(($1)); - ], - [constructor], [ - int foo( void ) __attribute__(($1)); - ], - [deprecated], [ - int foo( void ) __attribute__(($1(""))); - ], - [destructor], [ - int foo( void ) __attribute__(($1)); - ], - [dllexport], [ - __attribute__(($1)) int foo( void ) { return 0; } - ], - [dllimport], [ - int foo( void ) __attribute__(($1)); - ], - [error], [ - int foo( void ) __attribute__(($1(""))); - ], - [externally_visible], [ - int foo( void ) __attribute__(($1)); - ], - [flatten], [ - int foo( void ) __attribute__(($1)); - ], - [format], [ - int foo(const char *p, ...) __attribute__(($1(printf, 1, 2))); - ], - [format_arg], [ - char *foo(const char *p) __attribute__(($1(1))); - ], - [gnu_inline], [ - inline __attribute__(($1)) int foo( void ) { return 0; } - ], - [hot], [ - int foo( void ) __attribute__(($1)); - ], - [ifunc], [ - int my_foo( void ) { return 0; } - static int (*resolve_foo(void))(void) { return my_foo; } - int foo( void ) __attribute__(($1("resolve_foo"))); - ], - [leaf], [ - __attribute__(($1)) int foo( void ) { return 0; } - ], - [malloc], [ - void *foo( void ) __attribute__(($1)); - ], - [noclone], [ - int foo( void ) __attribute__(($1)); - ], - [noinline], [ - __attribute__(($1)) int foo( void ) { return 0; } - ], - [nonnull], [ - int foo(char *p) __attribute__(($1(1))); - ], - [noreturn], [ - void foo( void ) __attribute__(($1)); - ], - [nothrow], [ - int foo( void ) __attribute__(($1)); - ], - [optimize], [ - __attribute__(($1(3))) int foo( void ) { return 0; } - ], - [pure], [ - int foo( void ) __attribute__(($1)); - ], - [unused], [ - int foo( void ) __attribute__(($1)); - ], - [used], [ - int foo( void ) __attribute__(($1)); - ], - [visibility], [ - int foo_def( void ) __attribute__(($1("default"))); - int foo_hid( void ) __attribute__(($1("hidden"))); - ], - [warning], [ - int foo( void ) __attribute__(($1(""))); - ], - [warn_unused_result], [ - int foo( void ) __attribute__(($1)); - ], - [weak], [ - int foo( void ) __attribute__(($1)); - ], - [weakref], [ - static int foo( void ) { return 0; } - static int bar( void ) __attribute__(($1("foo"))); - ], - [ - m4_warn([syntax], [Unsupported attribute $1, the test may fail]) - int foo( void ) __attribute__(($1)); - ] - )], []) - ], - dnl GCC doesn't exit with an error if an unknown attribute is - dnl provided but only outputs a warning, so accept the attribute - dnl only if no warning were issued. - [AS_IF([test -s conftest.err], - [AS_VAR_SET([ac_var], [no])], - [AS_VAR_SET([ac_var], [yes])])], - [AS_VAR_SET([ac_var], [no])]) - ]) - - AS_IF([test yes = AS_VAR_GET([ac_var])], - [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1, - [Define to 1 if the system has the `$1' function attribute])], []) - - AS_VAR_POPDEF([ac_var]) -]) diff --git a/src/univalue/build-aux/m4/ax_pthread.m4 b/src/univalue/build-aux/m4/ax_pthread.m4 deleted file mode 100755 index d383ad5c6..000000000 --- a/src/univalue/build-aux/m4/ax_pthread.m4 +++ /dev/null @@ -1,332 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_pthread.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro figures out how to build C programs using POSIX threads. It -# sets the PTHREAD_LIBS output variable to the threads library and linker -# flags, and the PTHREAD_CFLAGS output variable to any special C compiler -# flags that are needed. (The user can also force certain compiler -# flags/libs to be tested by setting these environment variables.) -# -# Also sets PTHREAD_CC to any special C compiler that is needed for -# multi-threaded programs (defaults to the value of CC otherwise). (This -# is necessary on AIX to use the special cc_r compiler alias.) -# -# NOTE: You are assumed to not only compile your program with these flags, -# but also link it with them as well. e.g. you should link with -# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS -# -# If you are only building threads programs, you may wish to use these -# variables in your default LIBS, CFLAGS, and CC: -# -# LIBS="$PTHREAD_LIBS $LIBS" -# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -# CC="$PTHREAD_CC" -# -# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant -# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name -# (e.g. PTHREAD_CREATE_UNDETACHED on AIX). -# -# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the -# PTHREAD_PRIO_INHERIT symbol is defined when compiling with -# PTHREAD_CFLAGS. -# -# ACTION-IF-FOUND is a list of shell commands to run if a threads library -# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it -# is not found. If ACTION-IF-FOUND is not specified, the default action -# will define HAVE_PTHREAD. -# -# Please let the authors know if this macro fails on any platform, or if -# you have any other suggestions or comments. This macro was based on work -# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help -# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by -# Alejandro Forero Cuervo to the autoconf macro repository. We are also -# grateful for the helpful feedback of numerous users. -# -# Updated for Autoconf 2.68 by Daniel Richard G. -# -# LICENSE -# -# Copyright (c) 2008 Steven G. Johnson -# Copyright (c) 2011 Daniel Richard G. -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 21 - -AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) -AC_DEFUN([AX_PTHREAD], [ -AC_REQUIRE([AC_CANONICAL_HOST]) -AC_LANG_PUSH([C]) -ax_pthread_ok=no - -# We used to check for pthread.h first, but this fails if pthread.h -# requires special compiler flags (e.g. on True64 or Sequent). -# It gets checked for in the link test anyway. - -# First of all, check if the user has set any of the PTHREAD_LIBS, -# etcetera environment variables, and if threads linking works using -# them: -if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) - AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes]) - AC_MSG_RESULT([$ax_pthread_ok]) - if test x"$ax_pthread_ok" = xno; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" -fi - -# We must check for the threads library under a number of different -# names; the ordering is very important because some systems -# (e.g. DEC) have both -lpthread and -lpthreads, where one of the -# libraries is broken (non-POSIX). - -# Create a list of thread flags to try. Items starting with a "-" are -# C compiler flags, and other items are library names, except for "none" -# which indicates that we try without any flags at all, and "pthread-config" -# which is a program returning the flags for the Pth emulation library. - -ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" - -# The ordering *is* (sometimes) important. Some notes on the -# individual items follow: - -# pthreads: AIX (must check this before -lpthread) -# none: in case threads are in libc; should be tried before -Kthread and -# other compiler flags to prevent continual compiler warnings -# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) -# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) -# -pthreads: Solaris/gcc -# -mthreads: Mingw32/gcc, Lynx/gcc -# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads too; -# also defines -D_REENTRANT) -# ... -mt is also the pthreads flag for HP/aCC -# pthread: Linux, etcetera -# --thread-safe: KAI C++ -# pthread-config: use pthread-config program (for GNU Pth library) - -case ${host_os} in - solaris*) - - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (We need to link with -pthreads/-mt/ - # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather - # a function called by this macro, so we could check for that, but - # who knows whether they'll stub that too in a future libc.) So, - # we'll just look for -pthreads and -lpthread first: - - ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" - ;; - - darwin*) - ax_pthread_flags="-pthread $ax_pthread_flags" - ;; -esac - -# Clang doesn't consider unrecognized options an error unless we specify -# -Werror. We throw in some extra Clang-specific options to ensure that -# this doesn't happen for GCC, which also accepts -Werror. - -AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags]) -save_CFLAGS="$CFLAGS" -ax_pthread_extra_flags="-Werror" -CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument" -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])], - [AC_MSG_RESULT([yes])], - [ax_pthread_extra_flags= - AC_MSG_RESULT([no])]) -CFLAGS="$save_CFLAGS" - -if test x"$ax_pthread_ok" = xno; then -for flag in $ax_pthread_flags; do - - case $flag in - none) - AC_MSG_CHECKING([whether pthreads work without any flags]) - ;; - - -*) - AC_MSG_CHECKING([whether pthreads work with $flag]) - PTHREAD_CFLAGS="$flag" - ;; - - pthread-config) - AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) - if test x"$ax_pthread_config" = xno; then continue; fi - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; - - *) - AC_MSG_CHECKING([for the pthreads library -l$flag]) - PTHREAD_LIBS="-l$flag" - ;; - esac - - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include - static void routine(void *a) { a = 0; } - static void *start_routine(void *a) { return a; }], - [pthread_t th; pthread_attr_t attr; - pthread_create(&th, 0, start_routine, 0); - pthread_join(th, 0); - pthread_attr_init(&attr); - pthread_cleanup_push(routine, 0); - pthread_cleanup_pop(0) /* ; */])], - [ax_pthread_ok=yes], - []) - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - - AC_MSG_RESULT([$ax_pthread_ok]) - if test "x$ax_pthread_ok" = xyes; then - break; - fi - - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" -done -fi - -# Various other checks: -if test "x$ax_pthread_ok" = xyes; then - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - - # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - AC_MSG_CHECKING([for joinable pthread attribute]) - attr_name=unknown - for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], - [int attr = $attr; return attr /* ; */])], - [attr_name=$attr; break], - []) - done - AC_MSG_RESULT([$attr_name]) - if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then - AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name], - [Define to necessary symbol if this constant - uses a non-standard name on your system.]) - fi - - AC_MSG_CHECKING([if more special flags are required for pthreads]) - flag=no - case ${host_os} in - aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; - osf* | hpux*) flag="-D_REENTRANT";; - solaris*) - if test "$GCC" = "yes"; then - flag="-D_REENTRANT" - else - # TODO: What about Clang on Solaris? - flag="-mt -D_REENTRANT" - fi - ;; - esac - AC_MSG_RESULT([$flag]) - if test "x$flag" != xno; then - PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" - fi - - AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], - [ax_cv_PTHREAD_PRIO_INHERIT], [ - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[int i = PTHREAD_PRIO_INHERIT;]])], - [ax_cv_PTHREAD_PRIO_INHERIT=yes], - [ax_cv_PTHREAD_PRIO_INHERIT=no]) - ]) - AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], - [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])]) - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - - # More AIX lossage: compile with *_r variant - if test "x$GCC" != xyes; then - case $host_os in - aix*) - AS_CASE(["x/$CC"], - [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], - [#handle absolute path differently from PATH based program lookup - AS_CASE(["x$CC"], - [x/*], - [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], - [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) - ;; - esac - fi -fi - -test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" - -AC_SUBST([PTHREAD_LIBS]) -AC_SUBST([PTHREAD_CFLAGS]) -AC_SUBST([PTHREAD_CC]) - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$ax_pthread_ok" = xyes; then - ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) - : -else - ax_pthread_ok=no - $2 -fi -AC_LANG_POP -])dnl AX_PTHREAD diff --git a/src/univalue/build-aux/m4/bitcoin_find_bdb48.m4 b/src/univalue/build-aux/m4/bitcoin_find_bdb48.m4 deleted file mode 100755 index f3b14461e..000000000 --- a/src/univalue/build-aux/m4/bitcoin_find_bdb48.m4 +++ /dev/null @@ -1,66 +0,0 @@ -AC_DEFUN([BITCOIN_FIND_BDB48],[ - AC_MSG_CHECKING([for Berkeley DB C++ headers]) - BDB_CPPFLAGS= - BDB_LIBS= - bdbpath=X - bdb48path=X - bdbdirlist= - for _vn in 4.8 48 4 5 ''; do - for _pfx in b lib ''; do - bdbdirlist="$bdbdirlist ${_pfx}db${_vn}" - done - done - for searchpath in $bdbdirlist ''; do - test -n "${searchpath}" && searchpath="${searchpath}/" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include <${searchpath}db_cxx.h> - ]],[[ - #if !((DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 8) || DB_VERSION_MAJOR > 4) - #error "failed to find bdb 4.8+" - #endif - ]])],[ - if test "x$bdbpath" = "xX"; then - bdbpath="${searchpath}" - fi - ],[ - continue - ]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include <${searchpath}db_cxx.h> - ]],[[ - #if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8) - #error "failed to find bdb 4.8" - #endif - ]])],[ - bdb48path="${searchpath}" - break - ],[]) - done - if test "x$bdbpath" = "xX"; then - AC_MSG_RESULT([no]) - AC_MSG_ERROR(libdb_cxx headers missing) - elif test "x$bdb48path" = "xX"; then - BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx) - AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 4.8])],[ - AC_MSG_WARN([Found Berkeley DB other than 4.8; wallets opened by this build will not be portable!]) - ],[ - AC_MSG_ERROR([Found Berkeley DB other than 4.8, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)]) - ]) - else - BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx) - bdbpath="${bdb48path}" - fi - AC_SUBST(BDB_CPPFLAGS) - - # TODO: Ideally this could find the library version and make sure it matches the headers being used - for searchlib in db_cxx-4.8 db_cxx; do - AC_CHECK_LIB([$searchlib],[main],[ - BDB_LIBS="-l${searchlib}" - break - ]) - done - if test "x$BDB_LIBS" = "x"; then - AC_MSG_ERROR([libdb_cxx missing, Bitcoin Core requires this library for wallet functionality (--disable-wallet to disable wallet functionality)]) - fi - AC_SUBST(BDB_LIBS) -]) diff --git a/src/univalue/build-aux/m4/bitcoin_qt.m4 b/src/univalue/build-aux/m4/bitcoin_qt.m4 deleted file mode 100755 index debb20207..000000000 --- a/src/univalue/build-aux/m4/bitcoin_qt.m4 +++ /dev/null @@ -1,512 +0,0 @@ -dnl Copyright (c) 2013-2016 The Bitcoin Core developers -dnl Distributed under the MIT software license, see the accompanying -dnl file COPYING or http://www.opensource.org/licenses/mit-license.php. - -dnl Helper for cases where a qt dependency is not met. -dnl Output: If qt version is auto, set bitcoin_enable_qt to false. Else, exit. -AC_DEFUN([BITCOIN_QT_FAIL],[ - if test "x$bitcoin_qt_want_version" = "xauto" && test x$bitcoin_qt_force != xyes; then - if test x$bitcoin_enable_qt != xno; then - AC_MSG_WARN([$1; vitae-qt frontend will not be built]) - fi - bitcoin_enable_qt=no - bitcoin_enable_qt_test=no - else - AC_MSG_ERROR([$1]) - fi -]) - -AC_DEFUN([BITCOIN_QT_CHECK],[ - if test "x$bitcoin_enable_qt" != "xno" && test x$bitcoin_qt_want_version != xno; then - true - $1 - else - true - $2 - fi -]) - -dnl BITCOIN_QT_PATH_PROGS([FOO], [foo foo2], [/path/to/search/first], [continue if missing]) -dnl Helper for finding the path of programs needed for Qt. -dnl Inputs: $1: Variable to be set -dnl Inputs: $2: List of programs to search for -dnl Inputs: $3: Look for $2 here before $PATH -dnl Inputs: $4: If "yes", don't fail if $2 is not found. -dnl Output: $1 is set to the path of $2 if found. $2 are searched in order. -AC_DEFUN([BITCOIN_QT_PATH_PROGS],[ - BITCOIN_QT_CHECK([ - if test "x$3" != "x"; then - AC_PATH_PROGS($1,$2,,$3) - else - AC_PATH_PROGS($1,$2) - fi - if test "x$$1" = "x" && test "x$4" != "xyes"; then - BITCOIN_QT_FAIL([$1 not found]) - fi - ]) -]) - -dnl Initialize qt input. -dnl This must be called before any other BITCOIN_QT* macros to ensure that -dnl input variables are set correctly. -dnl CAUTION: Do not use this inside of a conditional. -AC_DEFUN([BITCOIN_QT_INIT],[ - dnl enable qt support - AC_ARG_WITH([gui], - [AS_HELP_STRING([--with-gui@<:@=no|qt4|qt5|auto@:>@], - [build vitae-qt GUI (default=auto, qt5 tried first)])], - [ - bitcoin_qt_want_version=$withval - if test x$bitcoin_qt_want_version = xyes; then - bitcoin_qt_force=yes - bitcoin_qt_want_version=auto - fi - ], - [bitcoin_qt_want_version=auto]) - - AC_ARG_WITH([qt-incdir],[AS_HELP_STRING([--with-qt-incdir=INC_DIR],[specify qt include path (overridden by pkgconfig)])], [qt_include_path=$withval], []) - AC_ARG_WITH([qt-libdir],[AS_HELP_STRING([--with-qt-libdir=LIB_DIR],[specify qt lib path (overridden by pkgconfig)])], [qt_lib_path=$withval], []) - AC_ARG_WITH([qt-plugindir],[AS_HELP_STRING([--with-qt-plugindir=PLUGIN_DIR],[specify qt plugin path (overridden by pkgconfig)])], [qt_plugin_path=$withval], []) - AC_ARG_WITH([qt-translationdir],[AS_HELP_STRING([--with-qt-translationdir=PLUGIN_DIR],[specify qt translation path (overridden by pkgconfig)])], [qt_translation_path=$withval], []) - AC_ARG_WITH([qt-bindir],[AS_HELP_STRING([--with-qt-bindir=BIN_DIR],[specify qt bin path])], [qt_bin_path=$withval], []) - - AC_ARG_WITH([qtdbus], - [AS_HELP_STRING([--with-qtdbus], - [enable DBus support (default is yes if qt is enabled and QtDBus is found)])], - [use_dbus=$withval], - [use_dbus=auto]) - - AC_SUBST(QT_TRANSLATION_DIR,$qt_translation_path) -]) - -dnl Find the appropriate version of Qt libraries and includes. -dnl Inputs: $1: Whether or not pkg-config should be used. yes|no. Default: yes. -dnl Inputs: $2: If $1 is "yes" and --with-gui=auto, which qt version should be -dnl tried first. -dnl Outputs: See _BITCOIN_QT_FIND_LIBS_* -dnl Outputs: Sets variables for all qt-related tools. -dnl Outputs: bitcoin_enable_qt, bitcoin_enable_qt_dbus, bitcoin_enable_qt_test -AC_DEFUN([BITCOIN_QT_CONFIGURE],[ - use_pkgconfig=$1 - - if test x$use_pkgconfig = x; then - use_pkgconfig=yes - fi - - if test x$use_pkgconfig = xyes; then - BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG([$2])]) - else - BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG]) - fi - - dnl This is ugly and complicated. Yuck. Works as follows: - dnl We can't discern whether Qt4 builds are static or not. For Qt5, we can - dnl check a header to find out. When Qt is built statically, some plugins must - dnl be linked into the final binary as well. These plugins have changed between - dnl Qt4 and Qt5. With Qt5, languages moved into core and the WindowsIntegration - dnl plugin was added. Since we can't tell if Qt4 is static or not, it is - dnl assumed for windows builds. - dnl _BITCOIN_QT_CHECK_STATIC_PLUGINS does a quick link-check and appends the - dnl results to QT_LIBS. - BITCOIN_QT_CHECK([ - TEMP_CPPFLAGS=$CPPFLAGS - TEMP_CXXFLAGS=$CXXFLAGS - CPPFLAGS="$QT_INCLUDES $CPPFLAGS" - CXXFLAGS="$PIC_FLAGS $CXXFLAGS" - if test x$bitcoin_qt_got_major_vers = x5; then - TEMP_CPPFLAGS="$TEMP_CPPFLAGS -DHAVE_QT5" - _BITCOIN_QT_IS_STATIC - if test x$bitcoin_cv_static_qt = xyes; then - _BITCOIN_QT_FIND_STATIC_PLUGINS - AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static]) - AC_CACHE_CHECK(for Qt < 5.4, bitcoin_cv_need_acc_widget,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[#include ]],[[ - #if QT_VERSION >= 0x050400 - choke; - #endif - ]])], - [bitcoin_cv_need_acc_widget=yes], - [bitcoin_cv_need_acc_widget=no]) - ]) - if test "x$bitcoin_cv_need_acc_widget" = "xyes"; then - _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(AccessibleFactory)], [-lqtaccessiblewidgets]) - fi - if test x$TARGET_OS = xwindows; then - _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)],[-lqwindows]) - AC_DEFINE(QT_QPA_PLATFORM_WINDOWS, 1, [Define this symbol if the qt platform is windows]) - elif test x$TARGET_OS = xlinux; then - _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)],[-lqxcb -lxcb-static]) - AC_DEFINE(QT_QPA_PLATFORM_XCB, 1, [Define this symbol if the qt platform is xcb]) - elif test x$TARGET_OS = xdarwin; then - AX_CHECK_LINK_FLAG([[-framework IOKit]],[QT_LIBS="$QT_LIBS -framework IOKit"],[AC_MSG_ERROR(could not iokit framework)]) - _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)],[-lqcocoa]) - AC_DEFINE(QT_QPA_PLATFORM_COCOA, 1, [Define this symbol if the qt platform is cocoa]) - fi - fi - else - if test x$TARGET_OS = xwindows; then - AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static]) - _BITCOIN_QT_CHECK_STATIC_PLUGINS([ - Q_IMPORT_PLUGIN(qcncodecs) - Q_IMPORT_PLUGIN(qjpcodecs) - Q_IMPORT_PLUGIN(qtwcodecs) - Q_IMPORT_PLUGIN(qkrcodecs) - Q_IMPORT_PLUGIN(AccessibleFactory)], - [-lqcncodecs -lqjpcodecs -lqtwcodecs -lqkrcodecs -lqtaccessiblewidgets]) - fi - fi - CPPFLAGS=$TEMP_CPPFLAGS - CXXFLAGS=$TEMP_CXXFLAGS - ]) - - if test x$use_pkgconfig$qt_bin_path = xyes; then - if test x$bitcoin_qt_got_major_vers = x5; then - qt_bin_path="`$PKG_CONFIG --variable=host_bins Qt5Core 2>/dev/null`" - fi - fi - - if test x$use_hardening != xno; then - BITCOIN_QT_CHECK([ - AC_MSG_CHECKING(whether -fPIE can be used with this Qt config) - TEMP_CPPFLAGS=$CPPFLAGS - TEMP_CXXFLAGS=$CXXFLAGS - CPPFLAGS="$QT_INCLUDES $CPPFLAGS" - CXXFLAGS="$PIE_FLAGS $CXXFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[ - #if defined(QT_REDUCE_RELOCATIONS) - choke; - #endif - ]])], - [ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIE_FLAGS ], - [ AC_MSG_RESULT(no); QT_PIE_FLAGS=$PIC_FLAGS] - ) - CPPFLAGS=$TEMP_CPPFLAGS - CXXFLAGS=$TEMP_CXXFLAGS - ]) - else - BITCOIN_QT_CHECK([ - AC_MSG_CHECKING(whether -fPIC is needed with this Qt config) - TEMP_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$QT_INCLUDES $CPPFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[ - #if defined(QT_REDUCE_RELOCATIONS) - choke; - #endif - ]])], - [ AC_MSG_RESULT(no)], - [ AC_MSG_RESULT(yes); QT_PIE_FLAGS=$PIC_FLAGS] - ) - CPPFLAGS=$TEMP_CPPFLAGS - ]) - fi - - BITCOIN_QT_PATH_PROGS([MOC], [moc-qt${bitcoin_qt_got_major_vers} moc${bitcoin_qt_got_major_vers} moc], $qt_bin_path) - BITCOIN_QT_PATH_PROGS([UIC], [uic-qt${bitcoin_qt_got_major_vers} uic${bitcoin_qt_got_major_vers} uic], $qt_bin_path) - BITCOIN_QT_PATH_PROGS([RCC], [rcc-qt${bitcoin_qt_got_major_vers} rcc${bitcoin_qt_got_major_vers} rcc], $qt_bin_path) - BITCOIN_QT_PATH_PROGS([LRELEASE], [lrelease-qt${bitcoin_qt_got_major_vers} lrelease${bitcoin_qt_got_major_vers} lrelease], $qt_bin_path) - BITCOIN_QT_PATH_PROGS([LUPDATE], [lupdate-qt${bitcoin_qt_got_major_vers} lupdate${bitcoin_qt_got_major_vers} lupdate],$qt_bin_path, yes) - - MOC_DEFS='-DHAVE_CONFIG_H -I$(srcdir)' - case $host in - *darwin*) - BITCOIN_QT_CHECK([ - MOC_DEFS="${MOC_DEFS} -DQ_OS_MAC" - base_frameworks="-framework Foundation -framework ApplicationServices -framework AppKit" - AX_CHECK_LINK_FLAG([[$base_frameworks]],[QT_LIBS="$QT_LIBS $base_frameworks"],[AC_MSG_ERROR(could not find base frameworks)]) - ]) - ;; - *mingw*) - BITCOIN_QT_CHECK([ - AX_CHECK_LINK_FLAG([[-mwindows]],[QT_LDFLAGS="$QT_LDFLAGS -mwindows"],[AC_MSG_WARN(-mwindows linker support not detected)]) - ]) - esac - - - dnl enable qt support - AC_MSG_CHECKING(whether to build ]AC_PACKAGE_NAME[ GUI) - BITCOIN_QT_CHECK([ - bitcoin_enable_qt=yes - bitcoin_enable_qt_test=yes - if test x$have_qt_test = xno; then - bitcoin_enable_qt_test=no - fi - bitcoin_enable_qt_dbus=no - if test x$use_dbus != xno && test x$have_qt_dbus = xyes; then - bitcoin_enable_qt_dbus=yes - fi - if test x$use_dbus = xyes && test x$have_qt_dbus = xno; then - AC_MSG_ERROR("libQtDBus not found. Install libQtDBus or remove --with-qtdbus.") - fi - if test x$LUPDATE = x; then - AC_MSG_WARN("lupdate is required to update qt translations") - fi - ],[ - bitcoin_enable_qt=no - ]) - AC_MSG_RESULT([$bitcoin_enable_qt (Qt${bitcoin_qt_got_major_vers})]) - - AC_SUBST(QT_PIE_FLAGS) - AC_SUBST(QT_INCLUDES) - AC_SUBST(QT_LIBS) - AC_SUBST(QT_LDFLAGS) - AC_SUBST(QT_DBUS_INCLUDES) - AC_SUBST(QT_DBUS_LIBS) - AC_SUBST(QT_TEST_INCLUDES) - AC_SUBST(QT_TEST_LIBS) - AC_SUBST(QT_SELECT, qt${bitcoin_qt_got_major_vers}) - AC_SUBST(MOC_DEFS) -]) - -dnl All macros below are internal and should _not_ be used from the main -dnl configure.ac. -dnl ---- - -dnl Internal. Check if the included version of Qt is Qt5. -dnl Requires: INCLUDES must be populated as necessary. -dnl Output: bitcoin_cv_qt5=yes|no -AC_DEFUN([_BITCOIN_QT_CHECK_QT5],[ - AC_CACHE_CHECK(for Qt 5, bitcoin_cv_qt5,[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[#include ]], - [[ - #if QT_VERSION < 0x050000 - choke me - #else - return 0; - #endif - ]])], - [bitcoin_cv_qt5=yes], - [bitcoin_cv_qt5=no]) -])]) - -dnl Internal. Check if the linked version of Qt was built as static libs. -dnl Requires: Qt5. This check cannot determine if Qt4 is static. -dnl Requires: INCLUDES and LIBS must be populated as necessary. -dnl Output: bitcoin_cv_static_qt=yes|no -dnl Output: Defines QT_STATICPLUGIN if plugins are static. -AC_DEFUN([_BITCOIN_QT_IS_STATIC],[ - AC_CACHE_CHECK(for static Qt, bitcoin_cv_static_qt,[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[#include ]], - [[ - #if defined(QT_STATIC) - return 0; - #else - choke me - #endif - ]])], - [bitcoin_cv_static_qt=yes], - [bitcoin_cv_static_qt=no]) - ]) - if test xbitcoin_cv_static_qt = xyes; then - AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol for static Qt plugins]) - fi -]) - -dnl Internal. Check if the link-requirements for static plugins are met. -dnl Requires: INCLUDES and LIBS must be populated as necessary. -dnl Inputs: $1: A series of Q_IMPORT_PLUGIN(). -dnl Inputs: $2: The libraries that resolve $1. -dnl Output: QT_LIBS is prepended or configure exits. -AC_DEFUN([_BITCOIN_QT_CHECK_STATIC_PLUGINS],[ - AC_MSG_CHECKING(for static Qt plugins: $2) - CHECK_STATIC_PLUGINS_TEMP_LIBS="$LIBS" - LIBS="$2 $QT_LIBS $LIBS" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ - #define QT_STATICPLUGIN - #include - $1]], - [[return 0;]])], - [AC_MSG_RESULT(yes); QT_LIBS="$2 $QT_LIBS"], - [AC_MSG_RESULT(no); BITCOIN_QT_FAIL(Could not resolve: $2)]) - LIBS="$CHECK_STATIC_PLUGINS_TEMP_LIBS" -]) - -dnl Internal. Find paths necessary for linking qt static plugins -dnl Inputs: bitcoin_qt_got_major_vers. 4 or 5. -dnl Inputs: qt_plugin_path. optional. -dnl Outputs: QT_LIBS is appended -AC_DEFUN([_BITCOIN_QT_FIND_STATIC_PLUGINS],[ - if test x$bitcoin_qt_got_major_vers = x5; then - if test x$qt_plugin_path != x; then - QT_LIBS="$QT_LIBS -L$qt_plugin_path/platforms" - if test -d "$qt_plugin_path/accessible"; then - QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible" - fi - fi - if test x$use_pkgconfig = xyes; then - : dnl - m4_ifdef([PKG_CHECK_MODULES],[ - PKG_CHECK_MODULES([QTPLATFORM], [Qt5PlatformSupport], [QT_LIBS="$QTPLATFORM_LIBS $QT_LIBS"]) - if test x$TARGET_OS = xlinux; then - PKG_CHECK_MODULES([X11XCB], [x11-xcb], [QT_LIBS="$X11XCB_LIBS $QT_LIBS"]) - if ${PKG_CONFIG} --exists "Qt5Core >= 5.5" 2>/dev/null; then - PKG_CHECK_MODULES([QTXCBQPA], [Qt5XcbQpa], [QT_LIBS="$QTXCBQPA_LIBS $QT_LIBS"]) - fi - elif test x$TARGET_OS = xdarwin; then - PKG_CHECK_MODULES([QTPRINT], [Qt5PrintSupport], [QT_LIBS="$QTPRINT_LIBS $QT_LIBS"]) - fi - ]) - else - if test x$TARGET_OS = xwindows; then - AC_CACHE_CHECK(for Qt >= 5.6, bitcoin_cv_need_platformsupport,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[#include ]],[[ - #if QT_VERSION < 0x050600 - choke; - #endif - ]])], - [bitcoin_cv_need_platformsupport=yes], - [bitcoin_cv_need_platformsupport=no]) - ]) - if test x$bitcoin_cv_need_platformsupport = xyes; then - BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}PlatformSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXPlatformSupport not found))) - fi - fi - fi - else - if test x$qt_plugin_path != x; then - QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible" - QT_LIBS="$QT_LIBS -L$qt_plugin_path/codecs" - fi - fi -]) - -dnl Internal. Find Qt libraries using pkg-config. -dnl Inputs: bitcoin_qt_want_version (from --with-gui=). The version to check -dnl first. -dnl Inputs: $1: If bitcoin_qt_want_version is "auto", check for this version -dnl first. -dnl Outputs: All necessary QT_* variables are set. -dnl Outputs: bitcoin_qt_got_major_vers is set to "4" or "5". -dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no. -AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG],[ - m4_ifdef([PKG_CHECK_MODULES],[ - auto_priority_version=$1 - if test x$auto_priority_version = x; then - auto_priority_version=qt5 - fi - if test x$bitcoin_qt_want_version = xqt5 || ( test x$bitcoin_qt_want_version = xauto && test x$auto_priority_version = xqt5 ); then - QT_LIB_PREFIX=Qt5 - bitcoin_qt_got_major_vers=5 - else - QT_LIB_PREFIX=Qt - bitcoin_qt_got_major_vers=4 - fi - qt5_modules="Qt5Core Qt5Gui Qt5Network Qt5Widgets" - qt4_modules="QtCore QtGui QtNetwork" - BITCOIN_QT_CHECK([ - if test x$bitcoin_qt_want_version = xqt5 || ( test x$bitcoin_qt_want_version = xauto && test x$auto_priority_version = xqt5 ); then - PKG_CHECK_MODULES([QT], [$qt5_modules], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes],[have_qt=no]) - elif test x$bitcoin_qt_want_version = xqt4 || ( test x$bitcoin_qt_want_version = xauto && test x$auto_priority_version = xqt4 ); then - PKG_CHECK_MODULES([QT], [$qt4_modules], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes], [have_qt=no]) - fi - - dnl qt version is set to 'auto' and the preferred version wasn't found. Now try the other. - if test x$have_qt = xno && test x$bitcoin_qt_want_version = xauto; then - if test x$auto_priority_version = xqt5; then - PKG_CHECK_MODULES([QT], [$qt4_modules], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes; QT_LIB_PREFIX=Qt; bitcoin_qt_got_major_vers=4], [have_qt=no]) - else - PKG_CHECK_MODULES([QT], [$qt5_modules], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes; QT_LIB_PREFIX=Qt5; bitcoin_qt_got_major_vers=5], [have_qt=no]) - fi - fi - if test x$have_qt != xyes; then - have_qt=no - BITCOIN_QT_FAIL([Qt dependencies not found]) - fi - ]) - BITCOIN_QT_CHECK([ - PKG_CHECK_MODULES([QT_TEST], [${QT_LIB_PREFIX}Test], [QT_TEST_INCLUDES="$QT_TEST_CFLAGS"; have_qt_test=yes], [have_qt_test=no]) - if test x$use_dbus != xno; then - PKG_CHECK_MODULES([QT_DBUS], [${QT_LIB_PREFIX}DBus], [QT_DBUS_INCLUDES="$QT_DBUS_CFLAGS"; have_qt_dbus=yes], [have_qt_dbus=no]) - fi - ]) - ]) - true; dnl -]) - -dnl Internal. Find Qt libraries without using pkg-config. Version is deduced -dnl from the discovered headers. -dnl Inputs: bitcoin_qt_want_version (from --with-gui=). The version to use. -dnl If "auto", the version will be discovered by _BITCOIN_QT_CHECK_QT5. -dnl Outputs: All necessary QT_* variables are set. -dnl Outputs: bitcoin_qt_got_major_vers is set to "4" or "5". -dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no. -AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[ - TEMP_CPPFLAGS="$CPPFLAGS" - TEMP_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$PIC_FLAGS $CXXFLAGS" - TEMP_LIBS="$LIBS" - BITCOIN_QT_CHECK([ - if test x$qt_include_path != x; then - QT_INCLUDES="-I$qt_include_path -I$qt_include_path/QtCore -I$qt_include_path/QtGui -I$qt_include_path/QtWidgets -I$qt_include_path/QtNetwork -I$qt_include_path/QtTest -I$qt_include_path/QtDBus" - CPPFLAGS="$QT_INCLUDES $CPPFLAGS" - fi - ]) - - BITCOIN_QT_CHECK([AC_CHECK_HEADER([QtPlugin],,BITCOIN_QT_FAIL(QtCore headers missing))]) - BITCOIN_QT_CHECK([AC_CHECK_HEADER([QApplication],, BITCOIN_QT_FAIL(QtGui headers missing))]) - BITCOIN_QT_CHECK([AC_CHECK_HEADER([QLocalSocket],, BITCOIN_QT_FAIL(QtNetwork headers missing))]) - - BITCOIN_QT_CHECK([ - if test x$bitcoin_qt_want_version = xauto; then - _BITCOIN_QT_CHECK_QT5 - fi - if test x$bitcoin_cv_qt5 = xyes || test x$bitcoin_qt_want_version = xqt5; then - QT_LIB_PREFIX=Qt5 - bitcoin_qt_got_major_vers=5 - else - QT_LIB_PREFIX=Qt - bitcoin_qt_got_major_vers=4 - fi - ]) - - BITCOIN_QT_CHECK([ - LIBS= - if test x$qt_lib_path != x; then - LIBS="$LIBS -L$qt_lib_path" - fi - - if test x$TARGET_OS = xwindows; then - AC_CHECK_LIB([imm32], [main],, BITCOIN_QT_FAIL(libimm32 not found)) - fi - ]) - - BITCOIN_QT_CHECK(AC_CHECK_LIB([z] ,[main],,AC_MSG_WARN([zlib not found. Assuming qt has it built-in]))) - BITCOIN_QT_CHECK(AC_SEARCH_LIBS([png_error] ,[qtpng png],,AC_MSG_WARN([libpng not found. Assuming qt has it built-in]))) - BITCOIN_QT_CHECK(AC_SEARCH_LIBS([jpeg_create_decompress] ,[qtjpeg jpeg],,AC_MSG_WARN([libjpeg not found. Assuming qt has it built-in]))) - BITCOIN_QT_CHECK(AC_SEARCH_LIBS([pcre16_exec], [qtpcre pcre16],,AC_MSG_WARN([libpcre16 not found. Assuming qt has it built-in]))) - BITCOIN_QT_CHECK(AC_SEARCH_LIBS([hb_ot_tags_from_script] ,[qtharfbuzzng harfbuzz],,AC_MSG_WARN([libharfbuzz not found. Assuming qt has it built-in or support is disabled]))) - BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Core] ,[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXCore not found))) - BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Gui] ,[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXGui not found))) - BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Network],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXNetwork not found))) - if test x$bitcoin_qt_got_major_vers = x5; then - BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Widgets],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXWidgets not found))) - fi - QT_LIBS="$LIBS" - LIBS="$TEMP_LIBS" - - BITCOIN_QT_CHECK([ - LIBS= - if test x$qt_lib_path != x; then - LIBS="-L$qt_lib_path" - fi - AC_CHECK_LIB([${QT_LIB_PREFIX}Test], [main],, have_qt_test=no) - AC_CHECK_HEADER([QTest],, have_qt_test=no) - QT_TEST_LIBS="$LIBS" - if test x$use_dbus != xno; then - LIBS= - if test x$qt_lib_path != x; then - LIBS="-L$qt_lib_path" - fi - AC_CHECK_LIB([${QT_LIB_PREFIX}DBus], [main],, have_qt_dbus=no) - AC_CHECK_HEADER([QtDBus],, have_qt_dbus=no) - QT_DBUS_LIBS="$LIBS" - fi - ]) - CPPFLAGS="$TEMP_CPPFLAGS" - CXXFLAGS="$TEMP_CXXFLAGS" - LIBS="$TEMP_LIBS" -]) - diff --git a/src/univalue/build-aux/m4/bitcoin_subdir_to_include.m4 b/src/univalue/build-aux/m4/bitcoin_subdir_to_include.m4 deleted file mode 100755 index 66f106c7d..000000000 --- a/src/univalue/build-aux/m4/bitcoin_subdir_to_include.m4 +++ /dev/null @@ -1,14 +0,0 @@ -dnl BITCOIN_SUBDIR_TO_INCLUDE([CPPFLAGS-VARIABLE-NAME],[SUBDIRECTORY-NAME],[HEADER-FILE]) -dnl SUBDIRECTORY-NAME must end with a path separator -AC_DEFUN([BITCOIN_SUBDIR_TO_INCLUDE],[ - if test "x$2" = "x"; then - AC_MSG_RESULT([default]) - else - echo "#include <$2$3.h>" >conftest.cpp - newinclpath=`${CXXCPP} ${CPPFLAGS} -M conftest.cpp 2>/dev/null | [ tr -d '\\n\\r\\\\' | sed -e 's/^.*[[:space:]:]\(\/[^[:space:]]*\)]$3[\.h[[:space:]].*$/\1/' -e t -e d`] - AC_MSG_RESULT([${newinclpath}]) - if test "x${newinclpath}" != "x"; then - eval "$1=\"\$$1\"' -I${newinclpath}'" - fi - fi -]) diff --git a/src/univalue/configure.ac b/src/univalue/configure.ac old mode 100755 new mode 100644 diff --git a/src/univalue/gen/gen.cpp b/src/univalue/gen/gen.cpp new file mode 100644 index 000000000..17f361941 --- /dev/null +++ b/src/univalue/gen/gen.cpp @@ -0,0 +1,84 @@ +// Copyright 2014 BitPay Inc. +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +// +// To re-create univalue_escapes.h: +// $ g++ -o gen gen.cpp +// $ ./gen > univalue_escapes.h +// + +#include +#include +#include "univalue.h" + +using namespace std; + +static bool initEscapes; +static std::string escapes[256]; + +static void initJsonEscape() +{ + // Escape all lower control characters (some get overridden with smaller sequences below) + for (int ch=0x00; ch<0x20; ++ch) { + char tmpbuf[20]; + snprintf(tmpbuf, sizeof(tmpbuf), "\\u%04x", ch); + escapes[ch] = std::string(tmpbuf); + } + + escapes[(int)'"'] = "\\\""; + escapes[(int)'\\'] = "\\\\"; + escapes[(int)'\b'] = "\\b"; + escapes[(int)'\f'] = "\\f"; + escapes[(int)'\n'] = "\\n"; + escapes[(int)'\r'] = "\\r"; + escapes[(int)'\t'] = "\\t"; + escapes[(int)'\x7f'] = "\\u007f"; // U+007F DELETE + + initEscapes = true; +} + +static void outputEscape() +{ + printf( "// Automatically generated file. Do not modify.\n" + "#ifndef BITCOIN_UNIVALUE_UNIVALUE_ESCAPES_H\n" + "#define BITCOIN_UNIVALUE_UNIVALUE_ESCAPES_H\n" + "static const char *escapes[256] = {\n"); + + for (unsigned int i = 0; i < 256; i++) { + if (escapes[i].empty()) { + printf("\tNULL,\n"); + } else { + printf("\t\""); + + unsigned int si; + for (si = 0; si < escapes[i].size(); si++) { + char ch = escapes[i][si]; + switch (ch) { + case '"': + printf("\\\""); + break; + case '\\': + printf("\\\\"); + break; + default: + printf("%c", escapes[i][si]); + break; + } + } + + printf("\",\n"); + } + } + + printf( "};\n" + "#endif // BITCOIN_UNIVALUE_UNIVALUE_ESCAPES_H\n"); +} + +int main (int argc, char *argv[]) +{ + initJsonEscape(); + outputEscape(); + return 0; +} + diff --git a/src/univalue/include/univalue.h b/src/univalue/include/univalue.h old mode 100755 new mode 100644 diff --git a/src/univalue/lib/univalue.cpp b/src/univalue/lib/univalue.cpp old mode 100755 new mode 100644 diff --git a/src/univalue/lib/univalue_escapes.h b/src/univalue/lib/univalue_escapes.h old mode 100755 new mode 100644 diff --git a/src/univalue/lib/univalue_read.cpp b/src/univalue/lib/univalue_read.cpp old mode 100755 new mode 100644 diff --git a/src/univalue/lib/univalue_utffilter.h b/src/univalue/lib/univalue_utffilter.h old mode 100755 new mode 100644 diff --git a/src/univalue/lib/univalue_write.cpp b/src/univalue/lib/univalue_write.cpp old mode 100755 new mode 100644 diff --git a/src/univalue/pc/libunivalue-uninstalled.pc.in b/src/univalue/pc/libunivalue-uninstalled.pc.in old mode 100755 new mode 100644 diff --git a/src/univalue/pc/libunivalue.pc.in b/src/univalue/pc/libunivalue.pc.in old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail1.json b/src/univalue/test/fail1.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail10.json b/src/univalue/test/fail10.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail11.json b/src/univalue/test/fail11.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail12.json b/src/univalue/test/fail12.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail13.json b/src/univalue/test/fail13.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail14.json b/src/univalue/test/fail14.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail15.json b/src/univalue/test/fail15.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail16.json b/src/univalue/test/fail16.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail17.json b/src/univalue/test/fail17.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail18.json b/src/univalue/test/fail18.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail19.json b/src/univalue/test/fail19.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail2.json b/src/univalue/test/fail2.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail20.json b/src/univalue/test/fail20.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail21.json b/src/univalue/test/fail21.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail22.json b/src/univalue/test/fail22.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail23.json b/src/univalue/test/fail23.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail24.json b/src/univalue/test/fail24.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail25.json b/src/univalue/test/fail25.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail26.json b/src/univalue/test/fail26.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail27.json b/src/univalue/test/fail27.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail28.json b/src/univalue/test/fail28.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail29.json b/src/univalue/test/fail29.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail3.json b/src/univalue/test/fail3.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail30.json b/src/univalue/test/fail30.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail31.json b/src/univalue/test/fail31.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail32.json b/src/univalue/test/fail32.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail33.json b/src/univalue/test/fail33.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail34.json b/src/univalue/test/fail34.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail35.json b/src/univalue/test/fail35.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail36.json b/src/univalue/test/fail36.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail37.json b/src/univalue/test/fail37.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail38.json b/src/univalue/test/fail38.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail39.json b/src/univalue/test/fail39.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail4.json b/src/univalue/test/fail4.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail40.json b/src/univalue/test/fail40.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail41.json b/src/univalue/test/fail41.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail42.json b/src/univalue/test/fail42.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail44.json b/src/univalue/test/fail44.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail5.json b/src/univalue/test/fail5.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail6.json b/src/univalue/test/fail6.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail7.json b/src/univalue/test/fail7.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail8.json b/src/univalue/test/fail8.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/fail9.json b/src/univalue/test/fail9.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/no_nul.cpp b/src/univalue/test/no_nul.cpp old mode 100755 new mode 100644 diff --git a/src/univalue/test/object.cpp b/src/univalue/test/object.cpp old mode 100755 new mode 100644 diff --git a/src/univalue/test/pass1.json b/src/univalue/test/pass1.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/pass2.json b/src/univalue/test/pass2.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/pass3.json b/src/univalue/test/pass3.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/round1.json b/src/univalue/test/round1.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/round2.json b/src/univalue/test/round2.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/round3.json b/src/univalue/test/round3.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/round4.json b/src/univalue/test/round4.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/round5.json b/src/univalue/test/round5.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/round6.json b/src/univalue/test/round6.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/round7.json b/src/univalue/test/round7.json old mode 100755 new mode 100644 diff --git a/src/univalue/test/test_json.cpp b/src/univalue/test/test_json.cpp old mode 100755 new mode 100644 diff --git a/src/univalue/test/unitester.cpp b/src/univalue/test/unitester.cpp old mode 100755 new mode 100644 From 4ca9c7c7caaaadd53bf91124ae7d106f61498238 Mon Sep 17 00:00:00 2001 From: Ra's Al Ghul Date: Sun, 8 Sep 2019 15:43:08 -0700 Subject: [PATCH 06/26] Build System Fix(Gitain) (#31) * Give error if pow phase is finished * Force Sync to allow for staking without mnsync * Fix error * Update rpcmisc.cpp * Update rpcmisc.cpp * more ignore * Update fundamentalnode-sync.cpp * Add gitian build python script * Update Univalue * add missing gencpp * Add missing includes * Fix Gitian build Update Univalue add missing gencpp Add missing includes * Revert "Update fundamentalnode-sync.cpp" This reverts commit 323b13fc599b03982b0ca7c3f32342537a6b992f * Fix gitian build and minor updates * remove forcesync From 7e6bb6283dba42eec67848bd3155970229657069 Mon Sep 17 00:00:00 2001 From: Akshay CM Date: Thu, 3 Oct 2019 19:19:54 +0530 Subject: [PATCH 07/26] Updates + crash fixes (#34) * Give error if pow phase is finished * Force Sync to allow for staking without mnsync * Fix error * Update rpcmisc.cpp * Update rpcmisc.cpp * more ignore * Update fundamentalnode-sync.cpp * Add gitian build python script * Update Univalue * add missing gencpp * Add missing includes * Fix Gitian build Update Univalue add missing gencpp Add missing includes * Revert "Update fundamentalnode-sync.cpp" This reverts commit 323b13fc599b03982b0ca7c3f32342537a6b992f * Fix gitian build and minor updates * remove forcesync * [Model] Invalid iterator position crash fix. * background loading crash fixed. * random: fix crash on some 64bit platforms rbx needs to be stashed in a 64bit register on 64bit platforms. With this crash in particular, it was holding a stack canary which was not properly restored after the cpuid. Split out the x86+PIC case so that x86_64 doesn't have to worry about it. * random: Add fallback if getrandom syscall not available If the code was compiled with newer (>=3.17) kernel headers but executed on a system without the system call, every use of random would crash the program. Add a fallback for that case. * Don't assert if we were beaten to the block A timing window exists where a wallet could be creating a new block from within the miner thread when a new block is received to the wallet. This window will create a situation where TestBlockValidity() fails because the chain tip has changed between the time it created the new block and the time it tested the validity of the block. This situation would result in the wallet being asserted; however this is a little overkill. rather than asserting if the tip has changed, it is better to throw the block away. This problem was revealed during a testnet test of an altcoin, and very prevalent when multiple wallet existed with the exact same number of staking coins received in the same transaction; or when multiple wallets were staking the same coins via import private key. The problem happens significantly less in more normal circumstances, but was still observed in a testing environment with fast blocks. It is likely that this scenario has been encountered but never determined to be root cause, as a crashed wallet could be restarted, re-indexed and never investigated further. * [Wallet] Add some LOCK to avoid crash Github-Pull: #625 Rebased-From: ed23d0d62054156e0c2cb632fecbd65588c50e8c --- .../python-bitcoinrpc/bitcoinrpc/__init__.py | 0 src/main.cpp | 6 +- src/qt/addresstablemodel.cpp | 22 +++ src/qt/askpassphrasedialog.cpp | 37 +++++ src/qt/askpassphrasedialog.h | 2 + src/random.cpp | 147 ++++++++++++++++++ src/test/data/blanktx.hex | 0 src/test/data/tt-delin1-out.hex | 0 src/test/data/tt-delout1-out.hex | 0 src/test/data/tt-locktime317000-out.hex | 0 src/test/data/tx394b54bb.hex | 0 src/test/data/txcreate1.hex | 0 src/test/data/txcreate2.hex | 0 src/test/data/txcreatesign.hex | 0 src/wallet.cpp | 10 ++ src/wallet_ismine.h | 0 16 files changed, 223 insertions(+), 1 deletion(-) mode change 100755 => 100644 qa/rpc-tests/python-bitcoinrpc/bitcoinrpc/__init__.py mode change 100755 => 100644 src/test/data/blanktx.hex mode change 100755 => 100644 src/test/data/tt-delin1-out.hex mode change 100755 => 100644 src/test/data/tt-delout1-out.hex mode change 100755 => 100644 src/test/data/tt-locktime317000-out.hex mode change 100755 => 100644 src/test/data/tx394b54bb.hex mode change 100755 => 100644 src/test/data/txcreate1.hex mode change 100755 => 100644 src/test/data/txcreate2.hex mode change 100755 => 100644 src/test/data/txcreatesign.hex mode change 100755 => 100644 src/wallet_ismine.h diff --git a/qa/rpc-tests/python-bitcoinrpc/bitcoinrpc/__init__.py b/qa/rpc-tests/python-bitcoinrpc/bitcoinrpc/__init__.py old mode 100755 new mode 100644 diff --git a/src/main.cpp b/src/main.cpp index 11be83cac..e2513680b 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -5269,7 +5269,11 @@ bool ProcessNewBlock(CValidationState& state, CNode* pfrom, CBlock* pblock, CDis bool TestBlockValidity(CValidationState& state, const CBlock& block, CBlockIndex* const pindexPrev, bool fCheckPOW, bool fCheckMerkleRoot) { AssertLockHeld(cs_main); - assert(pindexPrev == chainActive.Tip()); + assert(pindexPrev); + if (pindexPrev != chainActive.Tip()) { + LogPrintf("TestBlockValidity(): No longer working on chain tip\n"); + return false; + } CCoinsViewCache viewNew(pcoinsTip); CBlockIndex indexDummy(block); diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index 264954da3..2f689eecf 100755 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -450,6 +450,28 @@ int AddressTableModel::lookupAddress(const QString& address) const } } +/** + * Return last created unused address --> TODO: complete "unused".. + * @return + */ +QString AddressTableModel::getLastUnusedAddress() const{ + LOCK(wallet->cs_wallet); + if(!wallet->mapAddressBook.empty()) { + for (std::map::iterator it = wallet->mapAddressBook.end(); it != wallet->mapAddressBook.begin(); --it) { + if(it != wallet->mapAddressBook.end()) { + if (it->second.purpose == "receive") { + const CBitcoinAddress &address = it->first; + bool fMine = IsMine(*wallet, address.Get()); + if (fMine) { + return QString::fromStdString(address.ToString()); + } + } + } + } + } + return QString(); +} + void AddressTableModel::emitDataChanged(int idx) { emit dataChanged(index(idx, 0, QModelIndex()), index(idx, columns.length() - 1, QModelIndex())); diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index c61c5ebf2..d3797ac2e 100755 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -239,3 +239,40 @@ bool AskPassphraseDialog::eventFilter(QObject* object, QEvent* event) } return QDialog::eventFilter(object, event); } + +void AskPassphraseDialog::warningMessage() { + QMessageBox::warning(this, tr("Wallet encrypted"), + "" + + tr("Vitae will close now to finish the encryption process. " + "Remember that encrypting your wallet cannot fully protect " + "your VITAEs from being stolen by malware infecting your computer.") + + "

" + + tr("IMPORTANT: Any previous backups you have made of your wallet file " + "should be replaced with the newly generated, encrypted wallet file. " + "For security reasons, previous backups of the unencrypted wallet file " + "will become useless as soon as you start using the new, encrypted wallet.") + + "
"); + QApplication::quit(); +} + +void AskPassphraseDialog::errorEncryptingWallet() { + QMessageBox::critical(this, tr("Wallet encryption failed"), + tr("Wallet encryption failed due to an internal error. Your wallet was not encrypted.")); +} + +void AskPassphraseDialog::run(int type){ + if (type == 1) { + if (!newpassCache.empty()) { + if (model->setWalletEncrypted(true, newpassCache)) { + QMetaObject::invokeMethod(this, "warningMessage", Qt::QueuedConnection); + } else { + QMetaObject::invokeMethod(this, "errorEncryptingWallet", Qt::QueuedConnection); + } + newpassCache.clear(); + QDialog::accept(); // Success + } + } +} +void AskPassphraseDialog::onError(int type, QString error){ + newpassCache = ""; +} \ No newline at end of file diff --git a/src/qt/askpassphrasedialog.h b/src/qt/askpassphrasedialog.h index 655ba3291..af8cbeab4 100755 --- a/src/qt/askpassphrasedialog.h +++ b/src/qt/askpassphrasedialog.h @@ -42,6 +42,8 @@ class AskPassphraseDialog : public QDialog private slots: void textChanged(); + void warningMessage(); + void errorEncryptingWallet(); protected: bool event(QEvent* event); diff --git a/src/random.cpp b/src/random.cpp index c6f963e25..e5be6118a 100755 --- a/src/random.cpp +++ b/src/random.cpp @@ -38,6 +38,70 @@ static inline int64_t GetPerformanceCounter() return nCounter; } + +#if defined(__x86_64__) || defined(__amd64__) || defined(__i386__) +static std::atomic hwrand_initialized{false}; +static bool rdrand_supported = false; +static constexpr uint32_t CPUID_F1_ECX_RDRAND = 0x40000000; +static void RDRandInit() +{ + uint32_t eax, ecx, edx; +#if defined(__i386__) && ( defined(__PIC__) || defined(__PIE__)) + // Avoid clobbering ebx, as that is used for PIC on x86. + uint32_t tmp; + __asm__ ("mov %%ebx, %1; cpuid; mov %1, %%ebx": "=a"(eax), "=g"(tmp), "=c"(ecx), "=d"(edx) : "a"(1)); +#else + uint32_t ebx; + __asm__ ("cpuid": "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) : "a"(1)); +#endif + //! When calling cpuid function #1, ecx register will have this set if RDRAND is available. + if (ecx & CPUID_F1_ECX_RDRAND) { + LogPrintf("Using RdRand as entropy source\n"); + rdrand_supported = true; + } + hwrand_initialized.store(true); +} +#else +static void RDRandInit() {} +#endif + +static bool GetHWRand(unsigned char* ent32) { +#if defined(__x86_64__) || defined(__amd64__) || defined(__i386__) + assert(hwrand_initialized.load(std::memory_order_relaxed)); + if (rdrand_supported) { + uint8_t ok; + // Not all assemblers support the rdrand instruction, write it in hex. +#ifdef __i386__ + for (int iter = 0; iter < 4; ++iter) { + uint32_t r1, r2; + __asm__ volatile (".byte 0x0f, 0xc7, 0xf0;" // rdrand %eax + ".byte 0x0f, 0xc7, 0xf2;" // rdrand %edx + "setc %2" : + "=a"(r1), "=d"(r2), "=q"(ok) :: "cc"); + if (!ok) return false; + WriteLE32(ent32 + 8 * iter, r1); + WriteLE32(ent32 + 8 * iter + 4, r2); + } +#else + uint64_t r1, r2, r3, r4; + __asm__ volatile (".byte 0x48, 0x0f, 0xc7, 0xf0, " // rdrand %rax + "0x48, 0x0f, 0xc7, 0xf3, " // rdrand %rbx + "0x48, 0x0f, 0xc7, 0xf1, " // rdrand %rcx + "0x48, 0x0f, 0xc7, 0xf2; " // rdrand %rdx + "setc %4" : + "=a"(r1), "=b"(r2), "=c"(r3), "=d"(r4), "=q"(ok) :: "cc"); + if (!ok) return false; + WriteLE64(ent32, r1); + WriteLE64(ent32 + 8, r2); + WriteLE64(ent32 + 16, r3); + WriteLE64(ent32 + 24, r4); +#endif + return true; + } +#endif + return false; +} + void RandAddSeed() { // Seed with CPU performance counter @@ -85,6 +149,89 @@ void RandAddSeedPerfmon() #endif } +#ifndef WIN32 +/** Fallback: get 32 bytes of system entropy from /dev/urandom. The most + * compatible way to get cryptographic randomness on UNIX-ish platforms. + */ +void GetDevURandom(unsigned char *ent32) +{ + int f = open("/dev/urandom", O_RDONLY); + if (f == -1) { + RandFailure(); + } + int have = 0; + do { + ssize_t n = read(f, ent32 + have, NUM_OS_RANDOM_BYTES - have); + if (n <= 0 || n + have > NUM_OS_RANDOM_BYTES) { + RandFailure(); + } + have += n; + } while (have < NUM_OS_RANDOM_BYTES); + close(f); +} +#endif + +/** Get 32 bytes of system entropy. */ +void GetOSRand(unsigned char *ent32) +{ +#if defined(WIN32) + HCRYPTPROV hProvider; + int ret = CryptAcquireContextW(&hProvider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT); + if (!ret) { + RandFailure(); + } + ret = CryptGenRandom(hProvider, NUM_OS_RANDOM_BYTES, ent32); + if (!ret) { + RandFailure(); + } + CryptReleaseContext(hProvider, 0); +#elif defined(HAVE_SYS_GETRANDOM) + /* Linux. From the getrandom(2) man page: + * "If the urandom source has been initialized, reads of up to 256 bytes + * will always return as many bytes as requested and will not be + * interrupted by signals." + */ + int rv = syscall(SYS_getrandom, ent32, NUM_OS_RANDOM_BYTES, 0); + if (rv != NUM_OS_RANDOM_BYTES) { + if (rv < 0 && errno == ENOSYS) { + /* Fallback for kernel <3.17: the return value will be -1 and errno + * ENOSYS if the syscall is not available, in that case fall back + * to /dev/urandom. + */ + GetDevURandom(ent32); + } else { + RandFailure(); + } + } +#elif defined(HAVE_GETENTROPY) + /* On OpenBSD this can return up to 256 bytes of entropy, will return an + * error if more are requested. + * The call cannot return less than the requested number of bytes. + */ + if (getentropy(ent32, NUM_OS_RANDOM_BYTES) != 0) { + RandFailure(); + } +#elif defined(HAVE_SYSCTL_ARND) + /* FreeBSD and similar. It is possible for the call to return less + * bytes than requested, so need to read in a loop. + */ + static const int name[2] = {CTL_KERN, KERN_ARND}; + int have = 0; + do { + size_t len = NUM_OS_RANDOM_BYTES - have; + if (sysctl(name, ARRAYLEN(name), ent32 + have, &len, NULL, 0) != 0) { + RandFailure(); + } + have += len; + } while (have < NUM_OS_RANDOM_BYTES); +#else + /* Fall back to /dev/urandom if there is no specific method implemented to + * get system entropy for this OS. + */ + GetDevURandom(ent32); +#endif +} + void GetRandBytes(unsigned char* buf, int num) { if (RAND_bytes(buf, num) != 1) { diff --git a/src/test/data/blanktx.hex b/src/test/data/blanktx.hex old mode 100755 new mode 100644 diff --git a/src/test/data/tt-delin1-out.hex b/src/test/data/tt-delin1-out.hex old mode 100755 new mode 100644 diff --git a/src/test/data/tt-delout1-out.hex b/src/test/data/tt-delout1-out.hex old mode 100755 new mode 100644 diff --git a/src/test/data/tt-locktime317000-out.hex b/src/test/data/tt-locktime317000-out.hex old mode 100755 new mode 100644 diff --git a/src/test/data/tx394b54bb.hex b/src/test/data/tx394b54bb.hex old mode 100755 new mode 100644 diff --git a/src/test/data/txcreate1.hex b/src/test/data/txcreate1.hex old mode 100755 new mode 100644 diff --git a/src/test/data/txcreate2.hex b/src/test/data/txcreate2.hex old mode 100755 new mode 100644 diff --git a/src/test/data/txcreatesign.hex b/src/test/data/txcreatesign.hex old mode 100755 new mode 100644 diff --git a/src/wallet.cpp b/src/wallet.cpp index b20b1d275..d341291bc 100755 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -940,6 +940,7 @@ int64_t CWalletTx::GetTxTime() const int64_t CWalletTx::GetComputedTxTime() const { + LOCK(cs_main); if (IsZerocoinSpend() || IsZerocoinMint()) { if (IsInMainChain()) return mapBlockIndex.at(hashBlock)->GetBlockTime(); @@ -1041,6 +1042,7 @@ CAmount CWalletTx::GetCredit(const isminefilter& filter) const CAmount CWalletTx::GetImmatureCredit(bool fUseCache) const { + LOCK(cs_main); if ((IsCoinBase() || IsCoinStake()) && GetBlocksToMaturity() > 0 && IsInMainChain()) { if (fUseCache && fImmatureCreditCached) return nImmatureCreditCached; @@ -1256,6 +1258,7 @@ CAmount CWalletTx::GetDenominatedCredit(bool unconfirmed, bool fUseCache) const CAmount CWalletTx::GetImmatureWatchOnlyCredit(const bool& fUseCache) const { + LOCK(cs_main); if (IsCoinBase() && GetBlocksToMaturity() > 0 && IsInMainChain()) { if (fUseCache && fImmatureWatchCreditCached) return nImmatureWatchCreditCached; @@ -1495,6 +1498,7 @@ bool CWalletTx::InMempool() const void CWalletTx::RelayWalletTransaction(std::string strCommand) { + LOCK(cs_main); if (!IsCoinBase()) { if (GetDepthInMainChain() == 0) { uint256 hash = GetHash(); @@ -2058,6 +2062,8 @@ bool less_then_denom(const COutput& out1, const COutput& out2) bool CWallet::SelectStakeCoins(std::set >& setCoins, CAmount nTargetAmount) const { + LOCK(cs_main); + //Add Vitae vector vCoins; AvailableCoins(vCoins, true, NULL, false, STAKABLE_COINS); CAmount nAmountSelected = 0; @@ -2092,6 +2098,7 @@ bool CWallet::SelectStakeCoins(std::setnTime < (GetAdjustedTime() - 300) || IsLocked()) { return; } @@ -4132,6 +4140,7 @@ void CWallet::AutoCombineDust() bool CWallet::MultiSend() { + LOCK2(cs_main, cs_wallet); // Stop the old blocks from sending multisends if (chainActive.Tip()->nTime < (GetAdjustedTime() - 300) || IsLocked()) { return false; @@ -4340,6 +4349,7 @@ int CMerkleTx::GetDepthInMainChain(const CBlockIndex*& pindexRet, bool enableIX) int CMerkleTx::GetBlocksToMaturity() const { + LOCK(cs_main); if (!(IsCoinBase() || IsCoinStake())) return 0; return max(0, (Params().COINBASE_MATURITY() + 1) - GetDepthInMainChain()); diff --git a/src/wallet_ismine.h b/src/wallet_ismine.h old mode 100755 new mode 100644 From c6f956618c50fe07a681991ecf96b6e4380fcb72 Mon Sep 17 00:00:00 2001 From: Ra's Al Ghul Date: Thu, 3 Oct 2019 06:52:20 -0700 Subject: [PATCH 08/26] Sync develop with master (#35) * Build System Fix(Gitain) * Give error if pow phase is finished * Force Sync to allow for staking without mnsync * Fix error * Update rpcmisc.cpp * Update rpcmisc.cpp * more ignore * Update fundamentalnode-sync.cpp * Add gitian build python script * Update Univalue * add missing gencpp * Add missing includes * Fix Gitian build Update Univalue add missing gencpp Add missing includes * Revert "Update fundamentalnode-sync.cpp" This reverts commit 323b13fc599b03982b0ca7c3f32342537a6b992f * Fix gitian build and minor updates * remove forcesync * Fix for supply --dirty dirty fix for moneysupply * Revert "Fix for supply --dirty" This reverts commit 8060c6c1f840f477cb7803000e91be8a632aa03f. From 24979701a9cd14b3b22e62ae59b0000c284d3fc5 Mon Sep 17 00:00:00 2001 From: Ra's Al Ghul Date: Thu, 3 Oct 2019 06:55:52 -0700 Subject: [PATCH 09/26] Another attempt at syncing master and develop (#36) * Build System Fix(Gitain) * Give error if pow phase is finished * Force Sync to allow for staking without mnsync * Fix error * Update rpcmisc.cpp * Update rpcmisc.cpp * more ignore * Update fundamentalnode-sync.cpp * Add gitian build python script * Update Univalue * add missing gencpp * Add missing includes * Fix Gitian build Update Univalue add missing gencpp Add missing includes * Revert "Update fundamentalnode-sync.cpp" This reverts commit 323b13fc599b03982b0ca7c3f32342537a6b992f * Fix gitian build and minor updates * remove forcesync * Fix for supply --dirty dirty fix for moneysupply * Revert "Fix for supply --dirty" This reverts commit 8060c6c1f840f477cb7803000e91be8a632aa03f. From f46114cd9060616f030d4fc393705ee8a92eab5e Mon Sep 17 00:00:00 2001 From: Akshay CM Date: Thu, 3 Oct 2019 20:16:22 +0530 Subject: [PATCH 10/26] Mining Fixes (#37) * Give error if pow phase is finished * Force Sync to allow for staking without mnsync * Fix error * Update rpcmisc.cpp * Update rpcmisc.cpp * more ignore * Update fundamentalnode-sync.cpp * Add gitian build python script * Update Univalue * add missing gencpp * Add missing includes * Fix Gitian build Update Univalue add missing gencpp Add missing includes * Revert "Update fundamentalnode-sync.cpp" This reverts commit 323b13fc599b03982b0ca7c3f32342537a6b992f * Fix gitian build and minor updates * remove forcesync * [Model] Invalid iterator position crash fix. * background loading crash fixed. * random: fix crash on some 64bit platforms rbx needs to be stashed in a 64bit register on 64bit platforms. With this crash in particular, it was holding a stack canary which was not properly restored after the cpuid. Split out the x86+PIC case so that x86_64 doesn't have to worry about it. * random: Add fallback if getrandom syscall not available If the code was compiled with newer (>=3.17) kernel headers but executed on a system without the system call, every use of random would crash the program. Add a fallback for that case. * Don't assert if we were beaten to the block A timing window exists where a wallet could be creating a new block from within the miner thread when a new block is received to the wallet. This window will create a situation where TestBlockValidity() fails because the chain tip has changed between the time it created the new block and the time it tested the validity of the block. This situation would result in the wallet being asserted; however this is a little overkill. rather than asserting if the tip has changed, it is better to throw the block away. This problem was revealed during a testnet test of an altcoin, and very prevalent when multiple wallet existed with the exact same number of staking coins received in the same transaction; or when multiple wallets were staking the same coins via import private key. The problem happens significantly less in more normal circumstances, but was still observed in a testing environment with fast blocks. It is likely that this scenario has been encountered but never determined to be root cause, as a crashed wallet could be restarted, re-indexed and never investigated further. * [Wallet] Add some LOCK to avoid crash Github-Pull: #625 Rebased-From: ed23d0d62054156e0c2cb632fecbd65588c50e8c * testnet mining fixes --- doc/developer-notes.md | 2 +- src/miner.cpp | 65 ++++++++++++++++++++++++++++-------------- src/miner.h | 4 +-- src/net.cpp | 2 +- src/pow.cpp | 10 +++++-- 5 files changed, 56 insertions(+), 27 deletions(-) diff --git a/doc/developer-notes.md b/doc/developer-notes.md index 3f081ba3b..273e2ca96 100755 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -172,7 +172,7 @@ Threads - ThreadRPCServer : Remote procedure call handler, listens on port 8332 for connections and services them. -- BitcoinMiner : Generates bitcoins (if wallet is enabled). +- VitaeMiner : Generates bitcoins (if wallet is enabled). - Shutdown : Does an orderly shutdown of everything. diff --git a/src/miner.cpp b/src/miner.cpp index 65f399976..49d32128b 100755 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -105,16 +105,28 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn, CWallet* pwallet, if (!pblocktemplate.get()) return NULL; CBlock* pblock = &pblocktemplate->block; // pointer for convenience + // Tip + CBlockIndex* pindexPrev; + { // Don't keep cs_main locked + LOCK(cs_main); + pindexPrev = chainActive.Tip(); + } + const int nHeight = pindexPrev->nHeight + 1; + + // Make sure to create the correct block version after zerocoin is enabled + bool fZerocoinActive = nHeight >= Params().Zerocoin_StartHeight(); + pblock->nVersion = 6; // Supports CLTV activation // -regtest only: allow overriding block.nVersion with // -blockversion=N to test forking scenarios - if (Params().MineBlocksOnDemand()) - pblock->nVersion = GetArg("-blockversion", pblock->nVersion); + if (Params().MineBlocksOnDemand()) { + if (fZerocoinActive) + pblock->nVersion = 6; + else + pblock->nVersion = 3; - // Make sure to create the correct block version after zerocoin is enabled - bool fZerocoinActive = GetAdjustedTime() >= Params().Zerocoin_StartTime(); - // Supports CLTV activation - pblock->nVersion = 6; + pblock->nVersion = GetArg("-blockversion", pblock->nVersion); + } // Create coinbase tx CMutableTransaction txNew; @@ -132,7 +144,6 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn, CWallet* pwallet, if (fProofOfStake) { boost::this_thread::interruption_point(); pblock->nTime = GetAdjustedTime(); - CBlockIndex* pindexPrev = chainActive.Tip(); pblock->nBits = GetNextWorkRequired(pindexPrev, pblock); CMutableTransaction txCoinStake; int64_t nSearchTime = pblock->nTime; // search to current time @@ -148,9 +159,10 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn, CWallet* pwallet, nLastCoinStakeSearchInterval = nSearchTime - nLastCoinStakeSearchTime; nLastCoinStakeSearchTime = nSearchTime; } - - if (!fStakeFound) + if (!fStakeFound) { + LogPrintf("CreateNewBlock(): stake not found\n"); return NULL; + } } bool bMasterNodePayment = false; @@ -187,8 +199,6 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn, CWallet* pwallet, { LOCK2(cs_main, mempool.cs); - CBlockIndex* pindexPrev = chainActive.Tip(); - const int nHeight = pindexPrev->nHeight + 1; CCoinsViewCache view(pcoinsTip); // Priority order to process transactions @@ -416,6 +426,11 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn, CWallet* pwallet, if (txNew.vout.size() > 1) { pblock->payee = txNew.vout[1].scriptPubKey; } + else { + CAmount blockValue = nFees + GetBlockValue(pindexPrev->nHeight); + txNew.vout[0].nValue = blockValue; + txNew.vin[0].scriptSig = CScript() << nHeight << OP_0; + } } nLastBlockTx = nBlockTx; @@ -441,7 +456,15 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn, CWallet* pwallet, } pblock->nAccumulatorCheckpoint = nCheckpoint; pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]); - + if (fProofOfStake) { + unsigned int nExtraNonce = 0; + IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); + LogPrintf("CPUMiner : proof-of-stake block found %s \n", pblock->GetHash().ToString().c_str()); + if (!SignBlock(*pblock, *pwallet)) { + LogPrintf("VitaeMiner(): Signing new block with UTXO key failed \n"); + return NULL; + } + } CValidationState state; if (!TestBlockValidity(state, *pblock, pindexPrev, false, false)) { LogPrintf("CreateNewBlock() : TestBlockValidity failed\n"); @@ -530,7 +553,7 @@ int nMintableLastCheck = 0; // ***TODO*** that part changed in bitcoin, we are using a mix with old one here for now -void BitcoinMiner(CWallet* pwallet, bool fProofOfStake) +void VitaeMiner(CWallet* pwallet, bool fProofOfStake) { LogPrintf("VITAEMiner started\n"); SetThreadPriority(THREAD_PRIORITY_LOWEST); @@ -602,7 +625,7 @@ void BitcoinMiner(CWallet* pwallet, bool fProofOfStake) LogPrintf("CPUMiner : proof-of-stake block found %s \n", pblock->GetHash().ToString().c_str()); if (!pblock->SignBlock(*pwallet)) { - LogPrintf("BitcoinMiner(): Signing new block failed \n"); + LogPrintf("VitaeMiner(): Signing new block failed \n"); continue; } @@ -631,7 +654,7 @@ void BitcoinMiner(CWallet* pwallet, bool fProofOfStake) if (hash <= hashTarget) { // Found a solution SetThreadPriority(THREAD_PRIORITY_NORMAL); - LogPrintf("BitcoinMiner:\n"); + LogPrintf("VitaeMiner:\n"); LogPrintf("proof-of-work found \n hash: %s \ntarget: %s\n", hash.GetHex(), hashTarget.GetHex()); ProcessBlockFound(pblock, *pwallet, reservekey); SetThreadPriority(THREAD_PRIORITY_LOWEST); @@ -695,20 +718,20 @@ void BitcoinMiner(CWallet* pwallet, bool fProofOfStake) } } -void static ThreadBitcoinMiner(void* parg) +void static ThreadVitaeMiner(void* parg) { boost::this_thread::interruption_point(); CWallet* pwallet = (CWallet*)parg; try { - BitcoinMiner(pwallet, false); + VitaeMiner(pwallet, false); boost::this_thread::interruption_point(); } catch (std::exception& e) { - LogPrintf("ThreadBitcoinMiner() exception"); + LogPrintf("ThreadVitaeMiner() exception"); } catch (...) { - LogPrintf("ThreadBitcoinMiner() exception"); + LogPrintf("ThreadVitaeMiner() exception"); } - LogPrintf("ThreadBitcoinMiner exiting\n"); + LogPrintf("ThreadVitaeMiner exiting\n"); } void GenerateBitcoins(bool fGenerate, CWallet* pwallet, int nThreads) @@ -735,7 +758,7 @@ void GenerateBitcoins(bool fGenerate, CWallet* pwallet, int nThreads) minerThreads = new boost::thread_group(); for (int i = 0; i < nThreads; i++) - minerThreads->create_thread(boost::bind(&ThreadBitcoinMiner, pwallet)); + minerThreads->create_thread(boost::bind(&ThreadVitaeMiner, pwallet)); } #endif // ENABLE_WALLET diff --git a/src/miner.h b/src/miner.h index 1b4847132..6e10ef11d 100755 --- a/src/miner.h +++ b/src/miner.h @@ -7,7 +7,7 @@ #define BITCOIN_MINER_H #include - +#include "primitives/block.h" class CBlock; class CBlockHeader; class CBlockIndex; @@ -27,7 +27,7 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& /** Check mined block */ void UpdateTime(CBlockHeader* block, const CBlockIndex* pindexPrev); -void BitcoinMiner(CWallet* pwallet, bool fProofOfStake); +void VitaeMiner(CWallet* pwallet, bool fProofOfStake); extern double dHashesPerSec; extern int64_t nHPSTimerStart; diff --git a/src/net.cpp b/src/net.cpp index 14160b0a6..e9a484d56 100755 --- a/src/net.cpp +++ b/src/net.cpp @@ -1573,7 +1573,7 @@ void static ThreadStakeMinter() LogPrintf("ThreadStakeMinter started\n"); CWallet* pwallet = pwalletMain; try { - BitcoinMiner(pwallet, true); + VitaeMiner(pwallet, true); boost::this_thread::interruption_point(); } catch (std::exception& e) { LogPrintf("ThreadStakeMinter() exception \n"); diff --git a/src/pow.cpp b/src/pow.cpp index 360e7654a..a14ba37dd 100755 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -20,6 +20,8 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader* pblock) { + if (Params().NetworkID() == CBaseChainParams::REGTEST) + return pindexLast->nBits; /* current difficulty formula, vitae - DarkGravity v3, written by Evan Duffield - evan@dashpay.io */ const CBlockIndex* BlockLastSolved = pindexLast; const CBlockIndex* BlockReading = pindexLast; @@ -126,8 +128,12 @@ bool CheckProofOfWork(uint256 hash, unsigned int nBits) return error("CheckProofOfWork() : nBits below minimum work"); // Check proof of work matches claimed amount - if (hash > bnTarget) - return error("CheckProofOfWork() : hash doesn't match nBits"); + if (hash > bnTarget) { + if (Params().MineBlocksOnDemand()) + return false; + else + return error("CheckProofOfWork() : hash doesn't match nBits"); + } return true; } From aaee68558a74c3a5b8a0080a810a6fe81700eb28 Mon Sep 17 00:00:00 2001 From: Andrew LaChasse Date: Thu, 3 Oct 2019 15:34:43 -0700 Subject: [PATCH 11/26] Update developer-notes.md --- doc/developer-notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/developer-notes.md b/doc/developer-notes.md index 273e2ca96..45fb378d6 100755 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -172,7 +172,7 @@ Threads - ThreadRPCServer : Remote procedure call handler, listens on port 8332 for connections and services them. -- VitaeMiner : Generates bitcoins (if wallet is enabled). +- VitaeMiner : Generates Vitae (if wallet is enabled). - Shutdown : Does an orderly shutdown of everything. From 84ce45dc5a5584c1765e9c60f653d7c176aaa07b Mon Sep 17 00:00:00 2001 From: Andrew LaChasse Date: Fri, 4 Oct 2019 00:24:06 -0700 Subject: [PATCH 12/26] Update Copyright --- src/core_read.cpp | 3 ++- src/miner.cpp | 6 +++--- src/primitives/block.cpp | 3 ++- src/primitives/block.h | 3 ++- src/primitives/transaction.cpp | 3 ++- src/primitives/transaction.h | 3 ++- src/qt/addressbookpage.cpp | 3 ++- src/qt/addresstablemodel.cpp | 3 ++- src/qt/askpassphrasedialog.cpp | 3 ++- src/qt/bip38tooldialog.cpp | 3 ++- src/qt/bitcoinaddressvalidator.cpp | 3 ++- src/qt/bitcoingui.cpp | 3 ++- src/qt/bitcoinunits.cpp | 3 ++- src/qt/bitcoinunits.h | 3 ++- src/qt/clientmodel.cpp | 3 ++- src/qt/clientmodel.h | 3 ++- src/qt/coincontroldialog.cpp | 3 ++- src/qt/editaddressdialog.cpp | 3 ++- src/qt/guiconstants.h | 3 ++- src/qt/guiutil.cpp | 3 ++- src/qt/intro.cpp | 3 ++- src/qt/macnotificationhandler.mm | 3 ++- src/qt/openuridialog.cpp | 3 ++- src/qt/optionsmodel.cpp | 3 ++- src/qt/overviewpage.cpp | 3 ++- src/qt/paymentserver.cpp | 3 ++- src/qt/rpcconsole.cpp | 3 ++- src/qt/sendcoinsdialog.cpp | 3 ++- src/qt/sendcoinsentry.cpp | 3 ++- src/qt/signverifymessagedialog.cpp | 3 ++- src/qt/test/test_main.cpp | 3 ++- src/qt/transactiondesc.cpp | 3 ++- src/qt/transactionrecord.cpp | 3 ++- src/qt/utilitydialog.cpp | 3 ++- src/qt/vitae.cpp | 3 ++- src/qt/walletmodel.cpp | 3 ++- src/test/main_tests.cpp | 3 ++- src/test/netbase_tests.cpp | 3 ++- 38 files changed, 77 insertions(+), 40 deletions(-) diff --git a/src/core_read.cpp b/src/core_read.cpp index a41ae6caf..a43bc22ac 100755 --- a/src/core_read.cpp +++ b/src/core_read.cpp @@ -1,5 +1,6 @@ // Copyright (c) 2009-2014 The Bitcoin developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/miner.cpp b/src/miner.cpp index 49d32128b..47f391f19 100755 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -1,8 +1,8 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers -// Copyright (c) 2018 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018 - 2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -577,7 +577,7 @@ void VitaeMiner(CWallet* pwallet, bool fProofOfStake) continue; } - while (vNodes.empty() || pwallet->IsLocked() || !fMintableCoins || (pwallet->GetBalance() > 0 && + while (vNodes.empty() || pwallet->IsLocked() || !fMintableCoins || (pwallet->GetBalance() > 0 && nReserveBalance >= pwallet->GetBalance()) /*|| !masternodeSync.IsSynced()*/ || !fundamentalnodeSync.IsSynced()) { nLastCoinStakeSearchInterval = 0; // Do a separate 1 minute check here to ensure fMintableCoins is updated diff --git a/src/primitives/block.cpp b/src/primitives/block.cpp index aae692177..bb00f5611 100755 --- a/src/primitives/block.cpp +++ b/src/primitives/block.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/primitives/block.h b/src/primitives/block.h index 2a1929627..2597b5f98 100755 --- a/src/primitives/block.h +++ b/src/primitives/block.h @@ -1,6 +1,7 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2013 The Bitcoin developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp index 99a4ef1bc..f0af25065 100755 --- a/src/primitives/transaction.cpp +++ b/src/primitives/transaction.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index d078df5b6..a01ce9423 100755 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -1,6 +1,7 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2014 The Bitcoin developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index f3a762f64..5e4a98f04 100755 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index 2f689eecf..bb0dd0234 100755 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index d3797ac2e..d9ef6453d 100755 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/bip38tooldialog.cpp b/src/qt/bip38tooldialog.cpp index 25d2ff23e..d663a83b9 100755 --- a/src/qt/bip38tooldialog.cpp +++ b/src/qt/bip38tooldialog.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/bitcoinaddressvalidator.cpp b/src/qt/bitcoinaddressvalidator.cpp index 2b5a169e7..5f9145f12 100755 --- a/src/qt/bitcoinaddressvalidator.cpp +++ b/src/qt/bitcoinaddressvalidator.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 58ad4f590..ba29624ad 100755 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/bitcoinunits.cpp b/src/qt/bitcoinunits.cpp index 5c56ad236..01c08ec0f 100755 --- a/src/qt/bitcoinunits.cpp +++ b/src/qt/bitcoinunits.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/bitcoinunits.h b/src/qt/bitcoinunits.h index 09dc24332..506ef9522 100755 --- a/src/qt/bitcoinunits.h +++ b/src/qt/bitcoinunits.h @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 63276b8d6..691787596 100755 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index ecafdfce5..11078b1d2 100755 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index 1e769522e..654f815da 100755 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/editaddressdialog.cpp b/src/qt/editaddressdialog.cpp index f45e6cdb3..b368355bc 100755 --- a/src/qt/editaddressdialog.cpp +++ b/src/qt/editaddressdialog.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/guiconstants.h b/src/qt/guiconstants.h index 58b0f0356..dd4f60a78 100755 --- a/src/qt/guiconstants.h +++ b/src/qt/guiconstants.h @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index a5c8e1eb4..02b5fd2b8 100755 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index 455624cb7..23f524a20 100755 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/macnotificationhandler.mm b/src/qt/macnotificationhandler.mm index d6aeadb54..97b3485d0 100755 --- a/src/qt/macnotificationhandler.mm +++ b/src/qt/macnotificationhandler.mm @@ -1,5 +1,6 @@ // Copyright (c) 2011-2013 The Bitcoin Core developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/openuridialog.cpp b/src/qt/openuridialog.cpp index 0c2abebea..65738814b 100755 --- a/src/qt/openuridialog.cpp +++ b/src/qt/openuridialog.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 92f304acd..3fa399cc8 100755 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 0ce6c11c8..43c34f5ae 100755 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index a417f43e5..9dc7bb8c0 100755 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index a59782619..11e95bf68 100755 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 0674f730c..80c0a88b4 100755 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index f63183f6d..4740653b1 100755 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/signverifymessagedialog.cpp b/src/qt/signverifymessagedialog.cpp index 41543bdbf..167ddab63 100755 --- a/src/qt/signverifymessagedialog.cpp +++ b/src/qt/signverifymessagedialog.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index 9d7470d0f..169cfc37f 100755 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index b84fe5227..7cd7efa66 100755 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 43eafb5e9..68de7ac09 100755 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp index ac849165d..9fb4136a0 100755 --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/vitae.cpp b/src/qt/vitae.cpp index abfd64ea1..27fde18f4 100755 --- a/src/qt/vitae.cpp +++ b/src/qt/vitae.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index d72a2b005..9879372ad 100755 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2011-2014 The Bitcoin developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/test/main_tests.cpp b/src/test/main_tests.cpp index ca5a52cc6..6925636c1 100755 --- a/src/test/main_tests.cpp +++ b/src/test/main_tests.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2014 The Bitcoin Core developers // Copyright (c) 2014-2015 The Dash developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. diff --git a/src/test/netbase_tests.cpp b/src/test/netbase_tests.cpp index fa66fb642..a1a8e00ce 100755 --- a/src/test/netbase_tests.cpp +++ b/src/test/netbase_tests.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2012-2014 The Bitcoin Core developers // Copyright (c) 2014-2015 The Dash Core developers -// Copyright (c) 2015-2017 The VITAE developers +// Copyright (c) 2015-2017 The PIVX developers +// Copyright (c) 2018-2019 The VITAE developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. From c892bfefbf8dd420b882dd90cbc499c21d56644c Mon Sep 17 00:00:00 2001 From: Akshay CM Date: Sat, 5 Oct 2019 21:50:46 +0530 Subject: [PATCH 13/26] Fix compile error (#38) * Give error if pow phase is finished * Force Sync to allow for staking without mnsync * Fix error * Update rpcmisc.cpp * Update rpcmisc.cpp * more ignore * Update fundamentalnode-sync.cpp * Add gitian build python script * Update Univalue * add missing gencpp * Add missing includes * Fix Gitian build Update Univalue add missing gencpp Add missing includes * Revert "Update fundamentalnode-sync.cpp" This reverts commit 323b13fc599b03982b0ca7c3f32342537a6b992f * Fix gitian build and minor updates * remove forcesync * [Model] Invalid iterator position crash fix. * background loading crash fixed. * random: fix crash on some 64bit platforms rbx needs to be stashed in a 64bit register on 64bit platforms. With this crash in particular, it was holding a stack canary which was not properly restored after the cpuid. Split out the x86+PIC case so that x86_64 doesn't have to worry about it. * random: Add fallback if getrandom syscall not available If the code was compiled with newer (>=3.17) kernel headers but executed on a system without the system call, every use of random would crash the program. Add a fallback for that case. * Don't assert if we were beaten to the block A timing window exists where a wallet could be creating a new block from within the miner thread when a new block is received to the wallet. This window will create a situation where TestBlockValidity() fails because the chain tip has changed between the time it created the new block and the time it tested the validity of the block. This situation would result in the wallet being asserted; however this is a little overkill. rather than asserting if the tip has changed, it is better to throw the block away. This problem was revealed during a testnet test of an altcoin, and very prevalent when multiple wallet existed with the exact same number of staking coins received in the same transaction; or when multiple wallets were staking the same coins via import private key. The problem happens significantly less in more normal circumstances, but was still observed in a testing environment with fast blocks. It is likely that this scenario has been encountered but never determined to be root cause, as a crashed wallet could be restarted, re-indexed and never investigated further. * [Wallet] Add some LOCK to avoid crash Github-Pull: #625 Rebased-From: ed23d0d62054156e0c2cb632fecbd65588c50e8c * testnet mining fixes * fix placement of utxo signer * dont sign twice * prevent logging twice * random files updates * Add Chacha20 crypto files * Merge #643: [Crypto] Use stronger rand for key generation b7dda924cfc2405386968b0eaa32aa0e546f322c [Log] Replace a string by the function name in a log (warrows) 977f089d0d2883ca3ca1648b14423b738c9248ef [Refactor] Use arrays instead of unic vars in Chacha20 (warrows) d8abe323bd4f5cff3ca23fc00f0093ab7b143ead [Random] Add a missing include (warrows) 27663b8f16dfaac75bae1ab0e4a0c465b838c826 Do not permit copying FastRandomContexts (Pieter Wuille) 64e03e6de1a65c8d934d8df65af48e2b92bf887a Bugfix: randbytes should seed when needed (non reachable issue) (Pieter Wuille) e8f12aa3621e98588b82533edb56ed4865645862 Check if sys/random.h is required for getentropy on OSX. (James Hilliard) de85c7ae55681f8a9d322f4c48c6e9ba15ee0cf1 Add attribute [[noreturn]] (C++11) to functions that will not return (practicalswift) df46c7ff5a2e6a71ba636fa39d77f58e018816a6 Fix resource leak (Dag Robole) d426d856d23fe6c5d6ef3d57fe2c420b9a8e4e5e Clarify entropy source (Pieter Wuille) 30a320b3d12d3529dfca1daae0e477d76acd9ae7 Use cpuid intrinsics instead of asm code (Pieter Wuille) 0c21204e6dc714de6b917d9de12b1029d0bfb67b random: fix crash on some 64bit platforms (Cory Fields) b8bbb9c68d996b1bea579956b3c91872d6d94b8f Use rdrand as entropy source on supported platforms (Pieter Wuille) 8e19443e41f748ad54d0f8aa25907bdad0815c19 [Tests] Fix compilation (warrows) f53edec73901a91a6c4f595b248e4058e8be5468 [Rand/test] scripted-diff: Use new naming style for insecure_rand* functions (warrows) 272f3a5ac83ba0ab72a799ce524b6605b3555751 [Random / tests] scripted-diff: Use randbits/bool instead of randrange (warrows) 0173ee3332990ac1eea134cca5c21cc451b81d92 Replace rand() & ((1 << N) - 1) with randbits(N) (Pieter Wuille) 250de7426e8317f86fc25fe60e960c2e9e903b69 Replace more rand() % NUM by randranges (Pieter Wuille) d6904136030d94e844074fb75b9cafda46253ce0 [Random / tests] scripted-diff: use insecure_rand256/randrange more (warrows) 4a811ff9542439d43e3df3460114d9a24f849a36 Merge test_random.h into test_bitcoin.h (Pieter Wuille) f275e638bf0a752d9f231f2e4a781432deafbfe8 Add various insecure_rand wrappers for tests (Pieter Wuille) 602af4fb3ef45a2a821f1b76d0dbd418ec852683 Add FastRandomContext::rand256() and ::randbytes() (Pieter Wuille) 90549785824f4c13ee8cf36e77f737b5d89d0f02 Add perf counter data to GetStrongRandBytes state in scheduler (Matt Corallo) 17dd13e746b567f44015fbefaa634b278010fccf Add internal method to add new random data to our internal RNG state (Matt Corallo) c7a1602879aff2ae72bdefe959d4026ee8c0aefc Use sanity check timestamps as entropy (Pieter Wuille) f671fe99994cb220dede903459307c61475aeef8 Test that GetPerformanceCounter() increments (Pieter Wuille) dcb536fb2cef719abef9bb4104242410987bfd3d Use hardware timestamps in RNG seeding (Pieter Wuille) 7c3f290b50d32a3290a2c49542d72a3a7466da58 [Random] Fix compilation (warrows) 22b78957cc90252c958bc66439c098001d47b8fc random: only use getentropy on openbsd (Cory Fields) e5750e5c9831edf01026643deed249e0efb28f0b Add a FastRandomContext::randrange and use it (Pieter Wuille) 2a0f6cd1ca2224e2ba30aea4ab312a1919dedc0c Switch FastRandomContext to ChaCha20 (Pieter Wuille) 401ca7db468939184681b73f4b346aebcfc378c6 Introduce FastRandomContext::randbool() (Pieter Wuille) 3d056d6ed478c5bbd42d7dde4f1ab0a75ffd42b1 Add ChaCha20 (Pieter Wuille) 3c97f3f2cb1b3dc2f5d642877d9a2de0a85c06bf Kill insecure_random and associated global state (Wladimir J. van der Laan) 68ba16c78593bf221844dae95fc5edacbf69ba62 Maintain state across GetStrongRandBytes calls (Pieter Wuille) c3c399e199c2d25d10e782dca2ef17f55b6939d0 random: Add fallback if getrandom syscall not available (Wladimir J. van der Laan) 7a8111f915fc7ed23aaec86cd95904bf5d5972fd sanity: Move OS random to sanity check function (Wladimir J. van der Laan) 387c2e9574b56ae941b7723c561ed39488891782 squashme: comment that NUM_OS_RANDOM_BYTES should not be changed lightly (Wladimir J. van der Laan) 9e8c266b158c26b361d68a3cccdbcfd7bee0b376 util: Specific GetOSRandom for Linux/FreeBSD/OpenBSD (Wladimir J. van der Laan) f989b865f215c797e77483a04cc7fe9026904517 Don't use assert for catching randomness failures (Pieter Wuille) a15419e13204d96416b0cce9aad2ae4e35ea5ed5 Always require OS randomness when generating secret keys (Pieter Wuille) Pull request description: Since #576 hasn't changed in over a month, here is a reworked version of it. So in this PR: -We add the memory_cleanse function from upstream, to remove a number of OpenSSL calls. -We use OS randomness in addition to OpenSSL randomness (see #576 for why it's needed). ACKs for top commit: random-zebra: ACK https://github.com/PIVX-Project/PIVX/pull/643/commits/b7dda924cfc2405386968b0eaa32aa0e546f322c furszy: ACK [`b7dda92`](https://github.com/PIVX-Project/PIVX/commit/b7dda924cfc2405386968b0eaa32aa0e546f322c) Tree-SHA512: d92cbc14d844263ced753248e646f5cd4f03ec37546f50ff1b558fc3076b6d777c7efcb899c0400bc510e21311b5bd93d9aca26d811033fedb370f8457204035 * Revert "Merge #643: [Crypto] Use stronger rand for key generation" This reverts commit ae3e2562220577420e37a6367feeaa3cfedc67e9. * Revert "Add Chacha20 crypto files" This reverts commit ddd102fca86499062dac0ea3a40a8d8b26d039f5. * Revert "random files updates" This reverts commit f29e0844099487811d4f3c7af7f6d089adc2f6cf. * Revert "random: fix crash on some 64bit platforms" This reverts commit 5a5241452e1515fbd554ee99cc14e552fcb98051. * Revert "random: Add fallback if getrandom syscall not available" This reverts commit b46c1cb2b466f4bce60db364bf26f2cf791cdf38. * fix redeclaration * fix signing code * do not return in void func * remove unused funcs * remove on error * revert "Refactor miner" --- src/miner.cpp | 15 +--- src/qt/addresstablemodel.cpp | 22 ----- src/qt/askpassphrasedialog.cpp | 17 ---- src/random.cpp | 147 --------------------------------- 4 files changed, 3 insertions(+), 198 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 47f391f19..889d7ead3 100755 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -456,15 +456,6 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn, CWallet* pwallet, } pblock->nAccumulatorCheckpoint = nCheckpoint; pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]); - if (fProofOfStake) { - unsigned int nExtraNonce = 0; - IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); - LogPrintf("CPUMiner : proof-of-stake block found %s \n", pblock->GetHash().ToString().c_str()); - if (!SignBlock(*pblock, *pwallet)) { - LogPrintf("VitaeMiner(): Signing new block with UTXO key failed \n"); - return NULL; - } - } CValidationState state; if (!TestBlockValidity(state, *pblock, pindexPrev, false, false)) { LogPrintf("CreateNewBlock() : TestBlockValidity failed\n"); @@ -622,13 +613,13 @@ void VitaeMiner(CWallet* pwallet, bool fProofOfStake) //Stake miner main if (fProofOfStake) { + unsigned int nExtraNonce = 0; + IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); LogPrintf("CPUMiner : proof-of-stake block found %s \n", pblock->GetHash().ToString().c_str()); - if (!pblock->SignBlock(*pwallet)) { - LogPrintf("VitaeMiner(): Signing new block failed \n"); + LogPrintf("VitaeMiner(): Signing new block with UTXO key failed \n"); continue; } - LogPrintf("CPUMiner : proof-of-stake block was signed %s \n", pblock->GetHash().ToString().c_str()); SetThreadPriority(THREAD_PRIORITY_NORMAL); ProcessBlockFound(pblock, *pwallet, reservekey); diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index bb0dd0234..c99f2817c 100755 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -451,28 +451,6 @@ int AddressTableModel::lookupAddress(const QString& address) const } } -/** - * Return last created unused address --> TODO: complete "unused".. - * @return - */ -QString AddressTableModel::getLastUnusedAddress() const{ - LOCK(wallet->cs_wallet); - if(!wallet->mapAddressBook.empty()) { - for (std::map::iterator it = wallet->mapAddressBook.end(); it != wallet->mapAddressBook.begin(); --it) { - if(it != wallet->mapAddressBook.end()) { - if (it->second.purpose == "receive") { - const CBitcoinAddress &address = it->first; - bool fMine = IsMine(*wallet, address.Get()); - if (fMine) { - return QString::fromStdString(address.ToString()); - } - } - } - } - } - return QString(); -} - void AddressTableModel::emitDataChanged(int idx) { emit dataChanged(index(idx, 0, QModelIndex()), index(idx, columns.length() - 1, QModelIndex())); diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index d9ef6453d..63352c99b 100755 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -260,20 +260,3 @@ void AskPassphraseDialog::errorEncryptingWallet() { QMessageBox::critical(this, tr("Wallet encryption failed"), tr("Wallet encryption failed due to an internal error. Your wallet was not encrypted.")); } - -void AskPassphraseDialog::run(int type){ - if (type == 1) { - if (!newpassCache.empty()) { - if (model->setWalletEncrypted(true, newpassCache)) { - QMetaObject::invokeMethod(this, "warningMessage", Qt::QueuedConnection); - } else { - QMetaObject::invokeMethod(this, "errorEncryptingWallet", Qt::QueuedConnection); - } - newpassCache.clear(); - QDialog::accept(); // Success - } - } -} -void AskPassphraseDialog::onError(int type, QString error){ - newpassCache = ""; -} \ No newline at end of file diff --git a/src/random.cpp b/src/random.cpp index e5be6118a..c6f963e25 100755 --- a/src/random.cpp +++ b/src/random.cpp @@ -38,70 +38,6 @@ static inline int64_t GetPerformanceCounter() return nCounter; } - -#if defined(__x86_64__) || defined(__amd64__) || defined(__i386__) -static std::atomic hwrand_initialized{false}; -static bool rdrand_supported = false; -static constexpr uint32_t CPUID_F1_ECX_RDRAND = 0x40000000; -static void RDRandInit() -{ - uint32_t eax, ecx, edx; -#if defined(__i386__) && ( defined(__PIC__) || defined(__PIE__)) - // Avoid clobbering ebx, as that is used for PIC on x86. - uint32_t tmp; - __asm__ ("mov %%ebx, %1; cpuid; mov %1, %%ebx": "=a"(eax), "=g"(tmp), "=c"(ecx), "=d"(edx) : "a"(1)); -#else - uint32_t ebx; - __asm__ ("cpuid": "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) : "a"(1)); -#endif - //! When calling cpuid function #1, ecx register will have this set if RDRAND is available. - if (ecx & CPUID_F1_ECX_RDRAND) { - LogPrintf("Using RdRand as entropy source\n"); - rdrand_supported = true; - } - hwrand_initialized.store(true); -} -#else -static void RDRandInit() {} -#endif - -static bool GetHWRand(unsigned char* ent32) { -#if defined(__x86_64__) || defined(__amd64__) || defined(__i386__) - assert(hwrand_initialized.load(std::memory_order_relaxed)); - if (rdrand_supported) { - uint8_t ok; - // Not all assemblers support the rdrand instruction, write it in hex. -#ifdef __i386__ - for (int iter = 0; iter < 4; ++iter) { - uint32_t r1, r2; - __asm__ volatile (".byte 0x0f, 0xc7, 0xf0;" // rdrand %eax - ".byte 0x0f, 0xc7, 0xf2;" // rdrand %edx - "setc %2" : - "=a"(r1), "=d"(r2), "=q"(ok) :: "cc"); - if (!ok) return false; - WriteLE32(ent32 + 8 * iter, r1); - WriteLE32(ent32 + 8 * iter + 4, r2); - } -#else - uint64_t r1, r2, r3, r4; - __asm__ volatile (".byte 0x48, 0x0f, 0xc7, 0xf0, " // rdrand %rax - "0x48, 0x0f, 0xc7, 0xf3, " // rdrand %rbx - "0x48, 0x0f, 0xc7, 0xf1, " // rdrand %rcx - "0x48, 0x0f, 0xc7, 0xf2; " // rdrand %rdx - "setc %4" : - "=a"(r1), "=b"(r2), "=c"(r3), "=d"(r4), "=q"(ok) :: "cc"); - if (!ok) return false; - WriteLE64(ent32, r1); - WriteLE64(ent32 + 8, r2); - WriteLE64(ent32 + 16, r3); - WriteLE64(ent32 + 24, r4); -#endif - return true; - } -#endif - return false; -} - void RandAddSeed() { // Seed with CPU performance counter @@ -149,89 +85,6 @@ void RandAddSeedPerfmon() #endif } -#ifndef WIN32 -/** Fallback: get 32 bytes of system entropy from /dev/urandom. The most - * compatible way to get cryptographic randomness on UNIX-ish platforms. - */ -void GetDevURandom(unsigned char *ent32) -{ - int f = open("/dev/urandom", O_RDONLY); - if (f == -1) { - RandFailure(); - } - int have = 0; - do { - ssize_t n = read(f, ent32 + have, NUM_OS_RANDOM_BYTES - have); - if (n <= 0 || n + have > NUM_OS_RANDOM_BYTES) { - RandFailure(); - } - have += n; - } while (have < NUM_OS_RANDOM_BYTES); - close(f); -} -#endif - -/** Get 32 bytes of system entropy. */ -void GetOSRand(unsigned char *ent32) -{ -#if defined(WIN32) - HCRYPTPROV hProvider; - int ret = CryptAcquireContextW(&hProvider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT); - if (!ret) { - RandFailure(); - } - ret = CryptGenRandom(hProvider, NUM_OS_RANDOM_BYTES, ent32); - if (!ret) { - RandFailure(); - } - CryptReleaseContext(hProvider, 0); -#elif defined(HAVE_SYS_GETRANDOM) - /* Linux. From the getrandom(2) man page: - * "If the urandom source has been initialized, reads of up to 256 bytes - * will always return as many bytes as requested and will not be - * interrupted by signals." - */ - int rv = syscall(SYS_getrandom, ent32, NUM_OS_RANDOM_BYTES, 0); - if (rv != NUM_OS_RANDOM_BYTES) { - if (rv < 0 && errno == ENOSYS) { - /* Fallback for kernel <3.17: the return value will be -1 and errno - * ENOSYS if the syscall is not available, in that case fall back - * to /dev/urandom. - */ - GetDevURandom(ent32); - } else { - RandFailure(); - } - } -#elif defined(HAVE_GETENTROPY) - /* On OpenBSD this can return up to 256 bytes of entropy, will return an - * error if more are requested. - * The call cannot return less than the requested number of bytes. - */ - if (getentropy(ent32, NUM_OS_RANDOM_BYTES) != 0) { - RandFailure(); - } -#elif defined(HAVE_SYSCTL_ARND) - /* FreeBSD and similar. It is possible for the call to return less - * bytes than requested, so need to read in a loop. - */ - static const int name[2] = {CTL_KERN, KERN_ARND}; - int have = 0; - do { - size_t len = NUM_OS_RANDOM_BYTES - have; - if (sysctl(name, ARRAYLEN(name), ent32 + have, &len, NULL, 0) != 0) { - RandFailure(); - } - have += len; - } while (have < NUM_OS_RANDOM_BYTES); -#else - /* Fall back to /dev/urandom if there is no specific method implemented to - * get system entropy for this OS. - */ - GetDevURandom(ent32); -#endif -} - void GetRandBytes(unsigned char* buf, int num) { if (RAND_bytes(buf, num) != 1) { From f0f780b0b84a45bac4265703b2997b441c3073b9 Mon Sep 17 00:00:00 2001 From: Akshay CM Date: Mon, 7 Oct 2019 10:03:46 +0530 Subject: [PATCH 14/26] Fix name collision + mac crashes (#39) * Give error if pow phase is finished * Force Sync to allow for staking without mnsync * Fix error * Update rpcmisc.cpp * Update rpcmisc.cpp * more ignore * Update fundamentalnode-sync.cpp * Add gitian build python script * Update Univalue * add missing gencpp * Add missing includes * Fix Gitian build Update Univalue add missing gencpp Add missing includes * Revert "Update fundamentalnode-sync.cpp" This reverts commit 323b13fc599b03982b0ca7c3f32342537a6b992f * Fix gitian build and minor updates * remove forcesync * [Model] Invalid iterator position crash fix. * background loading crash fixed. * random: fix crash on some 64bit platforms rbx needs to be stashed in a 64bit register on 64bit platforms. With this crash in particular, it was holding a stack canary which was not properly restored after the cpuid. Split out the x86+PIC case so that x86_64 doesn't have to worry about it. * random: Add fallback if getrandom syscall not available If the code was compiled with newer (>=3.17) kernel headers but executed on a system without the system call, every use of random would crash the program. Add a fallback for that case. * Don't assert if we were beaten to the block A timing window exists where a wallet could be creating a new block from within the miner thread when a new block is received to the wallet. This window will create a situation where TestBlockValidity() fails because the chain tip has changed between the time it created the new block and the time it tested the validity of the block. This situation would result in the wallet being asserted; however this is a little overkill. rather than asserting if the tip has changed, it is better to throw the block away. This problem was revealed during a testnet test of an altcoin, and very prevalent when multiple wallet existed with the exact same number of staking coins received in the same transaction; or when multiple wallets were staking the same coins via import private key. The problem happens significantly less in more normal circumstances, but was still observed in a testing environment with fast blocks. It is likely that this scenario has been encountered but never determined to be root cause, as a crashed wallet could be restarted, re-indexed and never investigated further. * [Wallet] Add some LOCK to avoid crash Github-Pull: #625 Rebased-From: ed23d0d62054156e0c2cb632fecbd65588c50e8c * testnet mining fixes * fix placement of utxo signer * dont sign twice * prevent logging twice * random files updates * Add Chacha20 crypto files * Merge #643: [Crypto] Use stronger rand for key generation b7dda924cfc2405386968b0eaa32aa0e546f322c [Log] Replace a string by the function name in a log (warrows) 977f089d0d2883ca3ca1648b14423b738c9248ef [Refactor] Use arrays instead of unic vars in Chacha20 (warrows) d8abe323bd4f5cff3ca23fc00f0093ab7b143ead [Random] Add a missing include (warrows) 27663b8f16dfaac75bae1ab0e4a0c465b838c826 Do not permit copying FastRandomContexts (Pieter Wuille) 64e03e6de1a65c8d934d8df65af48e2b92bf887a Bugfix: randbytes should seed when needed (non reachable issue) (Pieter Wuille) e8f12aa3621e98588b82533edb56ed4865645862 Check if sys/random.h is required for getentropy on OSX. (James Hilliard) de85c7ae55681f8a9d322f4c48c6e9ba15ee0cf1 Add attribute [[noreturn]] (C++11) to functions that will not return (practicalswift) df46c7ff5a2e6a71ba636fa39d77f58e018816a6 Fix resource leak (Dag Robole) d426d856d23fe6c5d6ef3d57fe2c420b9a8e4e5e Clarify entropy source (Pieter Wuille) 30a320b3d12d3529dfca1daae0e477d76acd9ae7 Use cpuid intrinsics instead of asm code (Pieter Wuille) 0c21204e6dc714de6b917d9de12b1029d0bfb67b random: fix crash on some 64bit platforms (Cory Fields) b8bbb9c68d996b1bea579956b3c91872d6d94b8f Use rdrand as entropy source on supported platforms (Pieter Wuille) 8e19443e41f748ad54d0f8aa25907bdad0815c19 [Tests] Fix compilation (warrows) f53edec73901a91a6c4f595b248e4058e8be5468 [Rand/test] scripted-diff: Use new naming style for insecure_rand* functions (warrows) 272f3a5ac83ba0ab72a799ce524b6605b3555751 [Random / tests] scripted-diff: Use randbits/bool instead of randrange (warrows) 0173ee3332990ac1eea134cca5c21cc451b81d92 Replace rand() & ((1 << N) - 1) with randbits(N) (Pieter Wuille) 250de7426e8317f86fc25fe60e960c2e9e903b69 Replace more rand() % NUM by randranges (Pieter Wuille) d6904136030d94e844074fb75b9cafda46253ce0 [Random / tests] scripted-diff: use insecure_rand256/randrange more (warrows) 4a811ff9542439d43e3df3460114d9a24f849a36 Merge test_random.h into test_bitcoin.h (Pieter Wuille) f275e638bf0a752d9f231f2e4a781432deafbfe8 Add various insecure_rand wrappers for tests (Pieter Wuille) 602af4fb3ef45a2a821f1b76d0dbd418ec852683 Add FastRandomContext::rand256() and ::randbytes() (Pieter Wuille) 90549785824f4c13ee8cf36e77f737b5d89d0f02 Add perf counter data to GetStrongRandBytes state in scheduler (Matt Corallo) 17dd13e746b567f44015fbefaa634b278010fccf Add internal method to add new random data to our internal RNG state (Matt Corallo) c7a1602879aff2ae72bdefe959d4026ee8c0aefc Use sanity check timestamps as entropy (Pieter Wuille) f671fe99994cb220dede903459307c61475aeef8 Test that GetPerformanceCounter() increments (Pieter Wuille) dcb536fb2cef719abef9bb4104242410987bfd3d Use hardware timestamps in RNG seeding (Pieter Wuille) 7c3f290b50d32a3290a2c49542d72a3a7466da58 [Random] Fix compilation (warrows) 22b78957cc90252c958bc66439c098001d47b8fc random: only use getentropy on openbsd (Cory Fields) e5750e5c9831edf01026643deed249e0efb28f0b Add a FastRandomContext::randrange and use it (Pieter Wuille) 2a0f6cd1ca2224e2ba30aea4ab312a1919dedc0c Switch FastRandomContext to ChaCha20 (Pieter Wuille) 401ca7db468939184681b73f4b346aebcfc378c6 Introduce FastRandomContext::randbool() (Pieter Wuille) 3d056d6ed478c5bbd42d7dde4f1ab0a75ffd42b1 Add ChaCha20 (Pieter Wuille) 3c97f3f2cb1b3dc2f5d642877d9a2de0a85c06bf Kill insecure_random and associated global state (Wladimir J. van der Laan) 68ba16c78593bf221844dae95fc5edacbf69ba62 Maintain state across GetStrongRandBytes calls (Pieter Wuille) c3c399e199c2d25d10e782dca2ef17f55b6939d0 random: Add fallback if getrandom syscall not available (Wladimir J. van der Laan) 7a8111f915fc7ed23aaec86cd95904bf5d5972fd sanity: Move OS random to sanity check function (Wladimir J. van der Laan) 387c2e9574b56ae941b7723c561ed39488891782 squashme: comment that NUM_OS_RANDOM_BYTES should not be changed lightly (Wladimir J. van der Laan) 9e8c266b158c26b361d68a3cccdbcfd7bee0b376 util: Specific GetOSRandom for Linux/FreeBSD/OpenBSD (Wladimir J. van der Laan) f989b865f215c797e77483a04cc7fe9026904517 Don't use assert for catching randomness failures (Pieter Wuille) a15419e13204d96416b0cce9aad2ae4e35ea5ed5 Always require OS randomness when generating secret keys (Pieter Wuille) Pull request description: Since #576 hasn't changed in over a month, here is a reworked version of it. So in this PR: -We add the memory_cleanse function from upstream, to remove a number of OpenSSL calls. -We use OS randomness in addition to OpenSSL randomness (see #576 for why it's needed). ACKs for top commit: random-zebra: ACK https://github.com/PIVX-Project/PIVX/pull/643/commits/b7dda924cfc2405386968b0eaa32aa0e546f322c furszy: ACK [`b7dda92`](https://github.com/PIVX-Project/PIVX/commit/b7dda924cfc2405386968b0eaa32aa0e546f322c) Tree-SHA512: d92cbc14d844263ced753248e646f5cd4f03ec37546f50ff1b558fc3076b6d777c7efcb899c0400bc510e21311b5bd93d9aca26d811033fedb370f8457204035 * Revert "Merge #643: [Crypto] Use stronger rand for key generation" This reverts commit ae3e2562220577420e37a6367feeaa3cfedc67e9. * Revert "Add Chacha20 crypto files" This reverts commit ddd102fca86499062dac0ea3a40a8d8b26d039f5. * Revert "random files updates" This reverts commit f29e0844099487811d4f3c7af7f6d089adc2f6cf. * Revert "random: fix crash on some 64bit platforms" This reverts commit 5a5241452e1515fbd554ee99cc14e552fcb98051. * Revert "random: Add fallback if getrandom syscall not available" This reverts commit b46c1cb2b466f4bce60db364bf26f2cf791cdf38. * fix redeclaration * fix signing code * do not return in void func * remove unused funcs * remove on error * revert "Refactor miner" * fix repeat of masternode in fundamental node payment log * fix name collision * [Wallet] Look at last CoinsView block for corruption fix process * Fix crashes * Merge #941: [Refactor] Move ThreadStakeMinter out of net.cpp 42fe4040acff08450168416ccf35413abdc1747a [Refactor] Move ThreadStakeMinter out of net.cpp (Fuzzbawls) Pull request description: This moves the implementation function and thread creation to a more appropriate file (`miner.cpp`). Resolves #938 ACKs for top commit: CaveSpectre11: ACK https://github.com/PIVX-Project/PIVX/commit/42fe4040acff08450168416ccf35413abdc1747a random-zebra: ACK https://github.com/PIVX-Project/PIVX/pull/941/commits/42fe4040acff08450168416ccf35413abdc1747a furszy: utACK [42fe404](https://github.com/PIVX-Project/PIVX/pull/941/commits/42fe4040acff08450168416ccf35413abdc1747a) Tree-SHA512: d3417f03cab63aa41b1ff0fb4d391d42f4448b83efe70391d4014407008af34eb265a23b5807ebecb90cf9637fb74e5b330b02c92e7038e5400a5f16608800ee * Merge #865: [Main] Don't return an invalid state when shutting down the wallet 8126729 Don't return an invalid state when shutting down the wallet (Fuzzbawls) Tree-SHA512: b7042df42af620faca5d415382ad0a6ae973e9dbad7e527957c2ac3c7d0cb5470fcca555b3fe262f5f06e334504ded657db879c2471ecc290247e0f7e2bbf5f3 * Merge #958: [Staking] Modify miner and staking thread for efficiency b7a9a9cdb20cdee869906fb24e2bc984e8a93802 [Staking] Modify miner and staking thread for efficency (Cave Spectre) Pull request description: ### **Release notes** - [Mining] Unnecessary mining threads now exit after PoS has begun - [Staking] The staking thread dormancy is more efficient during PoW - [Performance] Some unnecessary processing in the mining thread removed - [RPC] setgenerate errors if attempted to turn on after end of PoW - [Build] Wallet only routines conditionalized in miner.h - [Refactoring] Log messages with bitcoin named routines changed for easier rename of routines in the future. In order to better explain the changes in this PR, a review of the existing code would be helpful. ### **Backstory** When fixing a PIVX forked coin's transition from PoW to PoS, it was observed that mining threads go into tight infinite loops after the switch to proof of stake. This can be seen with a simple `pivx-qt -testnet -gen`, and watching the debug log. This observation triggered the below code review (re-written for the current release; some of the findings in the code originally reviewed had already been addressed in PIVX). ### **Code Review** _BitcoinMiner()_ This routine is a worker routine for both staking and mining threads; fProofOfStake is set to true when running in the staking thread, false when running in the mining thread. fGeneratedBitcoins is set when mining is started; and cleared on shutdown or when mining is stopped. _In the initial fProofOfStake section:_ ``` if ((GetTime() - nMintableLastCheck > 5 * 60)) // 5 minute check time { nMintableLastCheck = GetTime(); fMintableCoins = pwallet->MintableCoins(); } if (chainActive.Tip()->nHeight < Params().LAST_POW_BLOCK()) { MilliSleep(5000); continue; } ``` Every 5 minutes this code will scan through the wallet and look to see if mintable coins exist. After it's done that, it checks if the network is still in the proof of work phase. It doesn't make sense to scan the wallet until after the proof of work phase is ending. If it is in the proof of work phase; the staking thread sleeps for 5 seconds (`MilliSleep(5000)`). This only makes sense if the block time is 5 seconds. Technically the thread could determine the number of blocks remaining in the proof of work phase, and use that to calculate a hibernation of sorts. Using the target spacing to wait for the block to pass is a 91% reduction in the number of passes through the loop (12 vs. 1 when the target spacing is one minute), and doesn't run into issues where adjustments to the actual spacing throw the timing of a hibernation off. ``` if (!fMintableCoins) { if (GetTime() - nMintableLastCheck > 1 * 60) // 1 minute check time { nMintableLastCheck = GetTime(); fMintableCoins = pwallet->MintableCoins(); } } MilliSleep(5000); ``` We come to this section of code in the waiting while loop; if we don't have mintable coins yet, or our wallet is locked, or we're not synched; or a host of other potential things that would prevent staking. However, we check again for mintable coins; and then we wait 5 seconds after that check before we come out. Since the first time we come into this loop; we have already checked mintable coins (within the last 5 minutes); we should sleep first, and then do the check closer to the time we're actually going to go around the loop again; so we're working with the most recent data. ``` if (!fGenerateBitcoins && !fProofOfStake) continue; ``` This check is buried in a `if (fProofOfStake)` conditional, where fProofOfStake is a parameter that is passed in by the caller to BitcoinMiner(). `!fProofOfStake` will never be true; so this condition will never be true. Removing it we are left with !fGenerateBitcoins; which is unrelated to this section of code anyway. If we're down to this point, we're not in PoW mode anymore, so there shouldn't be a mining thread (more on that later). But the most compelling part of this condition,whether it passes or not, is that it "continues" the while loop it's in; and since it's at the end of the actual while loop, it's going to iterate into another round of the while loop as soon as it finishes with this conditional anyway. Long story short; the code doesn't do anything. _Overall logic_ The mining thread will run until mining is turned off (`setgenerate false`, or the mining flags taken off the invocation). However, there is no need to continue to mine with proof of work after the proof of stake phase begins. In fact, there really is no consideration of that at all; PoW will continue to try to generate blocks well after PoS has begun. Yes, it's within the users control to stop mining; but it's within the power of the code to take care of that for the user, and stop the mining thread(s) after the transition to proof of stake. ### **This PR:** The logical issues above have been corrected. The dormancy for the proof of stake thread is held for just one block rather than any extreme hibernation. Combined with moving that code to be the first thing in the while loop; it also removes the processing done to search through the wallets looking for stakeable coins. Since a significant amount of code assumes there will not be a transition from PoS to PoW; code was added to BitcoinMiner() to exit the mining threads if it's transitioned into the PoS phase. The threads will continue for a little bit, in case there is any rewind on the chain; but after 6 PoS blocks are accepted, the miner threads will exit. To prevent the PoW thread from trying to generate blocks after the PoS phase has begun, logic was added in CreateNewBlockWithKey() to return quickly. Rather than create a situation where the mining thread ends up in a tight loop in the initial phases of PoS, the mining thread will be held for 1/2 of the target spacing before returning. Lastly; Some tweaks were made to the logging; removing hardcoded references to "BitcoinMiner()", in case refactoring in the future changes the name of the routine. Similarly, since there is a log message when the mining thread starts "PIVXMiner started"; rather than reporting thread exits or errors as "ThreadBitcoinMiner", they have been changed to PIVXMiner to match. Much of this can be observed with an errant `pivx-qt -gen`. With this PR, it simply tries to start the miner, and then exits. _With PR code - `pivx-qt -gen -testnet`_ ``` 2019-07-21 20:04:22 PIVXMiner started 2019-07-21 20:04:22 BitcoinMiner: Exiting Proof of Work Mining Thread at height: 1160732 2019-07-21 20:04:22 PIVXMiner exiting ``` _Current release:_ ``` 2019-07-21 19:37:06 CreateNewBlock(): total size 1000 2019-07-21 19:37:06 ERROR: CheckProofOfWork() : hash doesn't match nBits 2019-07-21 19:37:06 ERROR: CheckBlockHeader() : proof of work failed 2019-07-21 19:37:06 ERROR: CheckBlock() : CheckBlockHeader failed 2019-07-21 19:37:06 CreateNewBlock() : TestBlockValidity failed ``` is repeated in a tight loop. ACKs for top commit: furszy: ACK [b7a9a9c](https://github.com/PIVX-Project/PIVX/commit/b7a9a9cdb20cdee869906fb24e2bc984e8a93802) random-zebra: ACK https://github.com/PIVX-Project/PIVX/pull/958/commits/b7a9a9cdb20cdee869906fb24e2bc984e8a93802 and merging... Tree-SHA512: 064619ce1fde75f1baf35ddb202b4573f2a8c0effc5d2939a678612e3f1d56b08d5c5d7c7bb30ce919e5a648f3f406cca35093b9a3a04c799f746fff5c6a35b6 * remove duplicate stake thread code * add missing include * remove zvitae pos validator * Refine signblock code * revert zerocoin added check * Miner reference updates * revert miner changes * fix fundamentalnode sync checker * [Refactor] Move rpc files to its own folder * update includes * fix rpcserver include to rpc/server.h * [Refactor] Move wallet files to wallet dir * [Trivial] Fix db.h path * Merge #982: [Miner] Don't create new keys when generating PoS blocks 74e7fc7d432c7f6d586d54ff276d6babad0fe505 [Miner] Don't create new keys when generating PoS blocks (random-zebra) Pull request description: This fixes the calls to `CreateNewBlockWithKey` with PoS blocks, which are not needed. We simply call `CreateNewBlock` with an empy script for coinbase. It should prevent the problem described in https://github.com/PIVX-Project/PIVX/pull/956#issuecomment-520166966 ACKs for top commit: CaveSpectre11: utACK https://github.com/PIVX-Project/PIVX/pull/982/commits/74e7fc7d432c7f6d586d54ff276d6babad0fe505 akshaynexus: utACK https://github.com/PIVX-Project/PIVX/commit/74e7fc7d432c7f6d586d54ff276d6babad0fe505 furszy: utACK [74e7fc7](https://github.com/PIVX-Project/PIVX/pull/982/commits/74e7fc7d432c7f6d586d54ff276d6babad0fe505) Warrows: Pretty straightforward indeed, utACK 74e7fc7 Tree-SHA512: bcb9752a689a058b6c33317136d16afd694b5da66c69cdd32a8b89b71059c5b2c5dc20c88045c52429fae99d45f508ea223f1b7d1afa5db3c77eb59befd48d51 * Merge #549: [Crypto] Switch to libsecp256k1 signature verification and update the lib f10439c [Crypto] Add ctx initialisation for bip38 (warrows) 21234db [Crypto] Bring back function CKey.SetPrivKey for zPIV (warrows) 65e009a [Tests] Add new auto generated script tests (warrows) 6839f3b [Crypto] Switch from openssl to secp256k1 for consensus (warrows) 8a901f9 Squashed 'src/secp256k1/' content from commit 452d8e4d2 (warrows) d98a584 [Refactor] Delete secp256k1 folder for subtreefication (warrows) Tree-SHA512: f0f6777be57777ba86f83af1b891a6c0f384e6b059afc9249599269c71e5d3bf46a6498325488878af71b6685c6dac6cb672d0147c2ebf43b36f6d786fc38a10 * fix keystore refs * update libscepk265k1 * [RPC/REST] Migrate to libevent based httpd server * fix mempooltojson and misc erroros * Merge #769: [Main] Unify shutdown proceedure in init rather than per-app 518542f [Main] Unify shutdown proceedure in init rather than per-app (Fuzzbawls) Tree-SHA512: 6e734ce002e236c3c2c59c2e8e93d87f5fe577b3f5546804b117a71255266cc4012d847d6a1d9b019a7b763124b45987c2dc3f95294670489cac269beceb2e3a * Merge #542: [Network] Remove vfReachable and modify IsReachable to only use vfLimited. 38ed737 Remove vfReachable and modify IsReachable to only use vfLimited. (Patrick Strateman) Tree-SHA512: 8aa61f9abd8356522f3ba71b35497aac07e10333a39ff4b98bb635d1246e6b1be6b0ee0b236944fbfaa558af0e6c0cc219e540eacb2232bc05db393e4a72b088 * [Refactor] Refactor bignum header file into several files * [zerocoin] Free memory from ToString() Simple fix for a minor memory leak * Revert "[Refactor] Refactor bignum header file into several files" This reverts commit c9aa98fe451e27d2bb4564747ffb0768cce56d53. --- configure.ac | 2 +- contrib/debian/examples/vitae.conf | 22 +- contrib/debian/manpages/pivx-qt.1 | 13 - contrib/debian/manpages/pivx.conf.5 | 11 - contrib/debian/manpages/pivxd.1 | 15 - contrib/pivxd.bash-completion | 2 +- doc/REST-interface.md | 85 +- src/Makefile.am | 62 +- src/activefundamentalnode.h | 2 +- src/activemasternode.h | 2 +- src/arith_uint256.cpp | 316 -- src/arith_uint256.h | 334 -- src/bip38.cpp | 44 +- src/config/vitae-config.h.in | 10 +- src/eccryptoverify.cpp | 69 - src/eccryptoverify.h | 21 - src/ecwrapper.cpp | 262 - src/ecwrapper.h | 41 - src/fundamentalnode-payments.cpp | 2 +- src/hash.cpp | 4 +- src/hash.h | 10 +- src/httprpc.cpp | 193 + src/httprpc.h | 37 + src/httpserver.cpp | 668 +++ src/httpserver.h | 149 + src/init.cpp | 133 +- src/init.h | 4 +- src/kernel.cpp | 2 +- src/key.cpp | 299 +- src/key.h | 103 +- src/keystore.cpp | 36 + src/keystore.h | 38 +- src/main.cpp | 17 +- src/main.h | 1 - src/miner.cpp | 123 +- src/miner.h | 13 +- src/net.cpp | 37 +- src/net.h | 1 - src/primitives/block.cpp | 102 +- src/primitives/block.h | 5 +- src/pubkey.cpp | 325 +- src/pubkey.h | 111 +- src/qt/addresstablemodel.cpp | 2 +- src/qt/bip38tooldialog.cpp | 2 +- src/qt/coincontroldialog.cpp | 2 +- src/qt/forms/privacydialog.ui | 4 +- src/qt/fundamentalnodelist.cpp | 2 +- src/qt/masternodelist.cpp | 2 +- src/qt/multisigdialog.cpp | 2 +- src/qt/optionsdialog.cpp | 2 +- src/qt/optionsmodel.cpp | 4 +- src/qt/paymentserver.cpp | 2 +- src/qt/rpcconsole.cpp | 43 +- src/qt/rpcconsole.h | 2 + src/qt/sendcoinsdialog.cpp | 2 +- src/qt/signverifymessagedialog.cpp | 2 +- src/qt/splashscreen.cpp | 2 +- src/qt/test/test_main.cpp | 4 + src/qt/transactiondesc.cpp | 4 +- src/qt/transactionrecord.cpp | 2 +- src/qt/transactiontablemodel.cpp | 2 +- src/qt/vitae.cpp | 23 +- src/qt/walletmodel.cpp | 6 +- src/qt/walletmodel.h | 2 +- src/qt/walletmodeltransaction.cpp | 2 +- src/rest.cpp | 533 +- src/{rpcblockchain.cpp => rpc/blockchain.cpp} | 168 +- src/{rpcclient.cpp => rpc/client.cpp} | 4 +- src/{rpcclient.h => rpc/client.h} | 0 src/{rpcdump.cpp => rpc/dump.cpp} | 18 +- .../fundamentalnode-budget.cpp} | 4 +- .../fundamentalnode.cpp} | 6 +- .../masternode-budget.cpp} | 6 +- src/{rpcmasternode.cpp => rpc/masternode.cpp} | 6 +- src/{rpcmining.cpp => rpc/mining.cpp} | 17 +- src/{rpcmisc.cpp => rpc/misc.cpp} | 28 +- src/{rpcnet.cpp => rpc/net.cpp} | 12 +- src/rpc/protocol.cpp | 130 + src/rpc/protocol.h | 94 + .../rawtransaction.cpp} | 20 +- src/{rpcserver.cpp => rpc/server.cpp} | 622 +-- src/{rpcserver.h => rpc/server.h} | 94 +- src/{rpcwallet.cpp => rpc/wallet.cpp} | 100 +- src/rpcprotocol.cpp | 360 -- src/rpcprotocol.h | 173 - src/script/bitcoinconsensus.cpp | 7 + src/script/interpreter.cpp | 10 +- src/script/sigcache.cpp | 4 +- src/secp256k1/.gitignore | 27 +- src/secp256k1/.travis.yml | 78 +- src/secp256k1/COPYING | 0 src/secp256k1/Makefile.am | 148 +- src/secp256k1/README.md | 22 +- src/secp256k1/TODO | 0 src/secp256k1/build-aux/m4/ax_boost_base.m4 | 281 - src/secp256k1/build-aux/m4/ax_boost_chrono.m4 | 119 - .../build-aux/m4/ax_boost_filesystem.m4 | 119 - .../build-aux/m4/ax_boost_program_options.m4 | 109 - src/secp256k1/build-aux/m4/ax_boost_system.m4 | 121 - src/secp256k1/build-aux/m4/ax_boost_thread.m4 | 150 - .../m4/ax_boost_unit_test_framework.m4 | 138 - .../build-aux/m4/ax_check_compile_flag.m4 | 72 - .../build-aux/m4/ax_check_link_flag.m4 | 71 - .../build-aux/m4/ax_check_preproc_flag.m4 | 72 - .../build-aux/m4/ax_cxx_compile_stdcxx.m4 | 562 -- .../build-aux/m4/ax_gcc_func_attribute.m4 | 217 - .../build-aux/m4/ax_jni_include_dir.m4 | 145 + .../build-aux/m4/ax_prog_cc_for_build.m4 | 125 + src/secp256k1/build-aux/m4/ax_pthread.m4 | 332 -- .../build-aux/m4/bitcoin_find_bdb48.m4 | 66 - src/secp256k1/build-aux/m4/bitcoin_qt.m4 | 512 -- src/secp256k1/build-aux/m4/bitcoin_secp.m4 | 68 + .../build-aux/m4/bitcoin_subdir_to_include.m4 | 14 - src/secp256k1/configure.ac | 326 +- src/secp256k1/contrib/lax_der_parsing.c | 150 + src/secp256k1/contrib/lax_der_parsing.h | 91 + .../contrib/lax_der_privatekey_parsing.c | 113 + .../contrib/lax_der_privatekey_parsing.h | 90 + src/secp256k1/include/secp256k1.h | 746 ++- src/secp256k1/include/secp256k1_ecdh.h | 55 + src/secp256k1/include/secp256k1_recovery.h | 110 + src/secp256k1/libsecp256k1.pc.in | 2 +- src/secp256k1/nasm_lt.sh | 57 - src/secp256k1/obj/.gitignore | 0 src/secp256k1/sage/group_prover.sage | 322 ++ src/secp256k1/sage/secp256k1.sage | 306 + src/secp256k1/sage/weierstrass_prover.sage | 264 + src/secp256k1/src/asm/field_10x26_arm.s | 919 +++ src/secp256k1/src/basic-config.h | 33 + src/secp256k1/src/bench.h | 82 + src/secp256k1/src/bench_ecdh.c | 54 + src/secp256k1/src/bench_ecmult.c | 196 + src/secp256k1/src/bench_internal.c | 367 ++ src/secp256k1/src/bench_inv.c | 41 - src/secp256k1/src/bench_recover.c | 60 + src/secp256k1/src/bench_sign.c | 67 +- src/secp256k1/src/bench_verify.c | 112 +- src/secp256k1/src/ecdsa.h | 26 +- src/secp256k1/src/ecdsa_impl.h | 384 +- src/secp256k1/src/eckey.h | 25 +- src/secp256k1/src/eckey_impl.h | 161 +- src/secp256k1/src/ecmult.h | 42 +- src/secp256k1/src/ecmult_const.h | 17 + src/secp256k1/src/ecmult_const_impl.h | 257 + src/secp256k1/src/ecmult_gen.h | 36 +- src/secp256k1/src/ecmult_gen_impl.h | 229 +- src/secp256k1/src/ecmult_impl.h | 1074 +++- src/secp256k1/src/field.h | 106 +- src/secp256k1/src/field_10x26.h | 33 +- src/secp256k1/src/field_10x26_impl.h | 462 +- src/secp256k1/src/field_5x52.h | 32 +- src/secp256k1/src/field_5x52_asm.asm | 469 -- src/secp256k1/src/field_5x52_asm_impl.h | 501 +- src/secp256k1/src/field_5x52_impl.h | 338 +- src/secp256k1/src/field_5x52_int128_impl.h | 134 +- src/secp256k1/src/field_gmp_impl.h | 180 - src/secp256k1/src/field_impl.h | 322 +- src/secp256k1/src/gen_context.c | 74 + src/secp256k1/src/group.h | 147 +- src/secp256k1/src/group_impl.h | 715 ++- src/secp256k1/src/hash.h | 41 + src/secp256k1/src/hash_impl.h | 282 + .../src/java/org/bitcoin/NativeSecp256k1.java | 440 +- .../java/org/bitcoin/NativeSecp256k1Test.java | 226 + .../java/org/bitcoin/NativeSecp256k1Util.java | 45 + .../java/org/bitcoin/Secp256k1Context.java | 51 + .../src/java/org_bitcoin_NativeSecp256k1.c | 380 +- .../src/java/org_bitcoin_NativeSecp256k1.h | 104 +- .../src/java/org_bitcoin_Secp256k1Context.c | 15 + .../src/java/org_bitcoin_Secp256k1Context.h | 22 + .../src/modules/ecdh/Makefile.am.include | 8 + src/secp256k1/src/modules/ecdh/main_impl.h | 67 + src/secp256k1/src/modules/ecdh/tests_impl.h | 132 + .../src/modules/recovery/Makefile.am.include | 8 + .../src/modules/recovery/main_impl.h | 193 + .../src/modules/recovery/tests_impl.h | 393 ++ src/secp256k1/src/num.h | 40 +- src/secp256k1/src/num_gmp.h | 8 +- src/secp256k1/src/num_gmp_impl.h | 148 +- src/secp256k1/src/num_impl.h | 6 +- src/secp256k1/src/scalar.h | 72 +- src/secp256k1/src/scalar_4x64.h | 10 +- src/secp256k1/src/scalar_4x64_impl.h | 638 ++- src/secp256k1/src/scalar_8x32.h | 10 +- src/secp256k1/src/scalar_8x32_impl.h | 179 +- src/secp256k1/src/scalar_impl.h | 497 +- .../src/{field_gmp.h => scalar_low.h} | 17 +- src/secp256k1/src/scalar_low_impl.h | 114 + src/secp256k1/src/scratch.h | 39 + src/secp256k1/src/scratch_impl.h | 86 + src/secp256k1/src/secp256k1.c | 701 ++- src/secp256k1/src/testrand.h | 24 +- src/secp256k1/src/testrand_impl.h | 114 +- src/secp256k1/src/tests.c | 4943 +++++++++++++++-- src/secp256k1/src/tests_exhaustive.c | 511 ++ src/secp256k1/src/util.h | 64 +- src/serialize.h | 12 +- src/sync.h | 11 + src/test/accounting_tests.cpp | 4 +- src/test/data/script_invalid.json | 44 + src/test/data/script_valid.json | 32 + src/test/multisig_tests.cpp | 2 +- src/test/rpc_tests.cpp | 20 +- src/test/rpc_wallet_tests.cpp | 6 +- src/test/script_P2SH_tests.cpp | 2 +- src/test/test_vitae.cpp | 4 +- src/test/wallet_tests.cpp | 2 +- src/test/zerocoin_denomination_tests.cpp | 4 +- src/test/zerocoin_transactions_tests.cpp | 4 +- src/torcontrol.cpp | 10 +- src/uint256.h | 8 +- src/uint512.h | 6 +- src/util.cpp | 12 + src/util.h | 1 + src/vitae-cli.cpp | 146 +- src/vitae-tx.cpp | 18 +- src/vitaed.cpp | 34 +- src/{ => wallet}/db.cpp | 2 +- src/{ => wallet}/db.h | 0 src/{ => wallet}/wallet.cpp | 23 +- src/{ => wallet}/wallet.h | 4 +- src/{ => wallet}/wallet_ismine.cpp | 2 +- src/{ => wallet}/wallet_ismine.h | 0 src/{ => wallet}/walletdb.cpp | 6 +- src/{ => wallet}/walletdb.h | 2 +- 225 files changed, 21454 insertions(+), 9752 deletions(-) delete mode 100755 src/arith_uint256.cpp delete mode 100755 src/arith_uint256.h mode change 100755 => 100644 src/config/vitae-config.h.in delete mode 100755 src/eccryptoverify.cpp delete mode 100755 src/eccryptoverify.h delete mode 100755 src/ecwrapper.cpp delete mode 100755 src/ecwrapper.h create mode 100644 src/httprpc.cpp create mode 100644 src/httprpc.h create mode 100644 src/httpserver.cpp create mode 100644 src/httpserver.h rename src/{rpcblockchain.cpp => rpc/blockchain.cpp} (95%) rename src/{rpcclient.cpp => rpc/client.cpp} (99%) rename src/{rpcclient.h => rpc/client.h} (100%) rename src/{rpcdump.cpp => rpc/dump.cpp} (98%) rename src/{rpcfundamentalnode-budget.cpp => rpc/fundamentalnode-budget.cpp} (99%) rename src/{rpcfundamentalnode.cpp => rpc/fundamentalnode.cpp} (99%) rename src/{rpcmasternode-budget.cpp => rpc/masternode-budget.cpp} (99%) rename src/{rpcmasternode.cpp => rpc/masternode.cpp} (99%) rename src/{rpcmining.cpp => rpc/mining.cpp} (99%) rename src/{rpcmisc.cpp => rpc/misc.cpp} (98%) rename src/{rpcnet.cpp => rpc/net.cpp} (99%) create mode 100755 src/rpc/protocol.cpp create mode 100755 src/rpc/protocol.h rename src/{rpcrawtransaction.cpp => rpc/rawtransaction.cpp} (99%) rename src/{rpcserver.cpp => rpc/server.cpp} (53%) rename src/{rpcserver.h => rpc/server.h} (87%) rename src/{rpcwallet.cpp => rpc/wallet.cpp} (98%) delete mode 100755 src/rpcprotocol.cpp delete mode 100755 src/rpcprotocol.h mode change 100755 => 100644 src/secp256k1/.gitignore mode change 100755 => 100644 src/secp256k1/.travis.yml mode change 100755 => 100644 src/secp256k1/COPYING mode change 100755 => 100644 src/secp256k1/Makefile.am mode change 100755 => 100644 src/secp256k1/README.md mode change 100755 => 100644 src/secp256k1/TODO delete mode 100755 src/secp256k1/build-aux/m4/ax_boost_base.m4 delete mode 100755 src/secp256k1/build-aux/m4/ax_boost_chrono.m4 delete mode 100755 src/secp256k1/build-aux/m4/ax_boost_filesystem.m4 delete mode 100755 src/secp256k1/build-aux/m4/ax_boost_program_options.m4 delete mode 100755 src/secp256k1/build-aux/m4/ax_boost_system.m4 delete mode 100755 src/secp256k1/build-aux/m4/ax_boost_thread.m4 delete mode 100755 src/secp256k1/build-aux/m4/ax_boost_unit_test_framework.m4 delete mode 100755 src/secp256k1/build-aux/m4/ax_check_compile_flag.m4 delete mode 100755 src/secp256k1/build-aux/m4/ax_check_link_flag.m4 delete mode 100755 src/secp256k1/build-aux/m4/ax_check_preproc_flag.m4 delete mode 100755 src/secp256k1/build-aux/m4/ax_cxx_compile_stdcxx.m4 delete mode 100755 src/secp256k1/build-aux/m4/ax_gcc_func_attribute.m4 create mode 100644 src/secp256k1/build-aux/m4/ax_jni_include_dir.m4 create mode 100644 src/secp256k1/build-aux/m4/ax_prog_cc_for_build.m4 delete mode 100755 src/secp256k1/build-aux/m4/ax_pthread.m4 delete mode 100755 src/secp256k1/build-aux/m4/bitcoin_find_bdb48.m4 delete mode 100755 src/secp256k1/build-aux/m4/bitcoin_qt.m4 create mode 100644 src/secp256k1/build-aux/m4/bitcoin_secp.m4 delete mode 100755 src/secp256k1/build-aux/m4/bitcoin_subdir_to_include.m4 mode change 100755 => 100644 src/secp256k1/configure.ac create mode 100644 src/secp256k1/contrib/lax_der_parsing.c create mode 100644 src/secp256k1/contrib/lax_der_parsing.h create mode 100644 src/secp256k1/contrib/lax_der_privatekey_parsing.c create mode 100644 src/secp256k1/contrib/lax_der_privatekey_parsing.h mode change 100755 => 100644 src/secp256k1/include/secp256k1.h create mode 100644 src/secp256k1/include/secp256k1_ecdh.h create mode 100644 src/secp256k1/include/secp256k1_recovery.h mode change 100755 => 100644 src/secp256k1/libsecp256k1.pc.in delete mode 100755 src/secp256k1/nasm_lt.sh mode change 100755 => 100644 src/secp256k1/obj/.gitignore create mode 100644 src/secp256k1/sage/group_prover.sage create mode 100644 src/secp256k1/sage/secp256k1.sage create mode 100644 src/secp256k1/sage/weierstrass_prover.sage create mode 100644 src/secp256k1/src/asm/field_10x26_arm.s create mode 100644 src/secp256k1/src/basic-config.h create mode 100644 src/secp256k1/src/bench.h create mode 100644 src/secp256k1/src/bench_ecdh.c create mode 100644 src/secp256k1/src/bench_ecmult.c create mode 100644 src/secp256k1/src/bench_internal.c delete mode 100755 src/secp256k1/src/bench_inv.c create mode 100644 src/secp256k1/src/bench_recover.c mode change 100755 => 100644 src/secp256k1/src/bench_sign.c mode change 100755 => 100644 src/secp256k1/src/bench_verify.c mode change 100755 => 100644 src/secp256k1/src/ecdsa.h mode change 100755 => 100644 src/secp256k1/src/ecdsa_impl.h mode change 100755 => 100644 src/secp256k1/src/eckey.h mode change 100755 => 100644 src/secp256k1/src/eckey_impl.h mode change 100755 => 100644 src/secp256k1/src/ecmult.h create mode 100644 src/secp256k1/src/ecmult_const.h create mode 100644 src/secp256k1/src/ecmult_const_impl.h mode change 100755 => 100644 src/secp256k1/src/ecmult_gen.h mode change 100755 => 100644 src/secp256k1/src/ecmult_gen_impl.h mode change 100755 => 100644 src/secp256k1/src/ecmult_impl.h mode change 100755 => 100644 src/secp256k1/src/field.h mode change 100755 => 100644 src/secp256k1/src/field_10x26.h mode change 100755 => 100644 src/secp256k1/src/field_10x26_impl.h mode change 100755 => 100644 src/secp256k1/src/field_5x52.h delete mode 100755 src/secp256k1/src/field_5x52_asm.asm mode change 100755 => 100644 src/secp256k1/src/field_5x52_asm_impl.h mode change 100755 => 100644 src/secp256k1/src/field_5x52_impl.h mode change 100755 => 100644 src/secp256k1/src/field_5x52_int128_impl.h delete mode 100755 src/secp256k1/src/field_gmp_impl.h mode change 100755 => 100644 src/secp256k1/src/field_impl.h create mode 100644 src/secp256k1/src/gen_context.c mode change 100755 => 100644 src/secp256k1/src/group.h mode change 100755 => 100644 src/secp256k1/src/group_impl.h create mode 100644 src/secp256k1/src/hash.h create mode 100644 src/secp256k1/src/hash_impl.h mode change 100755 => 100644 src/secp256k1/src/java/org/bitcoin/NativeSecp256k1.java create mode 100644 src/secp256k1/src/java/org/bitcoin/NativeSecp256k1Test.java create mode 100644 src/secp256k1/src/java/org/bitcoin/NativeSecp256k1Util.java create mode 100644 src/secp256k1/src/java/org/bitcoin/Secp256k1Context.java mode change 100755 => 100644 src/secp256k1/src/java/org_bitcoin_NativeSecp256k1.c mode change 100755 => 100644 src/secp256k1/src/java/org_bitcoin_NativeSecp256k1.h create mode 100644 src/secp256k1/src/java/org_bitcoin_Secp256k1Context.c create mode 100644 src/secp256k1/src/java/org_bitcoin_Secp256k1Context.h create mode 100644 src/secp256k1/src/modules/ecdh/Makefile.am.include create mode 100644 src/secp256k1/src/modules/ecdh/main_impl.h create mode 100644 src/secp256k1/src/modules/ecdh/tests_impl.h create mode 100644 src/secp256k1/src/modules/recovery/Makefile.am.include create mode 100755 src/secp256k1/src/modules/recovery/main_impl.h create mode 100644 src/secp256k1/src/modules/recovery/tests_impl.h mode change 100755 => 100644 src/secp256k1/src/num.h mode change 100755 => 100644 src/secp256k1/src/num_gmp.h mode change 100755 => 100644 src/secp256k1/src/num_gmp_impl.h mode change 100755 => 100644 src/secp256k1/src/num_impl.h mode change 100755 => 100644 src/secp256k1/src/scalar.h mode change 100755 => 100644 src/secp256k1/src/scalar_4x64.h mode change 100755 => 100644 src/secp256k1/src/scalar_4x64_impl.h mode change 100755 => 100644 src/secp256k1/src/scalar_8x32.h mode change 100755 => 100644 src/secp256k1/src/scalar_8x32_impl.h mode change 100755 => 100644 src/secp256k1/src/scalar_impl.h rename src/secp256k1/src/{field_gmp.h => scalar_low.h} (51%) mode change 100755 => 100644 create mode 100644 src/secp256k1/src/scalar_low_impl.h create mode 100644 src/secp256k1/src/scratch.h create mode 100644 src/secp256k1/src/scratch_impl.h mode change 100755 => 100644 src/secp256k1/src/secp256k1.c mode change 100755 => 100644 src/secp256k1/src/testrand.h mode change 100755 => 100644 src/secp256k1/src/testrand_impl.h mode change 100755 => 100644 src/secp256k1/src/tests.c create mode 100644 src/secp256k1/src/tests_exhaustive.c mode change 100755 => 100644 src/secp256k1/src/util.h rename src/{ => wallet}/db.cpp (99%) rename src/{ => wallet}/db.h (100%) mode change 100755 => 100644 rename src/{ => wallet}/wallet.cpp (99%) rename src/{ => wallet}/wallet.h (99%) rename src/{ => wallet}/wallet_ismine.cpp (98%) mode change 100755 => 100644 rename src/{ => wallet}/wallet_ismine.h (100%) rename src/{ => wallet}/walletdb.cpp (99%) rename src/{ => wallet}/walletdb.h (99%) diff --git a/configure.ac b/configure.ac index 6b5a2aac7..4e8deb4b9 100755 --- a/configure.ac +++ b/configure.ac @@ -1065,7 +1065,7 @@ if test x$system_univalue = xno; then AC_CONFIG_SUBDIRS([src/univalue]) fi -ac_configure_args="${ac_configure_args} --disable-shared --with-pic" +ac_configure_args="${ac_configure_args} --disable-shared --with-pic --enable-module-recovery" AC_CONFIG_SUBDIRS([src/secp256k1]) AC_OUTPUT diff --git a/contrib/debian/examples/vitae.conf b/contrib/debian/examples/vitae.conf index 4f7e76781..73c50b56e 100755 --- a/contrib/debian/examples/vitae.conf +++ b/contrib/debian/examples/vitae.conf @@ -1,7 +1,7 @@ ## ## vitae.conf configuration file. Lines beginning with # are comments. ## - + # Network-related settings: # Run on the test network instead of the real vitae network. @@ -61,9 +61,9 @@ #rpcuser=Ulysseys #rpcpassword=YourSuperGreatPasswordNumber_DO_NOT_USE_THIS_OR_YOU_WILL_GET_ROBBED_385593 -# How many seconds vitae will wait for a complete RPC HTTP request. -# after the HTTP connection is established. -#rpctimeout=30 +# How many seconds pivx will wait for a complete RPC HTTP request. +# after the HTTP connection is established. +#rpcclienttimeout=30 # By default, only RPC connections from localhost are allowed. # Specify as many rpcallowip= settings as you like to allow connections from other hosts, @@ -72,8 +72,8 @@ # NOTE: opening up the RPC port to hosts outside your local trusted network is NOT RECOMMENDED, # because the rpcpassword is transmitted over the network unencrypted. -# server=1 tells Vitae-QT to accept JSON-RPC commands. -# it is also read by vitaed to determine if RPC should be enabled +# server=1 tells Pivx-QT to accept JSON-RPC commands. +# it is also read by pivxd to determine if RPC should be enabled #rpcallowip=10.1.1.34/255.255.255.0 #rpcallowip=1.2.3.4/24 #rpcallowip=2001:db8:85a3:0:0:8a2e:370:7334/96 @@ -85,16 +85,6 @@ # running on another host using this option: #rpcconnect=127.0.0.1 -# Use Secure Sockets Layer (also known as TLS or HTTPS) to communicate -# with Vitae -server or vitaed -#rpcssl=1 - -# OpenSSL settings used when rpcssl=1 -#rpcsslciphers=TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH -#rpcsslcertificatechainfile=server.cert -#rpcsslprivatekeyfile=server.pem - - # Miscellaneous options # Pre-generate this many public/private key pairs, so wallet backups will be valid for diff --git a/contrib/debian/manpages/pivx-qt.1 b/contrib/debian/manpages/pivx-qt.1 index 27c68a306..a32774c85 100755 --- a/contrib/debian/manpages/pivx-qt.1 +++ b/contrib/debian/manpages/pivx-qt.1 @@ -178,19 +178,6 @@ Set maximum block size in bytes (default: 250000) .HP \fB\-blockprioritysize=\fR Set maximum size of high\-priority/low\-fee transactions in bytes (default: 27000) .PP -SSL options: (see the Bitcoin Wiki for SSL setup instructions) -.TP -\fB\-rpcssl\fR -Use OpenSSL (https) for JSON\-RPC connections -.TP -\fB\-rpcsslcertificatechainfile=\fR -Server certificate file (default: server.cert) -.TP -\fB\-rpcsslprivatekeyfile=\fR -Server private key (default: server.pem) -.TP -\fB\-rpcsslciphers=\fR -Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH) .SS "UI options:" .TP \fB\-lang=\fR diff --git a/contrib/debian/manpages/pivx.conf.5 b/contrib/debian/manpages/pivx.conf.5 index c64a5b618..03a342766 100755 --- a/contrib/debian/manpages/pivx.conf.5 +++ b/contrib/debian/manpages/pivx.conf.5 @@ -46,16 +46,6 @@ Listen for RPC connections on this TCP port. \fBrpcconnect=\fR\fI'127.0.0.1'\fR You can use *vitae* or *vitaed(1)* to send commands to *vitae*/*vitaed(1)* running on another host using this option. .TP -\fBrpcssl=\fR\fI'1'\fR -Use Secure Sockets Layer (also known as TLS or HTTPS) to communicate with *vitae* '\-server' or *vitaed(1)*. Example of OpenSSL settings used when *rpcssl*='1': -.TP -\fB\-rpcsslciphers=\fR -Acceptable ciphers (default: TLSv1+HIGH:\:!SSLv2:\:!aNULL:\:!eNULL:\:!AH:\:!3DES:\:@STRENGTH) -.TP -\fBrpcsslcertificatechainfile=\fR\fI'server.cert'\fR -.TP -\fBrpcsslprivatekeyfile=\fR\fI'server.pem'\fR -.TP .SH MISCELLANEOUS OPTIONS .TP \fBgen=\fR[\fI'0'\fR|\fI'1'\fR] @@ -86,4 +76,3 @@ vitaed(1) This manual page was written by Micah Anderson for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 or any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. - diff --git a/contrib/debian/manpages/pivxd.1 b/contrib/debian/manpages/pivxd.1 index 24e587c63..281323fda 100755 --- a/contrib/debian/manpages/pivxd.1 +++ b/contrib/debian/manpages/pivxd.1 @@ -62,20 +62,6 @@ Allow JSON\-RPC connections from specified IP address .TP \fB\-rpcconnect=\fR Send commands to node running on -.PP -SSL options: (see the Bitcoin Wiki for SSL setup instructions) -.TP -\fB\-rpcssl\fR=\fI1\fR -Use OpenSSL (https) for JSON\-RPC connections -.TP -\fB\-rpcsslcertificatchainfile=\fR -Server certificate file (default: server.cert) -.TP -\fB\-rpcsslprivatekeyfile=\fR -Server private key (default: server.pem) -.TP -\fB\-rpcsslciphers=\fR -Acceptable ciphers (default: TLSv1+HIGH:\:!SSLv2:\:!aNULL:\:!eNULL:\:!AH:\:!3DES:\:@STRENGTH) .TP \-? This help message @@ -206,4 +192,3 @@ vitae.conf(5) This manual page was written by Micah Anderson for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 or any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. - diff --git a/contrib/pivxd.bash-completion b/contrib/pivxd.bash-completion index 68424e472..47cdf371a 100755 --- a/contrib/pivxd.bash-completion +++ b/contrib/pivxd.bash-completion @@ -96,7 +96,7 @@ _vitaed() { esac case "$cur" in - -conf=*|-pid=*|-loadblock=*|-wallet=*|-rpcsslcertificatechainfile=*|-rpcsslprivatekeyfile=*) + -conf=*|-pid=*|-loadblock=*|-wallet=*) cur="${cur#*=}" _filedir return 0 diff --git a/doc/REST-interface.md b/doc/REST-interface.md index 27b2e41b4..6ab6d37c4 100755 --- a/doc/REST-interface.md +++ b/doc/REST-interface.md @@ -5,23 +5,88 @@ The REST API can be enabled with the `-rest` option. Supported API ------------- -`GET /rest/tx/TX-HASH.{bin|hex|json}` -Given a transaction hash, -Returns a transaction, in binary, hex-encoded binary or JSON formats. +####Transactions +`GET /rest/tx/.` -`GET /rest/block/BLOCK-HASH.{bin|hex|json}` -`GET /rest/block/notxdetails/BLOCK-HASH.{bin|hex|json}` +Given a transaction hash: returns a transaction in binary, hex-encoded binary, or JSON formats. -Given a block hash, -Returns a block, in binary, hex-encoded binary or JSON formats. +For full TX query capability, one must enable the transaction index via "txindex=1" command line / configuration option. (enabled by default) -The HTTP request and response are both handled entirely in-memory, thus making maximum memory usage at least 2.66MB (1 MB max block, plus hex encoding) per request. +####Blocks +`GET /rest/block/.` +`GET /rest/block/notxdetails/.` + +Given a block hash: returns a block, in binary, hex-encoded binary or JSON formats. + +The HTTP request and response are both handled entirely in-memory, thus making maximum memory usage at least 4.66MB (2 MB max block, plus hex encoding) per request. With the /notxdetails/ option JSON response will only contain the transaction hash instead of the complete transaction details. The option only affects the JSON response. -For full TX query capability, one must enable the transaction index via "txindex=1" command line / configuration option. +####Blockheaders +`GET /rest/headers//.` + +Given a block hash: returns amount of blockheaders in upward direction. + +####Chaininfos +`GET /rest/chaininfo.json` + +Returns various state info regarding block chain processing. +Only supports JSON as output format. +* chain : (string) current network name as defined in BIP70 (main, test, regtest) +* blocks : (numeric) the current number of blocks processed in the server +* headers : (numeric) the current number of headers we have validated +* bestblockhash : (string) the hash of the currently best block +* difficulty : (numeric) the current difficulty +* verificationprogress : (numeric) estimate of verification progress [0..1] +* chainwork : (string) total amount of work in active chain, in hexadecimal + +####Query UTXO set +`GET /rest/getutxos//-/-/.../-.` + +The getutxo command allows querying of the UTXO set given a set of outpoints. +See BIP64 for input and output serialisation: +https://github.com/bitcoin/bips/blob/master/bip-0064.mediawiki + +Example: +``` +$ curl localhost:18332/rest/getutxos/checkmempool/b2cdfd7b89def827ff8af7cd9bff7627ff72e5e8b0f71210f92ea7a4000c5d75-0.json 2>/dev/null | json_pp +{ + "chaintipHash" : "00000000fb01a7f3745a717f8caebee056c484e6e0bfe4a9591c235bb70506fb", + "chainHeight" : 325347, + "utxos" : [ + { + "scriptPubKey" : { + "addresses" : [ + "mi7as51dvLJsizWnTMurtRmrP8hG2m1XvD" + ], + "type" : "pubkeyhash", + "hex" : "76a9141c7cebb529b86a04c683dfa87be49de35bcf589e88ac", + "reqSigs" : 1, + "asm" : "OP_DUP OP_HASH160 1c7cebb529b86a04c683dfa87be49de35bcf589e OP_EQUALVERIFY OP_CHECKSIG" + }, + "value" : 8.8687, + "height" : 2147483647, + "txvers" : 1 + } + ], + "bitmap" : "1" +} +``` + +####Memory pool +`GET /rest/mempool/info.json` + +Returns various information about the TX mempool. +Only supports JSON as output format. +* size : (numeric) the number of transactions in the TX mempool +* bytes : (numeric) size of the TX mempool in bytes + +`GET /rest/mempool/contents.json` + +Returns transactions in the TX mempool. +Only supports JSON as output format. Risks ------------- -Running a webbrowser on the same node with a REST enabled vitaed can be a risk. Accessing prepared XSS websites could read out tx/block data of your node by placing links like `