diff options
36 files changed, 422 insertions, 209 deletions
diff --git a/configure.ac b/configure.ac index 0e69903025..d9ed86f6fc 100644 --- a/configure.ac +++ b/configure.ac @@ -176,6 +176,10 @@ case $host in AC_CHECK_LIB([mswsock], [main],, AC_MSG_ERROR(lib missing)) AC_CHECK_LIB([shlwapi], [main],, AC_MSG_ERROR(lib missing)) AC_CHECK_LIB([iphlpapi], [main],, AC_MSG_ERROR(lib missing)) + AC_CHECK_LIB([crypt32], [main],, AC_MSG_ERROR(lib missing)) + + AX_CHECK_LINK_FLAG([[-static-libgcc]],[LDFLAGS="$LDFLAGS -static-libgcc"]) + AX_CHECK_LINK_FLAG([[-static-libstdc++]],[LDFLAGS="$LDFLAGS -static-libstdc++"]) AC_PATH_PROG([MAKENSIS], [makensis], none) if test x$MAKENSIS = xnone; then diff --git a/contrib/gitian-descriptors/README b/contrib/gitian-descriptors/README index f1c960ba11..e9c7d4efc2 100644 --- a/contrib/gitian-descriptors/README +++ b/contrib/gitian-descriptors/README @@ -31,7 +31,7 @@ Once you've got the right hardware and software: wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz' wget 'https://downloads.sourceforge.net/project/libpng/zlib/1.2.6/zlib-1.2.6.tar.gz' wget 'https://downloads.sourceforge.net/project/libpng/libpng15/older-releases/1.5.9/libpng-1.5.9.tar.gz' - wget 'http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-4.8.3.tar.gz' + wget 'https://download.qt-project.org/archive/qt/4.8/4.8.3/qt-everywhere-opensource-src-4.8.3.tar.gz' wget 'http://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2' cd ../.. diff --git a/contrib/gitian-descriptors/boost-win32.yml b/contrib/gitian-descriptors/boost-win32.yml index 9eb4cf5968..b421cbe8c5 100644 --- a/contrib/gitian-descriptors/boost-win32.yml +++ b/contrib/gitian-descriptors/boost-win32.yml @@ -1,33 +1,66 @@ --- name: "boost" suites: -- "lucid" +- "precise" architectures: -- "i386" +- "amd64" packages: -- "mingw32" +- "mingw-w64" +- "g++-mingw-w64" - "faketime" - "zip" reference_datetime: "2011-01-30 00:00:00" remotes: [] files: -- "boost_1_50_0.tar.bz2" +- "boost_1_54_0.tar.bz2" +- "boost-mingw-gas-cross-compile-2013-03-03.patch" script: | + # Defines INSTALLPREFIX="$OUTDIR/staging/boost" + HOST=i686-w64-mingw32 + # Input Integrity Check + echo "047e927de336af106a24bceba30069980c191529fd76b8dff8eb9a328b48ae1d boost_1_54_0.tar.bz2" | shasum -c + echo "d2b7f6a1d7051faef3c9cf41a92fa3671d905ef1e1da920d07651a43299f6268 boost-mingw-gas-cross-compile-2013-03-03.patch" | shasum -c + mkdir -p "$INSTALLPREFIX" - tar xjf boost_1_50_0.tar.bz2 - cd boost_1_50_0 - echo "using gcc : 4.4 : i586-mingw32msvc-g++ + tar xjf boost_1_54_0.tar.bz2 + cd boost_1_54_0 + GCCVERSION=$($HOST-g++ -E -dM $(mktemp --suffix=.h) | grep __VERSION__ | cut -d ' ' -f 3 | cut -d '"' -f 2) + echo "using gcc : $GCCVERSION : $HOST-g++ : - <rc>i586-mingw32msvc-windres - <archiver>i586-mingw32msvc-ar + <rc>$HOST-windres + <archiver>$HOST-ar <cxxflags>-frandom-seed=boost1 + <ranlib>$HOST-ranlib ;" > user-config.jam ./bootstrap.sh --without-icu - ./bjam toolset=gcc target-os=windows threadapi=win32 threading=multi variant=release link=static --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged --build-type=complete --prefix="$INSTALLPREFIX" $MAKEOPTS install + + # Workaround: Upstream boost dev refuses to include patch that would allow Free Software cross-compile toolchain to work + # This patch was authored by the Fedora package developer and ships in Fedora's mingw32-boost. + # Please obtain the exact patch that matches the above sha256sum from one of the following mirrors. + # + # Read History: https://svn.boost.org/trac/boost/ticket/7262 + # History Mirror: http://rose.makesad.us/~paulproteus/mirrors/7262%20Boost.Context%20fails%20to%20build%20using%20MinGW.html + # + # Patch: https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/boost-mingw.patch + # Patch Mirror: http://wtogami.fedorapeople.org/boost-mingw-gas-cross-compile-2013-03-03.patch + # Patch Mirror: http://mindstalk.net/host/boost-mingw-gas-cross-compile-2013-03-03.patch + # Patch Mirror: http://rose.makesad.us/~paulproteus/mirrors/boost-mingw-gas-cross-compile-2013-03-03.patch + patch -p0 < ../boost-mingw-gas-cross-compile-2013-03-03.patch + + # Bug Workaround: boost-1.54.0 broke the ability to disable zlib + # https://svn.boost.org/trac/boost/ticket/9156 + sed -i 's^\[ ac.check-library /zlib//zlib : <library>/zlib//zlib^^' libs/iostreams/build/Jamfile.v2 + sed -i 's^<source>zlib.cpp <source>gzip.cpp \]^^' libs/iostreams/build/Jamfile.v2 + + # http://statmt.org/~s0565741/software/boost_1_52_0/libs/context/doc/html/context/requirements.html + # Note: Might need these options in the future for 64bit builds. + # "Please note that address-model=64 must be given to bjam command line on 64bit Windows for 64bit build; otherwise 32bit code will be generated." + # "For cross-compiling the lib you must specify certain additional properties at bjam command line: target-os, abi, binary-format, architecture and address-model." + ./bjam toolset=gcc binary-format=pe target-os=windows threadapi=win32 threading=multi variant=release link=static --user-config=user-config.jam --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged --build-type=complete --prefix="$INSTALLPREFIX" $MAKEOPTS install cd "$INSTALLPREFIX" export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export FAKETIME=$REFERENCE_DATETIME - zip -r boost-win32-1.50.0-gitian3.zip * - cp boost-win32-1.50.0-gitian3.zip $OUTDIR + zip -r boost-win32-1.54.0-gitian-r6.zip * + cp boost-win32-1.54.0-gitian-r6.zip $OUTDIR diff --git a/contrib/gitian-descriptors/deps-win32.yml b/contrib/gitian-descriptors/deps-win32.yml index 98f69dddf0..5129462102 100644 --- a/contrib/gitian-descriptors/deps-win32.yml +++ b/contrib/gitian-descriptors/deps-win32.yml @@ -1,11 +1,12 @@ --- name: "bitcoin-deps" suites: -- "lucid" +- "precise" architectures: -- "i386" +- "amd64" packages: -- "mingw32" +- "mingw-w64" +- "g++-mingw-w64" - "git-core" - "zip" - "faketime" @@ -26,7 +27,7 @@ script: | export FAKETIME=$REFERENCE_DATETIME export TZ=UTC export INSTALLPREFIX=$OUTDIR/staging/deps - export HOST=i586-mingw32msvc + export HOST=i686-w64-mingw32 # mkdir -p $INSTALLPREFIX @@ -39,7 +40,7 @@ script: | # tar xzf db-4.8.30.NC.tar.gz cd db-4.8.30.NC/build_unix - ../dist/configure --prefix=$INSTALLPREFIX --enable-mingw --enable-cxx --host=$HOST + ../dist/configure --prefix=$INSTALLPREFIX --enable-mingw --enable-cxx --host=$HOST --disable-shared make $MAKEOPTS library_build make install_lib install_include cd ../.. @@ -71,12 +72,12 @@ script: | # tar xjf qrencode-3.2.0.tar.bz2 cd qrencode-3.2.0 - png_CFLAGS="-I$INSTALLPREFIX/include" png_LIBS="-L$INSTALLPREFIX/lib -lpng" ./configure --prefix=$INSTALLPREFIX --host=i586-mingw32msvc + png_CFLAGS="-I$INSTALLPREFIX/include" png_LIBS="-L$INSTALLPREFIX/lib -lpng" ./configure --prefix=$INSTALLPREFIX --host=$HOST make make install cd .. # cd $INSTALLPREFIX - zip -r $OUTDIR/bitcoin-deps-0.0.6.zip include lib + zip -r $OUTDIR/bitcoin-deps-win32-gitian-r8.zip include lib # Kill wine processes as gitian won't figure out we are done otherwise killall wineserver services.exe explorer.exe winedevice.exe diff --git a/contrib/gitian-descriptors/gitian-win32.yml b/contrib/gitian-descriptors/gitian-win32.yml index 87e05b4610..0d0bd9a74d 100644 --- a/contrib/gitian-descriptors/gitian-win32.yml +++ b/contrib/gitian-descriptors/gitian-win32.yml @@ -1,11 +1,12 @@ --- name: "bitcoin" suites: -- "lucid" +- "precise" architectures: -- "i386" +- "amd64" packages: -- "mingw32" +- "mingw-w64" +- "g++-mingw-w64" - "git-core" - "unzip" - "nsis" @@ -21,31 +22,33 @@ remotes: - "url": "https://github.com/bitcoin/bitcoin.git" "dir": "bitcoin" files: -- "qt-win32-4.8.3-gitian-r3.zip" -- "boost-win32-1.50.0-gitian3.zip" -- "bitcoin-deps-0.0.6.zip" -- "protobuf-win32-2.5.0-gitian-r2.zip" +- "qt-win32-4.8.3-gitian-r4.zip" +- "boost-win32-1.54.0-gitian-r6.zip" +- "bitcoin-deps-win32-gitian-r8.zip" +- "protobuf-win32-2.5.0-gitian-r3.zip" script: | # STAGING=$HOME/staging + HOST=i686-w64-mingw32 + # mkdir -p $STAGING cd $STAGING - unzip ../build/qt-win32-4.8.3-gitian-r3.zip - unzip ../build/boost-win32-1.50.0-gitian3.zip - unzip ../build/bitcoin-deps-0.0.6.zip - unzip ../build/protobuf-win32-2.5.0-gitian-r2.zip + unzip ../build/qt-win32-4.8.3-gitian-r4.zip + unzip ../build/boost-win32-1.54.0-gitian-r6.zip + unzip ../build/bitcoin-deps-win32-gitian-r8.zip + unzip ../build/protobuf-win32-2.5.0-gitian-r3.zip cd $HOME/build/ # cd bitcoin export PATH=$STAGING/host/bin:$PATH export TAR_OPTIONS=--mtime=`echo $REFERENCE_DATETIME | awk '{ print $1 }'` ./autogen.sh - ./configure --disable-debug --bindir=$OUTDIR --prefix=$STAGING --host=i586-mingw32msvc --with-qt-plugindir=$STAGING/plugins --with-qt-incdir=$STAGING/include --with-qt-bindir=$STAGING/host/bin --with-boost=$STAGING --disable-maintainer-mode --with-protoc-bindir=$STAGING/host/bin --disable-dependency-tracking CPPFLAGS="-I$STAGING/include" LDFLAGS="-L$STAGING/lib" CXXFLAGS="-frandom-seed=bitcoin" + ./configure --bindir=$OUTDIR --prefix=$STAGING --host=$HOST --with-qt-plugindir=$STAGING/plugins --with-qt-incdir=$STAGING/include --with-qt-bindir=$STAGING/host/bin --with-boost=$STAGING --disable-maintainer-mode --with-protoc-bindir=$STAGING/host/bin --disable-dependency-tracking CPPFLAGS="-I$STAGING/include" LDFLAGS="-L$STAGING/lib" CXXFLAGS="-frandom-seed=bitcoin" make dist mkdir -p distsrc cd distsrc tar --strip-components=1 -xf ../bitcoin-*.tar.* - ./configure --disable-debug --bindir=$OUTDIR --prefix=$STAGING --host=i586-mingw32msvc --with-qt-plugindir=$STAGING/plugins --with-qt-incdir=$STAGING/include --with-qt-bindir=$STAGING/host/bin --with-boost=$STAGING --disable-maintainer-mode --with-protoc-bindir=$STAGING/host/bin --disable-dependency-tracking CPPFLAGS="-I$STAGING/include" LDFLAGS="-L$STAGING/lib" CXXFLAGS="-frandom-seed=bitcoin" + ./configure --bindir=$OUTDIR --prefix=$STAGING --host=i686-w64-mingw32 --with-qt-plugindir=$STAGING/plugins --with-qt-incdir=$STAGING/include --with-qt-bindir=$STAGING/host/bin --with-boost=$STAGING --disable-maintainer-mode --with-protoc-bindir=$STAGING/host/bin --disable-dependency-tracking CPPFLAGS="-I$STAGING/include" LDFLAGS="-L$STAGING/lib" CXXFLAGS="-frandom-seed=bitcoin" export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export FAKETIME=$REFERENCE_DATETIME export TZ=UTC diff --git a/contrib/gitian-descriptors/gitian.yml b/contrib/gitian-descriptors/gitian.yml index aeebc7efd4..18e4cc2803 100644 --- a/contrib/gitian-descriptors/gitian.yml +++ b/contrib/gitian-descriptors/gitian.yml @@ -58,12 +58,12 @@ script: | cd bitcoin export TAR_OPTIONS=--mtime=`echo $REFERENCE_DATETIME | awk '{ print $1 }'` ./autogen.sh - ./configure --disable-debug --prefix=$STAGING --bindir=$OUTDIR --with-protoc-bindir=$STAGING/host/bin --disable-maintainer-mode --disable-dependency-tracking PKG_CONFIG_PATH="$STAGING/lib/pkgconfig" CPPFLAGS="-I$STAGING/include" LDFLAGS="-L$STAGING/lib" CXXFLAGS="-frandom-seed=bitcoin" + ./configure --prefix=$STAGING --bindir=$OUTDIR --with-protoc-bindir=$STAGING/host/bin --disable-maintainer-mode --disable-dependency-tracking PKG_CONFIG_PATH="$STAGING/lib/pkgconfig" CPPFLAGS="-I$STAGING/include" LDFLAGS="-L$STAGING/lib" CXXFLAGS="-frandom-seed=bitcoin" make dist mkdir -p distsrc cd distsrc tar --strip-components=1 -xf ../bitcoin-*.tar.* - ./configure --disable-debug --prefix=$STAGING --bindir=$OUTDIR --with-protoc-bindir=$STAGING/host/bin --disable-maintainer-mode --disable-dependency-tracking PKG_CONFIG_PATH="$STAGING/lib/pkgconfig" CPPFLAGS="-I$STAGING/include" LDFLAGS="-L$STAGING/lib" CXXFLAGS="-frandom-seed=bitcoin" + ./configure --prefix=$STAGING --bindir=$OUTDIR --with-protoc-bindir=$STAGING/host/bin --disable-maintainer-mode --disable-dependency-tracking PKG_CONFIG_PATH="$STAGING/lib/pkgconfig" CPPFLAGS="-I$STAGING/include" LDFLAGS="-L$STAGING/lib" CXXFLAGS="-frandom-seed=bitcoin" make $MAKEOPTS make $MAKEOPTS install-strip mkdir -p $OUTDIR/src diff --git a/contrib/gitian-descriptors/protobuf-win32.yml b/contrib/gitian-descriptors/protobuf-win32.yml index ad676e5654..35f261e1a2 100644 --- a/contrib/gitian-descriptors/protobuf-win32.yml +++ b/contrib/gitian-descriptors/protobuf-win32.yml @@ -1,11 +1,12 @@ --- name: "protobuf-win32" suites: -- "lucid" +- "precise" architectures: -- "i386" +- "amd64" packages: -- "mingw32" +- "mingw-w64" +- "g++-mingw-w64" - "zip" - "faketime" reference_datetime: "2013-04-15 00:00:00" @@ -14,11 +15,9 @@ files: - "protobuf-2.5.0.tar.bz2" script: | # - export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 - export FAKETIME=$REFERENCE_DATETIME export TZ=UTC export INSTALLPREFIX=$OUTDIR/staging/deps - export HOST=i586-mingw32msvc + export HOST=i686-w64-mingw32 # # mkdir -p $INSTALLPREFIX @@ -36,4 +35,8 @@ script: | make make install cd $INSTALLPREFIX - zip -r $OUTDIR/protobuf-win32-2.5.0-gitian-r2.zip include lib host + export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 + export FAKETIME=$REFERENCE_DATETIME + zip -r $OUTDIR/protobuf-win32-2.5.0-gitian-r3.zip include lib host + unset LD_PRELOAD + unset FAKETIME diff --git a/contrib/gitian-descriptors/qt-win32.yml b/contrib/gitian-descriptors/qt-win32.yml index 2bb5113d16..fb9134b3fe 100644 --- a/contrib/gitian-descriptors/qt-win32.yml +++ b/contrib/gitian-descriptors/qt-win32.yml @@ -1,11 +1,12 @@ --- name: "qt" suites: -- "lucid" +- "precise" architectures: -- "i386" +- "amd64" packages: -- "mingw32" +- "mingw-w64" +- "g++-mingw-w64" - "zip" - "unzip" - "faketime" @@ -14,34 +15,37 @@ reference_datetime: "2011-01-30 00:00:00" remotes: [] files: - "qt-everywhere-opensource-src-4.8.3.tar.gz" -- "bitcoin-deps-0.0.6.zip" +- "bitcoin-deps-win32-gitian-r8.zip" script: | + # + HOST=i686-w64-mingw32 INSTDIR="$HOME/qt/" + # mkdir $INSTDIR mkdir -p $INSTDIR/host/bin # # Need mingw-compiled openssl from bitcoin-deps: - unzip bitcoin-deps-0.0.6.zip + unzip bitcoin-deps-win32-gitian-r8.zip DEPSDIR=`pwd` # tar xzf qt-everywhere-opensource-src-4.8.3.tar.gz cd qt-everywhere-opensource-src-4.8.3 sed 's/$TODAY/2011-01-30/' -i configure - sed 's/i686-pc-mingw32-/i586-mingw32msvc-/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf - sed --posix 's|QMAKE_CFLAGS\t\t= -pipe|QMAKE_CFLAGS\t\t= -pipe -isystem /usr/i586-mingw32msvc/include/ -frandom-seed=qtbuild|' -i mkspecs/unsupported/win32-g++-cross/qmake.conf + sed 's/i686-pc-mingw32-/$HOST-/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf + sed --posix 's|QMAKE_CFLAGS\t\t= -pipe|QMAKE_CFLAGS\t\t= -pipe -isystem /usr/$HOST/include/ -frandom-seed=qtbuild|' -i mkspecs/unsupported/win32-g++-cross/qmake.conf sed 's/QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads/QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf sed 's/QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads/QMAKE_LFLAGS_EXCEPTIONS_ON = -lmingwthrd/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf - sed --posix 's/QMAKE_MOC\t\t= i586-mingw32msvc-moc/QMAKE_MOC\t\t= moc/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf - sed --posix 's/QMAKE_RCC\t\t= i586-mingw32msvc-rcc/QMAKE_RCC\t\t= rcc/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf - sed --posix 's/QMAKE_UIC\t\t= i586-mingw32msvc-uic/QMAKE_UIC\t\t= uic/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf + sed --posix 's/QMAKE_MOC\t\t= $HOST-moc/QMAKE_MOC\t\t= moc/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf + sed --posix 's/QMAKE_RCC\t\t= $HOST-rcc/QMAKE_RCC\t\t= rcc/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf + sed --posix 's/QMAKE_UIC\t\t= $HOST-uic/QMAKE_UIC\t\t= uic/' -i mkspecs/unsupported/win32-g++-cross/qmake.conf # ar adds timestamps to every object file included in the static library # providing -D as ar argument is supposed to solve it, but doesn't work as qmake strips off the arguments and adds -M to pass a script... # which somehow cannot be combined with other flags. # use faketime only for ar, as it confuses make/qmake into hanging sometimes - sed --posix "s|QMAKE_LIB\t\t= i586-mingw32msvc-ar -ru|QMAKE_LIB\t\t= $HOME/ar -Dr|" -i mkspecs/unsupported/win32-g++-cross/qmake.conf + sed --posix "s|QMAKE_LIB\t\t= $HOST-ar -ru|QMAKE_LIB\t\t= $HOME/ar -Dr|" -i mkspecs/unsupported/win32-g++-cross/qmake.conf echo '#!/bin/bash' > $HOME/ar echo 'export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1' >> $HOME/ar - echo 'i586-mingw32msvc-ar "$@"' >> $HOME/ar + echo '$HOST-ar "$@"' >> $HOME/ar chmod +x $HOME/ar #export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 export FAKETIME=$REFERENCE_DATETIME @@ -56,4 +60,4 @@ script: | # as zip stores file timestamps, use faketime to intercept stat calls to set dates for all files to reference date export LD_PRELOAD=/usr/lib/faketime/libfaketime.so.1 - zip -r $OUTDIR/qt-win32-4.8.3-gitian-r3.zip * + zip -r $OUTDIR/qt-win32-4.8.3-gitian-r4.zip * diff --git a/contrib/gitian-downloader/linux-download-config b/contrib/gitian-downloader/linux-download-config index 8340a5dd24..ae0377a704 100644 --- a/contrib/gitian-downloader/linux-download-config +++ b/contrib/gitian-downloader/linux-download-config @@ -39,4 +39,8 @@ signers: weight: 40 name: "Warren Togami" key: wtogami + 9692B91BBF0E8D34DFD33B1882C5C009628ECF0C: + weight: 1 + name: michagogo + key: michagogo minimum_weight: 120 diff --git a/contrib/gitian-downloader/michagogo-key.pgp b/contrib/gitian-downloader/michagogo-key.pgp new file mode 100644 index 0000000000..bc20629fa0 --- /dev/null +++ b/contrib/gitian-downloader/michagogo-key.pgp @@ -0,0 +1,27 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: SKS 1.1.0 + +mQENBFGeqJ4BCADb7SI3/+q93gIvN0AGRg9Mtz73OLIOzCHeeoyn+tp7JcYNzxkQ9lfeXiEf +n72Sh8gHkLtLIqr7HlIMo8DxSS8JPRVjlJGkNyAW4SeEwN2wNa5OV8k0N4jBa9a1csFyCyrE +kPKvkUpBkQDvNXjNxyEhHwyZqPanKxy6NXIHOJji8ObOMQXIT9HwJrpjRth3u4uKG968JBTE +yAXAmkt0Zidl1Ykgzcedk4mJSE9uZCW8DjSv2wMLXcQz8+dYsoskT3KRdkowLHxAfj1BNyNc +1+rKLghliM5vSQWi+Lbhi1Bxh4sY1UwAlKnAGqrnAGyIvCtkwTq5QI6ufF2ZY44bvVgpABEB +AAG0IU1pY2hhZ29nbyA8bWljaGFnb2dvQHNlcnZlci5mYWtlPokBOAQTAQIAIgUCUZ6ongIb +AwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQgsXACWKOzwzMUAgAuqUmK10xE5C3lUym +2f72z0t6a2NM5Wfjr9//Y1/okC36C5XAMEtN2UwckPzzJ5p5D5y5yzwfZq5Jd8Py29VQIMsV +7FbC1a0H3D+bCyX+JJ6FAmUbnWOQ/+mydYc74RvD8iwjePNT6kziZNv6dMGctJTl0alwjtQY +gyGkeYKnIxbcyjHX/IawLUrunb/6mSKun87T8+NM/omfFCTc3l8TakpM0wyNYRiUkIfUBvB8 +sDUU3A80qKN/hqRKvlFu3+/kMiAc9ZYQrbmsB+sYWdmM+4zw8NBw3yuYzWyPuoa4PR5ZmS9F +11WLMR5vTRCdLudAqYsWu3LtV6vAIvlOUa2LMLkBDQRRnqieAQgAxZoEe6BBpBRQeal57jWB +atZ1BgwIdHSzbQA9yehDMVGRF3Zqfg0BycOv3g0UGhvRG4zWYXsnG1VKCPCtmP2duvB0Lnhr +iBCCb+nGWF6F3Vgmww+H5xzDVF9sDZaQ6lsW+zzVBLX1PYSN4Jhxpa+TohId4ldOromYOJ9q +21j24+OZuSyc78KQq1APqS3JfV48NnGo2kk43Vx5PYL10wqOrNmUt/90OJfsbs2adTBjcz0B +wEjCrMHnEiSpGIOlvCOVrFZT3fWvKEAnPzX8+wT8N9TEVUf0heRQDKml8ebi8IIVXRwdonC1 +EbDrSZQnz/FtOoAe8kvjB+OSav6MQUYiQQARAQABiQEfBBgBAgAJBQJRnqieAhsMAAoJEILF +wAlijs8ME+MIAMuiAnJwWfZdo0rvpXcuexeo3+ZKSmYAfTVfFdpjADXmNcDEOFU1aVOLd7OB +Ni2LRjSTZD0FR27dT3+HRj2rLzD2hzGpoMIMqoGIsarNMQ+T3Ss1a3548E06/2QBXXHEj5r8 +uf4W2NIHkP/ps3Wy9O/sWk+fCSKBuZ8kgyoZglXjr4Q2bVzFQIRFgQzxIIfx/bBLgYDIGa83 +xNY96vNNqol3kLOlrWnVpUNUTfSKtWcyIurvfwYnxCESNKTv1sCjmXVy03phVKGpKHu7k9wO ++DferdBvS2VYoWGxKDvj3OSGhzwVeVS3kd0wdS554x1X/xcIvHJxsudJDVo3GzMhA2o= +=YdfZ +-----END PGP PUBLIC KEY BLOCK-----
\ No newline at end of file diff --git a/contrib/gitian-downloader/win32-download-config b/contrib/gitian-downloader/win32-download-config index 49d52851b6..1ead2fddcb 100644 --- a/contrib/gitian-downloader/win32-download-config +++ b/contrib/gitian-downloader/win32-download-config @@ -39,4 +39,8 @@ signers: weight: 40 name: "Warren Togami" key: wtogami + 9692B91BBF0E8D34DFD33B1882C5C009628ECF0C: + weight: 1 + name: michagogo + key: michagogo minimum_weight: 120 diff --git a/contrib/homebrew/bitcoin.qt.pro.patch b/contrib/homebrew/bitcoin.qt.pro.patch deleted file mode 100644 index 1001f29065..0000000000 --- a/contrib/homebrew/bitcoin.qt.pro.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro -index d938c07..e1dd4ec 100644 ---- a/bitcoin-qt.pro -+++ b/bitcoin-qt.pro -@@ -353,7 +353,7 @@ - } - - isEmpty(BDB_LIB_PATH) { -- macx:BDB_LIB_PATH = /opt/local/lib/db48 -+ macx:BDB_LIB_PATH = /usr/local/opt/berkeley-db4/lib - } - - isEmpty(BDB_LIB_SUFFIX) { -@@ -361,15 +361,15 @@ - } - - isEmpty(BDB_INCLUDE_PATH) { -- macx:BDB_INCLUDE_PATH = /opt/local/include/db48 -+ macx:BDB_INCLUDE_PATH = /usr/local/opt/berkeley-db4/include - } - - isEmpty(BOOST_LIB_PATH) { -- macx:BOOST_LIB_PATH = /opt/local/lib -+ macx:BOOST_LIB_PATH = /usr/local/opt/boost/lib - } - - isEmpty(BOOST_INCLUDE_PATH) { -- macx:BOOST_INCLUDE_PATH = /opt/local/include -+ macx:BOOST_INCLUDE_PATH = /usr/local/opt/boost/include - } - - win32:DEFINES += WIN32 diff --git a/contrib/homebrew/makefile.osx.patch b/contrib/homebrew/makefile.osx.patch deleted file mode 100644 index 287db2fdf2..0000000000 --- a/contrib/homebrew/makefile.osx.patch +++ /dev/null @@ -1,48 +0,0 @@ -diff --git a/src/makefile.osx b/src/makefile.osx -index bef0ef3..07ef8d3 100644 ---- a/src/makefile.osx -+++ b/src/makefile.osx -@@ -7,17 +7,21 @@ - # Originally by Laszlo Hanyecz (solar@heliacal.net) - - CXX=llvm-g++ --DEPSDIR=/opt/local -+DEPSDIR=/usr/local -+DB4DIR=/usr/local/opt/berkeley-db4 -+OPENSSLDIR=/usr/local/opt/openssl - - INCLUDEPATHS= \ - -I"$(CURDIR)" \ -- -I"$(CURDIR)"/obj \ -+ -I"$(CURDIR)/obj" \ - -I"$(DEPSDIR)/include" \ -- -I"$(DEPSDIR)/include/db48" -+ -I"$(DB4DIR)/include" \ -+ -I"$(OPENSSLDIR)/include" - - LIBPATHS= \ - -L"$(DEPSDIR)/lib" \ -- -L"$(DEPSDIR)/lib/db48" -+ -L"$(DB4DIR)/lib" \ -+ -L"$(OPENSSLDIR)/lib" - - USE_UPNP:=1 - USE_IPV6:=1 -@@ -31,14 +35,14 @@ ifdef STATIC - TESTLIBS += \ - $(DEPSDIR)/lib/libboost_unit_test_framework-mt.a - LIBS += \ -- $(DEPSDIR)/lib/db48/libdb_cxx-4.8.a \ -+ $(DB4DIR)/lib/libdb_cxx-4.8.a \ - $(DEPSDIR)/lib/libboost_system-mt.a \ - $(DEPSDIR)/lib/libboost_filesystem-mt.a \ - $(DEPSDIR)/lib/libboost_program_options-mt.a \ - $(DEPSDIR)/lib/libboost_thread-mt.a \ - $(DEPSDIR)/lib/libboost_chrono-mt.a \ -- $(DEPSDIR)/lib/libssl.a \ -- $(DEPSDIR)/lib/libcrypto.a \ -+ $(OPENSSLDIR)/lib/libssl.a \ -+ $(OPENSSLDIR)/lib/libcrypto.a \ - -lz - else - TESTLIBS += \ diff --git a/doc/release-process.md b/doc/release-process.md index 57a3c9d91f..85d2e0df61 100644 --- a/doc/release-process.md +++ b/doc/release-process.md @@ -42,18 +42,20 @@ Release Process wget 'http://zlib.net/zlib-1.2.6.tar.gz' wget 'ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.9.tar.gz' wget 'http://fukuchi.org/works/qrencode/qrencode-3.2.0.tar.bz2' - wget 'http://downloads.sourceforge.net/project/boost/boost/1.50.0/boost_1_50_0.tar.bz2' + wget 'http://downloads.sourceforge.net/project/boost/boost/1.54.0/boost_1_54_0.tar.bz2' + wget 'https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/boost-mingw.patch' -O \ + boost-mingw-gas-cross-compile-2013-03-03.patch wget 'http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-4.8.3.tar.gz' wget 'http://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2' cd .. ./bin/gbuild ../bitcoin/contrib/gitian-descriptors/boost-win32.yml - mv build/out/boost-win32-1.50.0-gitian2.zip inputs/ + mv build/out/boost-win32-*.zip inputs/ ./bin/gbuild ../bitcoin/contrib/gitian-descriptors/qt-win32.yml - mv build/out/qt-win32-4.8.3-gitian-r2.zip inputs/ + mv build/out/qt-win32-*.zip inputs/ ./bin/gbuild ../bitcoin/contrib/gitian-descriptors/deps-win32.yml - mv build/out/bitcoin-deps-0.0.5.zip inputs/ + mv build/out/bitcoin-deps-*.zip inputs/ ./bin/gbuild ../bitcoin/contrib/gitian-descriptors/protobuf-win32.yml - mv build/out/protobuf-win32-2.5.0-gitian-r1.zip inputs/ + mv build/out/protobuf-win32-*.zip inputs/ Build bitcoind and bitcoin-qt on Linux32, Linux64, and Win32: diff --git a/qa/pull-tester/pull-tester.py b/qa/pull-tester/pull-tester.py new file mode 100755 index 0000000000..fe50177a24 --- /dev/null +++ b/qa/pull-tester/pull-tester.py @@ -0,0 +1,182 @@ +#!/usr/bin/python +import json +from urllib import urlopen +import requests +import getpass +from string import Template +import sys +import os +import subprocess + +class RunError(Exception): + def __init__(self, value): + self.value = value + def __str__(self): + return repr(self.value) + +def run(command, **kwargs): + fail_hard = kwargs.pop("fail_hard", True) + # output to /dev/null by default: + kwargs.setdefault("stdout", open('/dev/null', 'w')) + kwargs.setdefault("stderr", open('/dev/null', 'w')) + command = Template(command).substitute(os.environ) + if "TRACE" in os.environ: + if 'cwd' in kwargs: + print("[cwd=%s] %s"%(kwargs['cwd'], command)) + else: print(command) + try: + process = subprocess.Popen(command.split(' '), **kwargs) + process.wait() + except KeyboardInterrupt: + process.terminate() + raise + if process.returncode != 0 and fail_hard: + raise RunError("Failed: "+command) + return process.returncode + +def checkout_pull(clone_url, commit, out): + # Init + build_dir=os.environ["BUILD_DIR"] + run("umount ${CHROOT_COPY}/proc", fail_hard=False) + run("rsync --delete -apv ${CHROOT_MASTER} ${CHROOT_COPY}") + run("rm -rf ${CHROOT_COPY}${SCRIPTS_DIR}") + run("cp -a ${SCRIPTS_DIR} ${CHROOT_COPY}${SCRIPTS_DIR}") + # Merge onto upstream/master + run("rm -rf ${BUILD_DIR}") + run("mkdir -p ${BUILD_DIR}") + run("git clone ${CLONE_URL} ${BUILD_DIR}") + run("git remote add pull "+clone_url, cwd=build_dir, stdout=out, stderr=out) + run("git fetch pull", cwd=build_dir, stdout=out, stderr=out) + if run("git merge "+ commit, fail_hard=False, cwd=build_dir, stdout=out, stderr=out) != 0: + return False + run("chown -R ${BUILD_USER}:${BUILD_GROUP} ${BUILD_DIR}", stdout=out, stderr=out) + run("mount --bind /proc ${CHROOT_COPY}/proc") + return True + +def commentOn(commentUrl, success, inMerge, needTests, linkUrl): + common_message = """ +This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ +Contact BlueMatt on freenode if something looks broken.""" + + # Remove old BitcoinPullTester comments (I'm being lazy and not paginating here) + recentcomments = requests.get(commentUrl+"?sort=created&direction=desc", + auth=(os.environ['GITHUB_USER'], os.environ["GITHUB_AUTH_TOKEN"])).json + for comment in recentcomments: + if comment["user"]["login"] == os.environ["GITHUB_USER"] and common_message in comment["body"]: + requests.delete(comment["url"], + auth=(os.environ['GITHUB_USER'], os.environ["GITHUB_AUTH_TOKEN"])) + + if success == True: + post_data = { "body" : "Automatic sanity-testing: PASSED, see " + linkUrl + " for binaries and test log." + common_message} + elif inMerge: + post_data = { "body" : "Automatic sanity-testing: FAILED MERGE, see " + linkUrl + " for test log." + """ + +This pull does not merge cleanly onto current master""" + common_message} + else: + post_data = { "body" : "Automatic sanity-testing: FAILED BUILD/TEST, see " + linkUrl + " for binaries and test log." + """ + +This could happen for one of several reasons: +1. It chanages paths in makefile.linux-mingw or otherwise changes build scripts in a way that made them incompatible with the automated testing scripts (please tweak those patches in qa/pull-tester) +2. It adds/modifies tests which test network rules (thanks for doing that), which conflicts with a patch applied at test time +3. It does not build on either Linux i386 or Win32 (via MinGW cross compile) +4. The test suite fails on either Linux i386 or Win32 +5. The block test-cases failed (lookup the first bNN identifier which failed in https://github.com/TheBlueMatt/test-scripts/blob/master/FullBlockTestGenerator.java) + +If you believe this to be in error, please ping BlueMatt on freenode or TheBlueMatt here. +""" + common_message} + + resp = requests.post(commentUrl, json.dumps(post_data), auth=(os.environ['GITHUB_USER'], os.environ["GITHUB_AUTH_TOKEN"])) + +def testpull(number, comment_url, clone_url, commit): + print("Testing pull %d: %s : %s"%(number, clone_url,commit)) + + dir = os.environ["RESULTS_DIR"] + "/" + commit + "/" + print(" ouput to %s"%dir) + if os.path.exists(dir): + os.system("rm -r " + dir) + os.makedirs(dir) + currentdir = os.environ["RESULTS_DIR"] + "/current" + os.system("rm -r "+currentdir) + os.system("ln -s " + dir + " " + currentdir) + out = open(dir + "test.log", 'w+') + + resultsurl = os.environ["RESULTS_URL"] + commit + checkedout = checkout_pull(clone_url, commit, out) + if checkedout != True: + print("Failed to test pull - sending comment to: " + comment_url) + commentOn(comment_url, False, True, False, resultsurl) + open(os.environ["TESTED_DB"], "a").write(commit + "\n") + return + + # New: pull-tester.sh script(s) are in the tree: + script = os.environ["BUILD_PATH"]+"/qa/pull-tester/pull-tester.sh" + script += " ${BUILD_PATH} ${MINGW_DEPS_DIR} ${SCRIPTS_DIR}/BitcoindComparisonTool.jar 1" + returncode = run("chroot ${CHROOT_COPY} sudo -u ${BUILD_USER} -H timeout ${TEST_TIMEOUT} "+script, + fail_hard=False, stdout=out, stderr=out) + + run("mv ${BUILD_DIR} " + dir) + # TODO: FIXME + # Idea: have run-script save interesting output... + # run("cp /mnt/chroot-tmp/home/ubuntu/.bitcoin/regtest/debug.log " + dir) + # os.system("chmod +r " + dir + "/debug.log") + if returncode == 42: + print("Successfully tested pull (needs tests) - sending comment to: " + comment_url) + commentOn(comment_url, True, False, True, resultsurl) + elif returncode != 0: + print("Failed to test pull - sending comment to: " + comment_url) + commentOn(comment_url, False, False, False, resultsurl) + else: + print("Successfully tested pull - sending comment to: " + comment_url) + commentOn(comment_url, True, False, False, resultsurl) + open(os.environ["TESTED_DB"], "a").write(commit + "\n") + +def environ_default(setting, value): + if not setting in os.environ: + os.environ[setting] = value + +if getpass.getuser() != "root": + print("Run me as root!") + sys.exit(1) + +if "GITHUB_USER" not in os.environ or "GITHUB_AUTH_TOKEN" not in os.environ: + print("GITHUB_USER and/or GITHUB_AUTH_TOKEN environment variables not set") + sys.exit(1) + +environ_default("CLONE_URL", "https://github.com/bitcoin/bitcoin.git") +environ_default("MINGW_DEPS_DIR", "/mnt/w32deps") +environ_default("SCRIPTS_DIR", "/mnt/test-scripts") +environ_default("CHROOT_COPY", "/mnt/chroot-tmp") +environ_default("CHROOT_MASTER", "/mnt/chroot") +environ_default("BUILD_PATH", "/mnt/bitcoin") +os.environ["BUILD_DIR"] = os.environ["CHROOT_COPY"] + os.environ["BUILD_PATH"] +environ_default("RESULTS_DIR", "/mnt/www/pull-tester") +environ_default("RESULTS_URL", "http://jenkins.bluematt.me/pull-tester/") +environ_default("GITHUB_REPO", "bitcoin/bitcoin") +environ_default("TESTED_DB", "/mnt/commits-tested.txt") +environ_default("BUILD_USER", "matt") +environ_default("BUILD_GROUP", "matt") +environ_default("TEST_TIMEOUT", str(60*60*2)) + +print("Optional usage: pull-tester.py 2112") + +f = open(os.environ["TESTED_DB"]) +tested = set( line.rstrip() for line in f.readlines() ) +f.close() + +if len(sys.argv) > 1: + pull = requests.get("https://api.github.com/repos/"+os.environ["GITHUB_REPO"]+"/pulls/"+sys.argv[1], + auth=(os.environ['GITHUB_USER'], os.environ["GITHUB_AUTH_TOKEN"])).json + testpull(pull["number"], pull["_links"]["comments"]["href"], + pull["head"]["repo"]["clone_url"], pull["head"]["sha"]) + +else: + for page in range(1,100): + result = requests.get("https://api.github.com/repos/"+os.environ["GITHUB_REPO"]+"/pulls?state=open&page=%d"%(page,), + auth=(os.environ['GITHUB_USER'], os.environ["GITHUB_AUTH_TOKEN"])).json + if len(result) == 0: break; + for pull in result: + if pull["head"]["sha"] in tested: + print("Pull %d already tested"%(pull["number"],)) + continue + testpull(pull["number"], pull["_links"]["comments"]["href"], + pull["head"]["repo"]["clone_url"], pull["head"]["sha"]) diff --git a/share/qt/extract_strings_qt.py b/share/qt/extract_strings_qt.py index a7bfc1f9fa..c9a96b21fe 100755 --- a/share/qt/extract_strings_qt.py +++ b/share/qt/extract_strings_qt.py @@ -50,7 +50,7 @@ def parse_po(text): files = glob.glob('src/*.cpp') + glob.glob('src/*.h') # xgettext -n --keyword=_ $FILES -XGETTEXT=os.getenv('XGETTEXT', 'gettext') +XGETTEXT=os.getenv('XGETTEXT', 'xgettext') child = Popen([XGETTEXT,'--output=-','-n','--keyword=_'] + files, stdout=PIPE) (out, err) = child.communicate() diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index b61e0d37ab..f9e0c476f6 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -1223,6 +1223,7 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri if (strMethod == "createrawtransaction" && n > 1) ConvertTo<Object>(params[1]); if (strMethod == "signrawtransaction" && n > 1) ConvertTo<Array>(params[1], true); if (strMethod == "signrawtransaction" && n > 2) ConvertTo<Array>(params[2], true); + if (strMethod == "sendrawtransaction" && n > 1) ConvertTo<bool>(params[1], true); if (strMethod == "gettxout" && n > 1) ConvertTo<boost::int64_t>(params[1]); if (strMethod == "gettxout" && n > 2) ConvertTo<bool>(params[2]); if (strMethod == "lockunspent" && n > 0) ConvertTo<bool>(params[0]); diff --git a/src/core.h b/src/core.h index 1b9d4dd765..ce21acd59e 100644 --- a/src/core.h +++ b/src/core.h @@ -389,7 +389,9 @@ public: int nVersion; // construct a CCoins from a CTransaction, at a given height - CCoins(const CTransaction &tx, int nHeightIn) : fCoinBase(tx.IsCoinBase()), vout(tx.vout), nHeight(nHeightIn), nVersion(tx.nVersion) { } + CCoins(const CTransaction &tx, int nHeightIn) : fCoinBase(tx.IsCoinBase()), vout(tx.vout), nHeight(nHeightIn), nVersion(tx.nVersion) { + ClearUnspendable(); + } // empty constructor CCoins() : fCoinBase(false), vout(0), nHeight(0), nVersion(0) { } @@ -402,6 +404,14 @@ public: std::vector<CTxOut>().swap(vout); } + void ClearUnspendable() { + BOOST_FOREACH(CTxOut &txout, vout) { + if (txout.scriptPubKey.IsUnspendable()) + txout.SetNull(); + } + Cleanup(); + } + void swap(CCoins &to) { std::swap(to.fCoinBase, fCoinBase); to.vout.swap(vout); diff --git a/src/key.cpp b/src/key.cpp index 85dc9cda2b..8ef1c414c4 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -199,17 +199,19 @@ public: ECDSA_SIG *sig = ECDSA_do_sign((unsigned char*)&hash, sizeof(hash), pkey); if (sig == NULL) return false; - if (BN_is_odd(sig->s)) { - // enforce even S values, by negating the value (modulo the order) if odd - BN_CTX *ctx = BN_CTX_new(); - BN_CTX_start(ctx); - const EC_GROUP *group = EC_KEY_get0_group(pkey); - BIGNUM *order = BN_CTX_get(ctx); - EC_GROUP_get_order(group, order, ctx); + BN_CTX *ctx = BN_CTX_new(); + BN_CTX_start(ctx); + const EC_GROUP *group = EC_KEY_get0_group(pkey); + BIGNUM *order = BN_CTX_get(ctx); + BIGNUM *halforder = BN_CTX_get(ctx); + EC_GROUP_get_order(group, order, ctx); + BN_rshift1(halforder, order); + if (BN_cmp(sig->s, halforder) > 0) { + // enforce low S values, by negating the value (modulo the order) if above order/2. BN_sub(sig->s, order, sig->s); - BN_CTX_end(ctx); - BN_CTX_free(ctx); } + BN_CTX_end(ctx); + BN_CTX_free(ctx); unsigned int nSize = ECDSA_size(pkey); vchSig.resize(nSize); // Make sure it is big enough unsigned char *pos = &vchSig[0]; diff --git a/src/main.cpp b/src/main.cpp index 61d457eafc..dc690111e6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -67,9 +67,6 @@ CScript COINBASE_FLAGS; const string strMessageMagic = "Bitcoin Signed Message:\n"; -double dHashesPerSec = 0.0; -int64 nHPSTimerStart = 0; - // Settings int64 nTransactionFee = 0; @@ -787,7 +784,7 @@ void CTxMemPool::pruneSpent(const uint256 &hashTx, CCoins &coins) } bool CTxMemPool::accept(CValidationState &state, const CTransaction &tx, bool fLimitFree, - bool* pfMissingInputs) + bool* pfMissingInputs, bool fRejectInsaneFee) { if (pfMissingInputs) *pfMissingInputs = false; @@ -921,6 +918,11 @@ bool CTxMemPool::accept(CValidationState &state, const CTransaction &tx, bool fL dFreeCount += nSize; } + if (fRejectInsaneFee && nFees > CTransaction::nMinRelayTxFee * 10000) + return error("CTxMemPool::accept() : insane fees %s, %"PRI64d" > %"PRI64d, + hash.ToString().c_str(), + nFees, CTransaction::nMinRelayTxFee * 10000); + // Check against previous transactions // This is done last to help prevent CPU exhaustion denial-of-service attacks. if (!CheckInputs(tx, state, view, true, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC)) @@ -1776,6 +1778,7 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex view.SetCoins(hash, CCoins()); } CCoins &outs = view.GetCoins(hash); + outs.ClearUnspendable(); CCoins outsBlock = CCoins(tx, pindex->nHeight); // The CCoins serialization does not serialize negative numbers. diff --git a/src/main.h b/src/main.h index 952917cebe..83b0d07f63 100644 --- a/src/main.h +++ b/src/main.h @@ -86,8 +86,6 @@ extern unsigned int nTransactionsUpdated; extern uint64 nLastBlockTx; extern uint64 nLastBlockSize; extern const std::string strMessageMagic; -extern double dHashesPerSec; -extern int64 nHPSTimerStart; extern int64 nTimeBestReceived; extern CCriticalSection cs_setpwalletRegistered; extern std::set<CWallet*> setpwalletRegistered; @@ -655,7 +653,7 @@ public: if (nBlocks==0 || nTimeFirst > nTimeIn) nTimeFirst = nTimeIn; nBlocks++; - if (nHeightIn > nHeightFirst) + if (nHeightIn > nHeightLast) nHeightLast = nHeightIn; if (nTimeIn > nTimeLast) nTimeLast = nTimeIn; @@ -1086,7 +1084,7 @@ public: std::map<uint256, CTransaction> mapTx; std::map<COutPoint, CInPoint> mapNextTx; - bool accept(CValidationState &state, const CTransaction &tx, bool fLimitFree, bool* pfMissingInputs); + bool accept(CValidationState &state, const CTransaction &tx, bool fLimitFree, bool* pfMissingInputs, bool fRejectInsaneFee = false); bool addUnchecked(const uint256& hash, const CTransaction &tx); bool remove(const CTransaction &tx, bool fRecursive = false); bool removeConflicts(const CTransaction &tx); @@ -1214,7 +1212,7 @@ public: @see CTransaction::FetchInputs */ int64 GetValueIn(const CTransaction& tx); - + // Check whether all prevouts of the transaction are present in the UTXO set represented by this view bool HaveInputs(const CTransaction& tx); diff --git a/src/miner.cpp b/src/miner.cpp index 5f79fedba2..30c600071f 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -3,15 +3,11 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "core.h" -#include "wallet.h" #include "miner.h" #include "main.h" - - - - +double dHashesPerSec = 0.0; +int64 nHPSTimerStart = 0; ////////////////////////////////////////////////////////////////////////////// // diff --git a/src/miner.h b/src/miner.h index 36d58be00f..7e60b9e53b 100644 --- a/src/miner.h +++ b/src/miner.h @@ -22,4 +22,7 @@ bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey); /** Base sha256 mining transform */ void SHA256Transform(void* pstate, void* pinput, const void* pinit); +extern double dHashesPerSec; +extern int64 nHPSTimerStart; + #endif // BITCOIN_MINER_H diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index f184fb9ef0..78693971da 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -155,11 +155,14 @@ static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTrans #if QT_VERSION < 0x050000 void DebugMessageHandler(QtMsgType type, const char * msg) { + Q_UNUSED(type); LogPrint("qt", "Bitcoin-Qt: %s\n", msg); } #else void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString &msg) { + Q_UNUSED(type); + Q_UNUSED(context); LogPrint("qt", "Bitcoin-Qt: %s\n", qPrintable(msg)); } #endif diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index bb9eb60e5b..5afd93957b 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -590,21 +590,28 @@ void BitcoinGUI::message(const QString &title, const QString &message, unsigned int nMBoxIcon = QMessageBox::Information; int nNotifyIcon = Notificator::Information; - // Override title based on style QString msgType; - switch (style) { - case CClientUIInterface::MSG_ERROR: - msgType = tr("Error"); - break; - case CClientUIInterface::MSG_WARNING: - msgType = tr("Warning"); - break; - case CClientUIInterface::MSG_INFORMATION: - msgType = tr("Information"); - break; - default: - msgType = title; // Use supplied title + + // Prefer supplied title over style based title + if (!title.isEmpty()) { + msgType = title; } + else { + switch (style) { + case CClientUIInterface::MSG_ERROR: + msgType = tr("Error"); + break; + case CClientUIInterface::MSG_WARNING: + msgType = tr("Warning"); + break; + case CClientUIInterface::MSG_INFORMATION: + msgType = tr("Information"); + break; + default: + break; + } + } + // Append title to "Bitcoin - " if (!msgType.isEmpty()) strTitle += " - " + msgType; @@ -625,7 +632,7 @@ void BitcoinGUI::message(const QString &title, const QString &message, unsigned if (!(buttons = (QMessageBox::StandardButton)(style & CClientUIInterface::BTN_MASK))) buttons = QMessageBox::Ok; - QMessageBox mBox((QMessageBox::Icon)nMBoxIcon, strTitle, message, buttons); + QMessageBox mBox((QMessageBox::Icon)nMBoxIcon, strTitle, message, buttons, this); int r = mBox.exec(); if (ret != NULL) *ret = r == QMessageBox::Ok; @@ -744,13 +751,9 @@ void BitcoinGUI::handlePaymentRequest(const SendCoinsRecipient& recipient) walletFrame->handlePaymentRequest(recipient); } -void BitcoinGUI::showPaymentACK(QString msg) +void BitcoinGUI::showPaymentACK(const QString& msg) { -#if QT_VERSION < 0x050000 - message(tr("Payment acknowledged"), Qt::escape(msg), CClientUIInterface::MODAL); -#else - message(tr("Payment acknowledged"), msg.toHtmlEscaped(), CClientUIInterface::MODAL); -#endif + message(tr("Payment acknowledged"), GUIUtil::HtmlEscape(msg), CClientUIInterface::MODAL); } void BitcoinGUI::setEncryptionStatus(int status) diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index fc25e867fc..e2dd5dc6bc 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -154,7 +154,7 @@ public slots: void askFee(qint64 nFeeRequired, bool *payFee); void handlePaymentRequest(const SendCoinsRecipient& recipient); - void showPaymentACK(QString msg); + void showPaymentACK(const QString& msg); /** Show incoming transaction notification for new transactions. */ void incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address); diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index f7dd8adb6b..b33f534f7c 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -24,9 +24,8 @@ ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) : numBlocksAtStartup(-1), pollTimer(0) { pollTimer = new QTimer(this); - pollTimer->setInterval(MODEL_UPDATE_DELAY); - pollTimer->start(); connect(pollTimer, SIGNAL(timeout()), this, SLOT(updateTimer())); + pollTimer->start(MODEL_UPDATE_DELAY); subscribeToCoreSignals(); } diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index 6e17565ab0..2a00fc5455 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -28,7 +28,7 @@ <height>165</height> </rect> </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> + <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1"> <property name="margin"> <number>0</number> </property> diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 1dcecbe60b..bda39b675f 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -143,7 +143,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact foreach(const SendCoinsRecipient &rcp, recipients) { if (rcp.paymentRequest.IsInitialized()) - { // PaymentRequest... + { // PaymentRequest... int64 subtotal = 0; const payments::PaymentDetails& details = rcp.paymentRequest.getDetails(); for (int i = 0; i < details.outputs_size(); i++) diff --git a/src/qt/walletmodeltransaction.cpp b/src/qt/walletmodeltransaction.cpp index 96fc3edbb2..706ed60b77 100644 --- a/src/qt/walletmodeltransaction.cpp +++ b/src/qt/walletmodeltransaction.cpp @@ -32,7 +32,7 @@ qint64 WalletModelTransaction::getTransactionFee() void WalletModelTransaction::setTransactionFee(qint64 newFee) { - fee=newFee; + fee = newFee; } qint64 WalletModelTransaction::getTotalTransactionAmount() @@ -40,7 +40,7 @@ qint64 WalletModelTransaction::getTotalTransactionAmount() qint64 totalTransactionAmount = 0; foreach(const SendCoinsRecipient &rcp, recipients) { - totalTransactionAmount+=rcp.amount; + totalTransactionAmount += rcp.amount; } return totalTransactionAmount; } diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index 5f33849f77..ce9d60e667 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -518,9 +518,9 @@ Value signrawtransaction(const Array& params, bool fHelp) Value sendrawtransaction(const Array& params, bool fHelp) { - if (fHelp || params.size() < 1 || params.size() > 1) + if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( - "sendrawtransaction <hex string>\n" + "sendrawtransaction <hex string> [allowhighfees=false]\n" "Submits raw transaction (serialized, hex-encoded) to local node and network."); // parse hex string from parameter @@ -528,6 +528,10 @@ Value sendrawtransaction(const Array& params, bool fHelp) CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION); CTransaction tx; + bool fOverrideFees = false; + if (params.size() > 1) + fOverrideFees = params[1].get_bool(); + // deserialize binary data stream try { ssData >> tx; @@ -545,7 +549,7 @@ Value sendrawtransaction(const Array& params, bool fHelp) if (!fHave) { // push to local node CValidationState state; - if (!mempool.accept(state, tx, false, NULL)) + if (!mempool.accept(state, tx, false, NULL, !fOverrideFees)) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX rejected"); // TODO: report validation state } } diff --git a/src/script.h b/src/script.h index f5ed611548..842b8512eb 100644 --- a/src/script.h +++ b/src/script.h @@ -553,6 +553,13 @@ public: return true; } + // Returns whether the script is guaranteed to fail at execution, + // regardless of the initial stack. This allows outputs to be pruned + // instantly when entering the UTXO set. + bool IsUnspendable() const + { + return (size() > 0 && *begin() == OP_RETURN); + } void SetDestination(const CTxDestination& address); void SetMultisig(int nRequired, const std::vector<CPubKey>& keys); diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp index 8183504147..eeeacb0ad4 100644 --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -83,6 +83,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) // Just to make sure we can still make simple blocks BOOST_CHECK(pblocktemplate = CreateNewBlockWithKey(reservekey)); + delete pblocktemplate; // block sigops > limit: 1000 CHECKMULTISIG + 1 tx.vin.resize(1); @@ -200,6 +201,9 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) BOOST_CHECK(pblocktemplate = CreateNewBlockWithKey(reservekey)); delete pblocktemplate; pindexBest->nHeight = nHeight; + + BOOST_FOREACH(CTransaction *tx, txFirst) + delete tx; } BOOST_AUTO_TEST_CASE(sha256transform_equality) diff --git a/src/test/wallet_tests.cpp b/src/test/wallet_tests.cpp index a14f6b2b70..51f3b27c8b 100644 --- a/src/test/wallet_tests.cpp +++ b/src/test/wallet_tests.cpp @@ -289,6 +289,7 @@ BOOST_AUTO_TEST_CASE(coin_selection_tests) BOOST_CHECK_NE(fails, RANDOM_REPEATS); } } + empty_wallet(); } BOOST_AUTO_TEST_SUITE_END() diff --git a/src/util.cpp b/src/util.cpp index 281ced2fa9..73428b4c22 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -198,15 +198,7 @@ uint256 GetRandHash() return hash; } - - - - - - -// -// OutputDebugStringF (aka printf -- there is a #define that we really -// should get rid of one day) has been broken a couple of times now +// LogPrintf() has been broken a couple of times now // by well-meaning people adding mutexes in the most straightforward way. // It breaks because it may be called by global destructors during shutdown. // Since the order of destruction of static/global objects is undefined, @@ -1065,7 +1057,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific) fs::path &path = pathCached[nNet]; - // This can be called during exceptions by printf, so we cache the + // This can be called during exceptions by LogPrintf(), so we cache the // value so we don't have to do memory allocations after that. if (!path.empty()) return path; diff --git a/src/wallet.cpp b/src/wallet.cpp index 91de93da7a..26ffc71e19 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1145,11 +1145,11 @@ bool CWallet::SelectCoinsMinConf(int64 nTargetValue, int nConfMine, int nConfThe nValueRet += vValue[i].first; } - LogPrintf("selectcoins", "SelectCoins() best subset: "); + LogPrint("selectcoins", "SelectCoins() best subset: "); for (unsigned int i = 0; i < vValue.size(); i++) if (vfBest[i]) - LogPrintf("selectcoins", "%s ", FormatMoney(vValue[i].first).c_str()); - LogPrintf("selectcoins", "total %s\n", FormatMoney(nBest).c_str()); + LogPrint("selectcoins", "%s ", FormatMoney(vValue[i].first).c_str()); + LogPrint("selectcoins", "total %s\n", FormatMoney(nBest).c_str()); } return true; |