diff options
-rw-r--r-- | .travis.yml | 5 | ||||
-rwxr-xr-x | autogen.sh | 3 | ||||
-rw-r--r-- | build-aux/m4/bitcoin_qt.m4 | 32 | ||||
-rw-r--r-- | configure.ac | 36 | ||||
-rw-r--r-- | contrib/gitian-descriptors/boost-win.yml | 2 | ||||
-rw-r--r-- | contrib/gitian-descriptors/deps-win.yml | 4 | ||||
-rw-r--r-- | contrib/gitian-descriptors/gitian-win.yml | 4 | ||||
-rw-r--r-- | contrib/gitian-descriptors/protobuf-win.yml | 2 | ||||
-rw-r--r-- | contrib/gitian-descriptors/qt-linux.yml | 4 | ||||
-rw-r--r-- | contrib/gitian-descriptors/qt-win.yml | 2 | ||||
-rwxr-xr-x | contrib/linearize/linearize-hashes.py | 71 | ||||
-rw-r--r-- | depends/config.site.in | 4 | ||||
-rwxr-xr-x | qa/rpc-tests/send.sh | 2 | ||||
-rwxr-xr-x | qa/rpc-tests/walletbackup.sh | 2 | ||||
-rw-r--r-- | share/qt/Info.plist.in | 3 | ||||
-rw-r--r-- | src/init.cpp | 3 | ||||
-rw-r--r-- | src/qt/optionsmodel.cpp | 2 | ||||
-rw-r--r-- | src/rpcrawtransaction.cpp | 5 | ||||
-rw-r--r-- | src/script/standard.cpp | 15 |
19 files changed, 115 insertions, 86 deletions
diff --git a/.travis.yml b/.travis.yml index eae07ead8e..89b2238655 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ matrix: - compiler: "true 3" env: HOST=x86_64-unknown-linux-gnu DEP_OPTS="NO_WALLET=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat" - compiler: "true 4" - env: HOST=i686-pc-linux-gnu PACKAGES="g++-multilib" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat" + env: HOST=i686-pc-linux-gnu PACKAGES="g++-multilib" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat" USE_SHELL="/bin/dash" - compiler: "true 5" env: HOST=x86_64-apple-darwin11 PACKAGES="gcc-multilib g++-multilib cmake libcap-dev libz-dev libbz2-dev" OSX_SDK=10.7 GOAL="deploy" - compiler: "true 6" @@ -48,11 +48,12 @@ before_script: - if [ -n "$OSX_SDK" -a -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then tar -C depends/SDKs -xf depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz; fi - make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS || (echo "Build failure. Verbose build follows." && make -C depends V=1 HOST=$HOST $DEP_OPTS) script: + - if [ -n "$USE_SHELL" ]; then export CONFIG_SHELL="$USE_SHELL"; fi - OUTDIR=$BASE_OUTDIR/$TRAVIS_PULL_REQUEST/$TRAVIS_JOB_NUMBER-$HOST - BITCOIN_CONFIG_ALL="--disable-dependency-tracking --prefix=$TRAVIS_BUILD_DIR/depends/$HOST --bindir=$OUTDIR/bin --libdir=$OUTDIR/lib" - depends/$HOST/native/bin/ccache --max-size=$CCACHE_SIZE - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then export CCACHE_READONLY=1; fi - - ./autogen.sh + - test -n "$USE_SHELL" && eval '"$USE_SHELL" -c "./autogen.sh"' || ./autogen.sh - ./configure --cache-file=config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false) - make distdir PACKAGE=bitcoin VERSION=$HOST - cd bitcoin-$HOST diff --git a/autogen.sh b/autogen.sh index ddfc09607e..3e26a18305 100755 --- a/autogen.sh +++ b/autogen.sh @@ -3,6 +3,7 @@ set -e srcdir="$(dirname $0)" cd "$srcdir" if [ -z ${LIBTOOLIZE} ] && GLIBTOOLIZE="`which glibtoolize 2>/dev/null`"; then - export LIBTOOLIZE="${GLIBTOOLIZE}" + LIBTOOLIZE="${GLIBTOOLIZE}" + export LIBTOOLIZE fi autoreconf --install --force --warnings=all diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4 index 71b1484894..2a72262653 100644 --- a/build-aux/m4/bitcoin_qt.m4 +++ b/build-aux/m4/bitcoin_qt.m4 @@ -84,7 +84,7 @@ 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 + if test x$use_pkgconfig = x; then use_pkgconfig=yes fi @@ -106,9 +106,9 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ BITCOIN_QT_CHECK([ TEMP_CPPFLAGS=$CPPFLAGS CPPFLAGS=$QT_INCLUDES - if test x$bitcoin_qt_got_major_vers == x5; then + if test x$bitcoin_qt_got_major_vers = x5; then _BITCOIN_QT_IS_STATIC - if test x$bitcoin_cv_static_qt == xyes; then + if test x$bitcoin_cv_static_qt = xyes; then AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static]) if test x$qt_plugin_path != x; then QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible" @@ -118,14 +118,14 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ PKG_CHECK_MODULES([QTPLATFORM], [Qt5PlatformSupport], [QT_LIBS="$QTPLATFORM_LIBS $QT_LIBS"]) fi _BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(AccessibleFactory)], [-lqtaccessiblewidgets]) - if test x$TARGET_OS == xwindows; then + 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 + elif test x$TARGET_OS = xlinux; then PKG_CHECK_MODULES([X11XCB], [x11-xcb], [QT_LIBS="$X11XCB_LIBS $QT_LIBS"]) _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 + elif test x$TARGET_OS = xdarwin; then if test x$use_pkgconfig = xyes; then PKG_CHECK_MODULES([QTPRINT], [Qt5PrintSupport], [QT_LIBS="$QTPRINT_LIBS $QT_LIBS"]) fi @@ -135,7 +135,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ fi fi else - if test x$TARGET_OS == xwindows; then + if test x$TARGET_OS = xwindows; then AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static]) if test x$qt_plugin_path != x; then QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible" @@ -196,7 +196,7 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ 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 + if test x$LUPDATE = x; then AC_MSG_WARN("lupdate is required to update qt translations") fi ],[ @@ -291,10 +291,10 @@ 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 + 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 + 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 @@ -304,14 +304,14 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG],[ 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 + 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 + 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$have_qt = xno && test x$bitcoin_qt_want_version = xauto; then if test x$auto_priority_version = x$qt5; 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 @@ -358,7 +358,7 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[ 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 + 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 @@ -373,7 +373,7 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[ LIBS="$LIBS -L$qt_lib_path" fi - if test x$TARGET_OS == xwindows; then + if test x$TARGET_OS = xwindows; then AC_CHECK_LIB([imm32], [main],, BITCOIN_QT_FAIL(libimm32 not found)) fi ]) @@ -385,7 +385,7 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[ 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 + 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" diff --git a/configure.ac b/configure.ac index abf9f39e65..87c7833bce 100644 --- a/configure.ac +++ b/configure.ac @@ -240,7 +240,7 @@ case $host in AC_CHECK_PROG([BREW],brew, brew) if test x$BREW = xbrew; then - dnl These Homebrew packages may be bottled, meaning that they won't be found + dnl These Homebrew packages may be keg-only, meaning that they won't be found dnl in expected paths because they may conflict with system files. Ask dnl Homebrew where each one is located, then adjust paths accordingly. dnl It's safe to add these paths even if the functionality is disabled by @@ -250,14 +250,16 @@ case $host in bdb_prefix=`$BREW --prefix berkeley-db4 2>/dev/null` qt5_prefix=`$BREW --prefix qt5 2>/dev/null` if test x$openssl_prefix != x; then - export PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH" + PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH" + export PKG_CONFIG_PATH fi if test x$bdb_prefix != x; then CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include" LIBS="$LIBS -L$bdb_prefix/lib" fi if test x$qt5_prefix != x; then - export PKG_CONFIG_PATH="$qt5_prefix/lib/pkgconfig:$PKG_CONFIG_PATH" + PKG_CONFIG_PATH="$qt5_prefix/lib/pkgconfig:$PKG_CONFIG_PATH" + export PKG_CONFIG_PATH fi fi else @@ -287,7 +289,7 @@ if test x$use_comparison_tool != xno; then fi if test x$use_comparison_tool_reorg_tests != xno; then - if test x$use_comparison_tool == x; then + if test x$use_comparison_tool = x; then AC_MSG_ERROR("comparison tool reorg tests but comparison tool was not specified") fi AC_SUBST(COMPARISON_TOOL_REORG_TESTS, 1) @@ -295,20 +297,20 @@ else AC_SUBST(COMPARISON_TOOL_REORG_TESTS, 0) fi -if test x$use_lcov == xyes; then - if test x$LCOV == x; then +if test x$use_lcov = xyes; then + if test x$LCOV = x; then AC_MSG_ERROR("lcov testing requested but lcov not found") fi - if test x$GCOV == x; then + if test x$GCOV = x; then AC_MSG_ERROR("lcov testing requested but gcov not found") fi - if test x$JAVA == x; then + if test x$JAVA = x; then AC_MSG_ERROR("lcov testing requested but java not found") fi - if test x$GENHTML == x; then + if test x$GENHTML = x; then AC_MSG_ERROR("lcov testing requested but genhtml not found") fi - if test x$use_comparison_tool == x; then + if test x$use_comparison_tool = x; then AC_MSG_ERROR("lcov testing requested but comparison tool was not specified") fi LCOV="$LCOV --gcov-tool=$GCOV" @@ -607,7 +609,7 @@ BITCOIN_QT_INIT if test x$use_pkgconfig = xyes; then - if test x"$PKG_CONFIG" == "x"; then + if test x"$PKG_CONFIG" = "x"; then AC_MSG_ERROR(pkg-config not found.) fi @@ -721,7 +723,7 @@ if test x$bitcoin_enable_qt != xno; then dnl enable qr support AC_MSG_CHECKING([whether to build GUI with support for QR codes]) if test x$have_qrencode = xno; then - if test x$use_qr == xyes; then + if test x$use_qr = xyes; then AC_MSG_ERROR("QR support requested but cannot be built. use --without-qrencode") fi AC_MSG_RESULT(no) @@ -735,7 +737,7 @@ if test x$bitcoin_enable_qt != xno; then fi fi - if test x$XGETTEXT == x; then + if test x$XGETTEXT = x; then AC_MSG_WARN("xgettext is required to update qt translations") fi @@ -770,12 +772,12 @@ fi AM_CONDITIONAL([TARGET_DARWIN], [test x$TARGET_OS = xdarwin]) AM_CONDITIONAL([BUILD_DARWIN], [test x$BUILD_OS = xdarwin]) AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows]) -AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet == xyes]) -AM_CONDITIONAL([ENABLE_TESTS],[test x$use_tests == xyes]) -AM_CONDITIONAL([ENABLE_QT],[test x$bitcoin_enable_qt == xyes]) +AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes]) +AM_CONDITIONAL([ENABLE_TESTS],[test x$use_tests = xyes]) +AM_CONDITIONAL([ENABLE_QT],[test x$bitcoin_enable_qt = xyes]) AM_CONDITIONAL([ENABLE_QT_TESTS],[test x$use_tests$bitcoin_enable_qt_test = xyesyes]) AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes]) -AM_CONDITIONAL([USE_LCOV],[test x$use_lcov == xyes]) +AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes]) AM_CONDITIONAL([USE_COMPARISON_TOOL],[test x$use_comparison_tool != xno]) AM_CONDITIONAL([USE_COMPARISON_TOOL_REORG_TESTS],[test x$use_comparison_tool_reorg_test != xno]) AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes]) diff --git a/contrib/gitian-descriptors/boost-win.yml b/contrib/gitian-descriptors/boost-win.yml index db5d6bab1d..347952e3a6 100644 --- a/contrib/gitian-descriptors/boost-win.yml +++ b/contrib/gitian-descriptors/boost-win.yml @@ -29,7 +29,7 @@ script: | # INSTALLPREFIX=$HOME/staging${BITS} BUILDDIR=$HOME/build${BITS} - if [ "$BITS" == "32" ]; then + if [ "x$BITS" = "x32" ]; then HOST=i686-w64-mingw32 else HOST=x86_64-w64-mingw32 diff --git a/contrib/gitian-descriptors/deps-win.yml b/contrib/gitian-descriptors/deps-win.yml index fabc2949eb..fe02950ef9 100644 --- a/contrib/gitian-descriptors/deps-win.yml +++ b/contrib/gitian-descriptors/deps-win.yml @@ -39,7 +39,7 @@ script: | # INSTALLPREFIX=$HOME/staging${BITS} BUILDDIR=$HOME/build${BITS} - if [ "$BITS" == "32" ]; then + if [ "x$BITS" = "x32" ]; then HOST=i686-w64-mingw32 else HOST=x86_64-w64-mingw32 @@ -50,7 +50,7 @@ script: | # tar xzf $INDIR/openssl-1.0.1h.tar.gz cd openssl-1.0.1h - if [ "$BITS" == "32" ]; then + if [ "x$BITS" = "x32" ]; then OPENSSL_TGT=mingw else OPENSSL_TGT=mingw64 diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index 245f15ccab..b2795c5376 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -50,7 +50,7 @@ script: | STAGING=$HOME/staging${BITS} BUILDDIR=$HOME/build${BITS} BINDIR=$OUTDIR/$BITS - if [ "$BITS" == "32" ]; then + if [ "x$BITS" = "x32" ]; then HOST=i686-w64-mingw32 else HOST=x86_64-w64-mingw32 @@ -63,7 +63,7 @@ script: | unzip $INDIR/boost-win${BITS}-1.55.0-gitian-r6.zip unzip $INDIR/bitcoin-deps-win${BITS}-gitian-r13.zip unzip $INDIR/protobuf-win${BITS}-2.5.0-gitian-r4.zip - if [ "$NEEDDIST" == "1" ]; then + if [ "x$NEEDDIST" = "x1" ]; then # Make source code archive which is architecture independent so it only needs to be done once cd $HOME/build/bitcoin ./autogen.sh diff --git a/contrib/gitian-descriptors/protobuf-win.yml b/contrib/gitian-descriptors/protobuf-win.yml index d2fdcaa7f2..1b7af08843 100644 --- a/contrib/gitian-descriptors/protobuf-win.yml +++ b/contrib/gitian-descriptors/protobuf-win.yml @@ -26,7 +26,7 @@ script: | # INSTALLPREFIX=$HOME/staging${BITS} BUILDDIR=$HOME/build${BITS} - if [ "$BITS" == "32" ]; then + if [ "x$BITS" = "x32" ]; then HOST=i686-w64-mingw32 else HOST=x86_64-w64-mingw32 diff --git a/contrib/gitian-descriptors/qt-linux.yml b/contrib/gitian-descriptors/qt-linux.yml index b163b4bb8c..fd86b4df1d 100644 --- a/contrib/gitian-descriptors/qt-linux.yml +++ b/contrib/gitian-descriptors/qt-linux.yml @@ -18,7 +18,7 @@ files: script: | export FAKETIME=$REFERENCE_DATETIME export TZ=UTC - if [ "$GBUILD_BITS" == "32" ]; then + if [ "x$GBUILD_BITS" = "x32" ]; then ARCH='i386-linux-gnu' else ARCH='x86_64-linux-gnu' @@ -74,7 +74,7 @@ script: | #endif ' > $QCONFIG - if [ "$GBUILD_BITS" == "32" ]; then + if [ "x$GBUILD_BITS" = "x32" ]; then echo ' /* Machine byte-order */ #define Q_BIG_ENDIAN 4321 diff --git a/contrib/gitian-descriptors/qt-win.yml b/contrib/gitian-descriptors/qt-win.yml index 7000c70051..57bc4c3180 100644 --- a/contrib/gitian-descriptors/qt-win.yml +++ b/contrib/gitian-descriptors/qt-win.yml @@ -38,7 +38,7 @@ script: | INSTALLPREFIX=$HOME/staging${BITS} BUILDDIR=$HOME/build${BITS} DEPSDIR=$HOME/deps${BITS} - if [ "$BITS" == "32" ]; then + if [ "x$BITS" = "x32" ]; then HOST=i686-w64-mingw32 else HOST=x86_64-w64-mingw32 diff --git a/contrib/linearize/linearize-hashes.py b/contrib/linearize/linearize-hashes.py index 791b71bc33..dc7f654049 100755 --- a/contrib/linearize/linearize-hashes.py +++ b/contrib/linearize/linearize-hashes.py @@ -2,11 +2,12 @@ # # linearize-hashes.py: List blocks in a linear, no-fork version of the chain. # -# Copyright (c) 2013 The Bitcoin developers +# Copyright (c) 2013-2014 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # +from __future__ import print_function import json import struct import re @@ -17,59 +18,65 @@ import sys settings = {} class BitcoinRPC: - OBJID = 1 - def __init__(self, host, port, username, password): authpair = "%s:%s" % (username, password) self.authhdr = "Basic %s" % (base64.b64encode(authpair)) self.conn = httplib.HTTPConnection(host, port, False, 30) - def rpc(self, method, params=None): - self.OBJID += 1 - obj = { 'version' : '1.1', - 'method' : method, - 'id' : self.OBJID } - if params is None: - obj['params'] = [] - else: - obj['params'] = params + + def execute(self, obj): self.conn.request('POST', '/', json.dumps(obj), { 'Authorization' : self.authhdr, 'Content-type' : 'application/json' }) resp = self.conn.getresponse() if resp is None: - print "JSON-RPC: no response" + print("JSON-RPC: no response", file=sys.stderr) return None body = resp.read() resp_obj = json.loads(body) - if resp_obj is None: - print "JSON-RPC: cannot JSON-decode body" - return None - if 'error' in resp_obj and resp_obj['error'] != None: - return resp_obj['error'] - if 'result' not in resp_obj: - print "JSON-RPC: no result in object" - return None + return resp_obj - return resp_obj['result'] - def getblock(self, hash, verbose=True): - return self.rpc('getblock', [hash, verbose]) - def getblockhash(self, index): - return self.rpc('getblockhash', [index]) + @staticmethod + def build_request(idx, method, params): + obj = { 'version' : '1.1', + 'method' : method, + 'id' : idx } + if params is None: + obj['params'] = [] + else: + obj['params'] = params + return obj + + @staticmethod + def response_is_error(resp_obj): + return 'error' in resp_obj and resp_obj['error'] is not None -def get_block_hashes(settings): +def get_block_hashes(settings, max_blocks_per_call=10000): rpc = BitcoinRPC(settings['host'], settings['port'], settings['rpcuser'], settings['rpcpassword']) - for height in xrange(settings['min_height'], settings['max_height']+1): - hash = rpc.getblockhash(height) + height = settings['min_height'] + while height < settings['max_height']+1: + num_blocks = min(settings['max_height']+1-height, max_blocks_per_call) + batch = [] + for x in range(num_blocks): + batch.append(rpc.build_request(x, 'getblockhash', [height + x])) + + reply = rpc.execute(batch) + + for x,resp_obj in enumerate(reply): + if rpc.response_is_error(resp_obj): + print('JSON-RPC: error at height', height+x, ': ', resp_obj['error'], file=sys.stderr) + exit(1) + assert(resp_obj['id'] == x) # assume replies are in-sequence + print(resp_obj['result']) - print(hash) + height += num_blocks if __name__ == '__main__': if len(sys.argv) != 2: - print "Usage: linearize-hashes.py CONFIG-FILE" + print("Usage: linearize-hashes.py CONFIG-FILE") sys.exit(1) f = open(sys.argv[1]) @@ -95,7 +102,7 @@ if __name__ == '__main__': if 'max_height' not in settings: settings['max_height'] = 313000 if 'rpcuser' not in settings or 'rpcpassword' not in settings: - print "Missing username and/or password in cfg file" + print("Missing username and/or password in cfg file", file=stderr) sys.exit(1) settings['port'] = int(settings['port']) diff --git a/depends/config.site.in b/depends/config.site.in index 3426050cd3..df076956bd 100644 --- a/depends/config.site.in +++ b/depends/config.site.in @@ -34,12 +34,12 @@ if test -z $with_gui && test -n "@no_qt@"; then with_gui=no fi -if test @host_os@ == darwin; then +if test x@host_os@ = xdarwin; then BREW=no PORT=no fi -if test @host_os@ == mingw32; then +if test x@host_os@ = xmingw32; then if test -z $with_qt_incdir; then with_qt_incdir=$prefix/include fi diff --git a/qa/rpc-tests/send.sh b/qa/rpc-tests/send.sh index bfbf791d07..8c0f114590 100755 --- a/qa/rpc-tests/send.sh +++ b/qa/rpc-tests/send.sh @@ -14,7 +14,7 @@ if [ $# -eq 0 ]; then exit 0 fi -if [ $1 == "-STOP" ]; then +if [ $1 = "-STOP" ]; then if [ -s ${PIDFILE} ]; then kill -s ${SIGNAL} $(<${PIDFILE}) fi diff --git a/qa/rpc-tests/walletbackup.sh b/qa/rpc-tests/walletbackup.sh index 7444670980..b88d5920f7 100755 --- a/qa/rpc-tests/walletbackup.sh +++ b/qa/rpc-tests/walletbackup.sh @@ -149,7 +149,7 @@ echo "Creating transactions..." function S { TXID=$( $CLI -datadir=${D}/node${1} sendtoaddress ${2} "${3}" 0 ) - if [[ $TXID == "" ]] ; then + if [ x$TXID = x ] ; then echoerr "node${1}: error sending ${3} btc" echo -n "node${1} balance: " $CLI -datadir=${D}/node${1} getbalance "*" 0 diff --git a/share/qt/Info.plist.in b/share/qt/Info.plist.in index e79e59a568..dd6edde8d2 100644 --- a/share/qt/Info.plist.in +++ b/share/qt/Info.plist.in @@ -91,6 +91,9 @@ <key>NSHighResolutionCapable</key> <string>True</string> + <key>LSAppNapIsDisabled</key> + <string>True</string> + <key>LSApplicationCategoryType</key> <string>public.app-category.finance</string> </dict> diff --git a/src/init.cpp b/src/init.cpp index 980c589b29..36ba13b941 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -237,7 +237,7 @@ std::string HelpMessage(HelpMessageMode mode) #if !defined(WIN32) strUsage += " -sysperms " + _("Create new files with system default permissions, instead of umask 077 (only effective with disabled wallet functionality)") + "\n"; #endif - strUsage += " -txindex " + _("Maintain a full transaction index (default: 0)") + "\n"; + strUsage += " -txindex " + _("Maintain a full transaction index, used by the getrawtransaction rpc call (default: 0)") + "\n"; strUsage += "\n" + _("Connection options:") + "\n"; strUsage += " -addnode=<ip> " + _("Add a node to connect to and attempt to keep the connection open") + "\n"; @@ -280,7 +280,6 @@ std::string HelpMessage(HelpMessageMode mode) strUsage += " -mintxfee=<amt> " + strprintf(_("Fees (in BTC/Kb) smaller than this are considered zero fee for transaction creation (default: %s)"), FormatMoney(CWallet::minTxFee.GetFeePerK())) + "\n"; strUsage += " -paytxfee=<amt> " + strprintf(_("Fee (in BTC/kB) to add to transactions you send (default: %s)"), FormatMoney(payTxFee.GetFeePerK())) + "\n"; strUsage += " -rescan " + _("Rescan the block chain for missing wallet transactions") + " " + _("on startup") + "\n"; - strUsage += " -respendnotify=<cmd> " + _("Execute command when a network tx respends wallet tx input (%s=respend TxID, %t=wallet TxID)") + "\n"; strUsage += " -salvagewallet " + _("Attempt to recover private keys from a corrupt wallet.dat") + " " + _("on startup") + "\n"; strUsage += " -spendzeroconfchange " + _("Spend unconfirmed change when sending transactions (default: 1)") + "\n"; strUsage += " -txconfirmtarget=<n> " + _("If paytxfee is not set, include enough fee so transactions are confirmed on average within n blocks (default: 1)") + "\n"; diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index cb80bd0e3d..6db654dff7 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -119,6 +119,8 @@ void OptionsModel::Init() // Only try to set -proxy, if user has enabled fUseProxy if (settings.value("fUseProxy").toBool() && !SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString())) addOverriddenOption("-proxy"); + else if(!settings.value("fUseProxy").toBool() && !GetArg("-proxy", "").empty()) + addOverriddenOption("-proxy"); // Display if (!settings.contains("language")) diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index e50a278bc8..23e647b17a 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -110,6 +110,9 @@ Value getrawtransaction(const Array& params, bool fHelp) if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( "getrawtransaction \"txid\" ( verbose )\n" + "\nNOTE: By default this function only works sometimes. This is when the tx is in the mempool\n" + "or there is an unspent output in the utxo for this transaction. To make it always work,\n" + "you need to maintain a transaction index, using the -txindex command line option.\n" "\nReturn the raw transaction data.\n" "\nIf verbose=0, returns a string that is serialized, hex-encoded data for 'txid'.\n" "If verbose is non-zero, returns an Object with information about 'txid'.\n" @@ -202,7 +205,7 @@ Value listunspent(const Array& params, bool fHelp) "Results are an array of Objects, each of which has:\n" "{txid, vout, scriptPubKey, amount, confirmations}\n" "\nArguments:\n" - "1. minconf (numeric, optional, default=1) The minimum confirmationsi to filter\n" + "1. minconf (numeric, optional, default=1) The minimum confirmations to filter\n" "2. maxconf (numeric, optional, default=9999999) The maximum confirmations to filter\n" "3. \"addresses\" (string) A json array of bitcoin addresses to filter\n" " [\n" diff --git a/src/script/standard.cpp b/src/script/standard.cpp index 407baf621d..53ae254d59 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -203,7 +203,11 @@ bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet) if (whichType == TX_PUBKEY) { - addressRet = CPubKey(vSolutions[0]).GetID(); + CPubKey pubKey(vSolutions[0]); + if (!pubKey.IsValid()) + return false; + + addressRet = pubKey.GetID(); return true; } else if (whichType == TX_PUBKEYHASH) @@ -237,9 +241,16 @@ bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, vecto nRequiredRet = vSolutions.front()[0]; for (unsigned int i = 1; i < vSolutions.size()-1; i++) { - CTxDestination address = CPubKey(vSolutions[i]).GetID(); + CPubKey pubKey(vSolutions[i]); + if (!pubKey.IsValid()) + continue; + + CTxDestination address = pubKey.GetID(); addressRet.push_back(address); } + + if (addressRet.empty()) + return false; } else { |