Rename CClaimTrieCache to CClaimTrieUpdateBuffer #156
219 changed files with 5234 additions and 3745 deletions
15
Makefile.am
15
Makefile.am
|
@ -15,10 +15,11 @@ BITCOIN_CLI_BIN=$(top_builddir)/src/bitcoin-cli$(EXEEXT)
|
|||
BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win$(WINDOWS_BITS)-setup$(EXEEXT)
|
||||
|
||||
OSX_APP=Bitcoin-Qt.app
|
||||
OSX_DMG=Bitcoin-Qt.dmg
|
||||
OSX_DMG=Bitcoin-Core.dmg
|
||||
OSX_BACKGROUND_IMAGE=background.tiff
|
||||
OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
|
||||
OSX_FANCY_PLIST=$(top_srcdir)/contrib/macdeploy/fancy.plist
|
||||
OSX_BASE_LPROJ_DIR=$(top_srcdir)/contrib/macdeploy/Base.lproj/InfoPlist.strings
|
||||
OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns
|
||||
OSX_PLIST=$(top_srcdir)/share/qt/Info.plist #not installed
|
||||
OSX_QT_TRANSLATIONS = da,de,es,hu,ru,uk,zh_CN,zh_TW
|
||||
|
@ -30,7 +31,7 @@ WINDOWS_PACKAGING = $(top_srcdir)/share/pixmaps/bitcoin.ico \
|
|||
$(top_srcdir)/share/pixmaps/nsis-wizard.bmp \
|
||||
$(top_srcdir)/doc/README_windows.txt
|
||||
|
||||
OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) \
|
||||
OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) $(OSX_BASE_LPROJ_DIR) \
|
||||
$(top_srcdir)/contrib/macdeploy/$(OSX_BACKGROUND_IMAGE) \
|
||||
$(top_srcdir)/contrib/macdeploy/DS_Store \
|
||||
$(top_srcdir)/contrib/macdeploy/detached-sig-apply.sh \
|
||||
|
@ -72,7 +73,7 @@ $(OSX_APP)/Contents/PkgInfo:
|
|||
|
||||
$(OSX_APP)/Contents/Resources/empty.lproj:
|
||||
$(MKDIR_P) $(@D)
|
||||
@touch $@
|
||||
@touch $@
|
||||
|
||||
$(OSX_APP)/Contents/Info.plist: $(OSX_PLIST)
|
||||
$(MKDIR_P) $(@D)
|
||||
|
@ -86,9 +87,13 @@ $(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(BITCOIN_QT_BIN)
|
|||
$(MKDIR_P) $(@D)
|
||||
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $< $@
|
||||
|
||||
$(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings: $(OSX_BASE_LPROJ_DIR)
|
||||
$(MKDIR_P) $(@D)
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \
|
||||
$(OSX_APP)/Contents/Resources/bitcoin.icns $(OSX_APP)/Contents/Info.plist \
|
||||
$(OSX_APP)/Contents/MacOS/Bitcoin-Qt
|
||||
$(OSX_APP)/Contents/MacOS/Bitcoin-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings
|
||||
|
||||
if BUILD_DARWIN
|
||||
$(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING)
|
||||
|
@ -106,7 +111,7 @@ $(APP_DIST_DIR)/Applications:
|
|||
$(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt
|
||||
|
||||
$(OSX_DMG): $(APP_DIST_EXTRAS)
|
||||
$(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "Bitcoin-Qt" -no-pad -r -apple -o $@ dist
|
||||
$(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "Bitcoin-Core" -no-pad -r -apple -o $@ dist
|
||||
|
||||
$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE): contrib/macdeploy/$(OSX_BACKGROUND_IMAGE)
|
||||
$(MKDIR_P) $(@D)
|
||||
|
|
16
configure.ac
16
configure.ac
|
@ -1,7 +1,7 @@
|
|||
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
|
||||
AC_PREREQ([2.60])
|
||||
define(_CLIENT_VERSION_MAJOR, 0)
|
||||
define(_CLIENT_VERSION_MINOR, 10)
|
||||
define(_CLIENT_VERSION_MINOR, 11)
|
||||
define(_CLIENT_VERSION_REVISION, 99)
|
||||
define(_CLIENT_VERSION_BUILD, 0)
|
||||
define(_CLIENT_VERSION_IS_RELEASE, false)
|
||||
|
@ -438,7 +438,7 @@ if test x$TARGET_OS = xdarwin; then
|
|||
AX_CHECK_LINK_FLAG([[-Wl,-dead_strip]], [LDFLAGS="$LDFLAGS -Wl,-dead_strip"])
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADERS([endian.h byteswap.h stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h sys/select.h sys/prctl.h])
|
||||
AC_CHECK_HEADERS([endian.h sys/endian.h byteswap.h stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h sys/select.h sys/prctl.h])
|
||||
AC_SEARCH_LIBS([getaddrinfo_a], [anl], [AC_DEFINE(HAVE_GETADDRINFO_A, 1, [Define this symbol if you have getaddrinfo_a])])
|
||||
AC_SEARCH_LIBS([inet_pton], [nsl resolv], [AC_DEFINE(HAVE_INET_PTON, 1, [Define this symbol if you have inet_pton])])
|
||||
|
||||
|
@ -447,6 +447,8 @@ AC_CHECK_DECLS([strnlen])
|
|||
AC_CHECK_DECLS([le16toh, le32toh, le64toh, htole16, htole32, htole64, be16toh, be32toh, be64toh, htobe16, htobe32, htobe64],,,
|
||||
[#if HAVE_ENDIAN_H
|
||||
#include <endian.h>
|
||||
#elif HAVE_SYS_ENDIAN_H
|
||||
#include <sys/endian.h>
|
||||
#endif])
|
||||
|
||||
AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64],,,
|
||||
|
@ -677,6 +679,14 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB([crypto],[RAND_egd],[],[
|
||||
AC_ARG_WITH([libressl],
|
||||
[AS_HELP_STRING([--with-libressl],[Build with system LibreSSL (default is no; DANGEROUS; NOT SUPPORTED)])],
|
||||
[AC_MSG_WARN([Detected LibreSSL: This is NOT supported, and may break consensus compatibility!])],
|
||||
[AC_MSG_ERROR([Detected LibreSSL: This is NOT supported, and may break consensus compatibility!])]
|
||||
)
|
||||
])
|
||||
|
||||
CFLAGS_TEMP="$CFLAGS"
|
||||
LIBS_TEMP="$LIBS"
|
||||
CFLAGS="$CFLAGS $SSL_CFLAGS $CRYPTO_CFLAGS"
|
||||
|
@ -885,7 +895,7 @@ PKGCONFIG_LIBDIR_TEMP="$PKG_CONFIG_LIBDIR"
|
|||
unset PKG_CONFIG_LIBDIR
|
||||
PKG_CONFIG_LIBDIR="$PKGCONFIG_LIBDIR_TEMP"
|
||||
|
||||
ac_configure_args="${ac_configure_args} --disable-shared --with-pic"
|
||||
ac_configure_args="${ac_configure_args} --disable-shared --with-pic --with-bignum=no"
|
||||
AC_CONFIG_SUBDIRS([src/secp256k1])
|
||||
|
||||
AC_OUTPUT
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
name: "bitcoin-linux-0.10"
|
||||
name: "bitcoin-linux-0.12"
|
||||
enable_cache: true
|
||||
suites:
|
||||
- "precise"
|
||||
|
@ -16,7 +16,7 @@ packages:
|
|||
- "bsdmainutils"
|
||||
- "binutils-gold"
|
||||
- "libstdc++6-4.6-pic"
|
||||
reference_datetime: "2013-06-01 00:00:00"
|
||||
reference_datetime: "2015-06-01 00:00:00"
|
||||
remotes:
|
||||
- "url": "https://github.com/bitcoin/bitcoin.git"
|
||||
"dir": "bitcoin"
|
||||
|
|
|
@ -7,7 +7,7 @@ architectures:
|
|||
packages:
|
||||
- "libc6:i386"
|
||||
- "faketime"
|
||||
reference_datetime: "2013-06-01 00:00:00"
|
||||
reference_datetime: "2015-06-01 00:00:00"
|
||||
remotes: []
|
||||
files:
|
||||
- "bitcoin-osx-unsigned.tar.gz"
|
||||
|
@ -33,5 +33,5 @@ script: |
|
|||
|
||||
tar -xf ${UNSIGNED}
|
||||
./detached-sig-apply.sh ${UNSIGNED} signature.tar.gz
|
||||
${WRAP_DIR}/genisoimage -no-cache-inodes -D -l -probe -V "Bitcoin-Qt" -no-pad -r -apple -o uncompressed.dmg signed-app
|
||||
${WRAP_DIR}/genisoimage -no-cache-inodes -D -l -probe -V "Bitcoin-Core" -no-pad -r -apple -o uncompressed.dmg signed-app
|
||||
${WRAP_DIR}/dmg dmg uncompressed.dmg ${OUTDIR}/${SIGNED}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
name: "bitcoin-osx-0.10"
|
||||
name: "bitcoin-osx-0.12"
|
||||
enable_cache: true
|
||||
suites:
|
||||
- "precise"
|
||||
|
@ -18,7 +18,7 @@ packages:
|
|||
- "libcap-dev"
|
||||
- "libz-dev"
|
||||
- "libbz2-dev"
|
||||
reference_datetime: "2013-06-01 00:00:00"
|
||||
reference_datetime: "2015-06-01 00:00:00"
|
||||
remotes:
|
||||
- "url": "https://github.com/bitcoin/bitcoin.git"
|
||||
"dir": "bitcoin"
|
||||
|
@ -120,7 +120,7 @@ script: |
|
|||
popd
|
||||
|
||||
make deploy
|
||||
${WRAP_DIR}/dmg dmg Bitcoin-Qt.dmg ${OUTDIR}/${DISTNAME}-osx-unsigned.dmg
|
||||
${WRAP_DIR}/dmg dmg Bitcoin-Core.dmg ${OUTDIR}/${DISTNAME}-osx-unsigned.dmg
|
||||
|
||||
cd installed
|
||||
find . -name "lib*.la" -delete
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
name: "bitcoin-win-0.10"
|
||||
name: "bitcoin-win-0.12"
|
||||
enable_cache: true
|
||||
suites:
|
||||
- "precise"
|
||||
|
@ -18,7 +18,7 @@ packages:
|
|||
- "g++-mingw-w64"
|
||||
- "nsis"
|
||||
- "zip"
|
||||
reference_datetime: "2013-06-01 00:00:00"
|
||||
reference_datetime: "2015-06-01 00:00:00"
|
||||
remotes:
|
||||
- "url": "https://github.com/bitcoin/bitcoin.git"
|
||||
"dir": "bitcoin"
|
||||
|
|
BIN
contrib/gitian-downloader/erkmos.pgp
Normal file
BIN
contrib/gitian-downloader/erkmos.pgp
Normal file
Binary file not shown.
|
@ -40,3 +40,6 @@ signers:
|
|||
C060A6635913D98A3587D7DB1C2491FFEB0EF770:
|
||||
name: "Cory Fields"
|
||||
key: "cfields"
|
||||
37EC7D7B0A217CDB4B4E007E7FAB114267E4FA04:
|
||||
name: "Peter Todd"
|
||||
key: "petertodd"
|
||||
|
|
Binary file not shown.
1901
contrib/gitian-downloader/petertodd-key.pgp
Normal file
1901
contrib/gitian-downloader/petertodd-key.pgp
Normal file
File diff suppressed because it is too large
Load diff
29
contrib/gitian-downloader/prab-key.pgp
Normal file
29
contrib/gitian-downloader/prab-key.pgp
Normal file
|
@ -0,0 +1,29 @@
|
|||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: GnuPG v2
|
||||
|
||||
mQINBFI3uQUBEADRjbUQb65n7sfjT5OPnjPO8oUh5onKjNALRGHGJxWwNkwkgmT6
|
||||
mZFWjikM8B3ONEp8MfTyoOzv+MbWuBDS1GZxi0Tcb4HU323/7hhwfXV4bcHif7vq
|
||||
Sc1ahN/5LIHj0htC6Uj78IWXW+kPWjX9biRJnZ9eerfA/AatC+4KuvYTjAa9uAfa
|
||||
BnAs38EG/7ryXzxdz6M8iNB/YjHE72swSH84uTtA3LqI3huVY41eFMK6qXFBMFiq
|
||||
H6bMx4pjwKzJj78bibXEQxq88yc6TLxbURs2GF4s11dr7Iq2Y+6FHqX3PfUByZBz
|
||||
PQfbEy1Df4RbB3htCBv5puETlqZ0PVe9/B+WrcnaobxrbKEAqt0DspfoveRTIL+z
|
||||
+YDs7FuW9TFBmd+5d2nmblHrNm8eEig3DpOoVetuuXsmDy03Fwao7hGkva4P3xbP
|
||||
H4/U8GaxsfNzuLvEyy+dtd2t2C1HIxS+56r41/vdb/9rvGgEQuSr0DVpZIW9en0f
|
||||
3bek+H7/qRCbXuaiBACBvOKNror5jtTeXTvnHWMkrOItyGH9pwR2Lhhv68JQS1jk
|
||||
e3pwVRzfHBz4wQMHeLIh+blsVKCIjytBR8Rq36rsmN1q44/3HwuPW/XP61kPP90k
|
||||
dKyPF4Qa+EoPw5ON5nr3lWy8ysklM79o1NmpyqNT4UjtDDBSfJtX82ct8QARAQAB
|
||||
tB9QYXVsIFJhYmFoeSA8UFJhYmFoeUBnbWFpbC5jb20+iQI/BBMBAgApBQJSN7kF
|
||||
AhsPBQkDwdj7BwsJCAcDAgEGFQgCCQoLBBYCAwECHgECF4AACgkQ0cuiohvNiPaB
|
||||
KA//Y6h6r8vUkA4/Gl2ejMgH+/DAolg9dFD+KMjQNKw16g7WzFNNS05T4RhcfZDT
|
||||
mapAW2LOUiiPVJTacmblyFp2hXCv3S+DESQjVdz15pxMHkt9fFteXGyJyrcTY5pR
|
||||
rZmjMD/9Twy2mLl5IH5ms87p0TN9HhM5Ux+B51la+Uq1wMdc1PdPWvGDeBVxCnRI
|
||||
w0224M5u1uHaMwMDGdz6sXuCuonB7CDGL9Z2+m1Al7t0peL2QdKHjv8S+SKM2rZS
|
||||
bRJyNmmTSKFQOTb9e2Ve48NNeaC0usEf8ttsygclps0mDpoa68YSY1LiuwVoIxvd
|
||||
S626eDqgmq1yyz0l3gQbYKIUv7KvRDnYhqIEkPZLCOwKirm+I5vzXvVIlfoNRoyJ
|
||||
VH3K6MJDSpBEerYNWHmUQpp7cLXIqVtako7IgmglOXQ5XVRnPvlOt5VOqQnNRTdM
|
||||
nd/FK3n1TbUyNRverODSpOS6ZxdSSwLkTycTtj1SvpLo7laW0HQ1ofJfwzVmOq8s
|
||||
8aWWTwBBC/X1UNLL/rsZMoHeUpaKHF2HSK5XzLcwqOBPRTMY0OG7vtBvj4G8clht
|
||||
A3uQmmCMr6RxsPPYPHPO3MnMpY2AK6RRnNZg5Y1Fu+/71FAuUDVTxmI402yE5XbP
|
||||
ILbJ8RgsrTVgeHdNhp9or0BdsB/wwMT5intkCaNqwb6eJag=
|
||||
=y2Va
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
|
@ -40,3 +40,6 @@ signers:
|
|||
C060A6635913D98A3587D7DB1C2491FFEB0EF770:
|
||||
name: "Cory Fields"
|
||||
key: "cfields"
|
||||
37EC7D7B0A217CDB4B4E007E7FAB114267E4FA04:
|
||||
name: "Peter Todd"
|
||||
key: "petertodd"
|
||||
|
|
|
@ -4,13 +4,23 @@ rpcuser=someuser
|
|||
rpcpassword=somepassword
|
||||
host=127.0.0.1
|
||||
port=8332
|
||||
#port=18332
|
||||
|
||||
# bootstrap.dat hashlist settings (linearize-hashes)
|
||||
max_height=313000
|
||||
|
||||
# bootstrap.dat input/output settings (linearize-data)
|
||||
|
||||
# mainnet
|
||||
netmagic=f9beb4d9
|
||||
genesis=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
|
||||
input=/home/example/.bitcoin/blocks
|
||||
|
||||
# testnet
|
||||
#netmagic=0b110907
|
||||
#genesis=000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943
|
||||
#input=/home/example/.bitcoin/testnet3/blocks
|
||||
|
||||
output_file=/home/example/Downloads/bootstrap.dat
|
||||
hashlist=hashlist.txt
|
||||
split_year=1
|
||||
|
|
|
@ -205,7 +205,7 @@ class BlockDataCopier:
|
|||
|
||||
inMagic = inhdr[:4]
|
||||
if (inMagic != self.settings['netmagic']):
|
||||
print("Invalid magic: " + inMagic)
|
||||
print("Invalid magic: " + inMagic.encode('hex'))
|
||||
return
|
||||
inLenLE = inhdr[4:]
|
||||
su = struct.unpack("<I", inLenLE)
|
||||
|
@ -265,6 +265,8 @@ if __name__ == '__main__':
|
|||
|
||||
if 'netmagic' not in settings:
|
||||
settings['netmagic'] = 'f9beb4d9'
|
||||
if 'genesis' not in settings:
|
||||
settings['genesis'] = '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f'
|
||||
if 'input' not in settings:
|
||||
settings['input'] = 'input'
|
||||
if 'hashlist' not in settings:
|
||||
|
@ -291,7 +293,7 @@ if __name__ == '__main__':
|
|||
blkindex = get_block_hashes(settings)
|
||||
blkmap = mkblockmap(blkindex)
|
||||
|
||||
if not "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f" in blkmap:
|
||||
if not settings['genesis'] in blkmap:
|
||||
print("Genesis block not found in hashlist")
|
||||
else:
|
||||
BlockDataCopier(settings, blkindex, blkmap).run()
|
||||
|
|
1
contrib/macdeploy/Base.lproj/InfoPlist.strings
Normal file
1
contrib/macdeploy/Base.lproj/InfoPlist.strings
Normal file
|
@ -0,0 +1 @@
|
|||
{ CFBundleDisplayName = "Bitcoin Core"; CFBundleName = "Bitcoin Core"; }
|
Binary file not shown.
|
@ -11,5 +11,5 @@ This script should not be run manually, instead, after building as usual:
|
|||
During the process, the disk image window will pop up briefly where the fancy
|
||||
settings are applied. This is normal, please do not interfere.
|
||||
|
||||
When finished, it will produce `Bitcoin-Qt.dmg`.
|
||||
When finished, it will produce `Bitcoin-Core.dmg`.
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
UNSIGNED=$1
|
||||
SIGNATURE=$2
|
||||
UNSIGNED="$1"
|
||||
SIGNATURE="$2"
|
||||
ARCH=x86_64
|
||||
ROOTDIR=dist
|
||||
BUNDLE=${ROOTDIR}/Bitcoin-Qt.app
|
||||
TEMPDIR=signed.temp
|
||||
OUTDIR=signed-app
|
||||
|
||||
|
@ -31,21 +30,21 @@ if [ -z "${CODESIGN_ALLOCATE}" ]; then
|
|||
CODESIGN_ALLOCATE=${TEMPDIR}/codesign_allocate
|
||||
fi
|
||||
|
||||
for i in `find ${TEMPDIR} -name "*.sign"`; do
|
||||
SIZE=`stat -c %s ${i}`
|
||||
TARGET_FILE=`echo ${i} | sed 's/\.sign$//'`
|
||||
find ${TEMPDIR} -name "*.sign" | while read i; do
|
||||
SIZE=`stat -c %s "${i}"`
|
||||
TARGET_FILE="`echo "${i}" | sed 's/\.sign$//'`"
|
||||
|
||||
echo "Allocating space for the signature of size ${SIZE} in ${TARGET_FILE}"
|
||||
${CODESIGN_ALLOCATE} -i ${TARGET_FILE} -a ${ARCH} ${SIZE} -o ${i}.tmp
|
||||
${CODESIGN_ALLOCATE} -i "${TARGET_FILE}" -a ${ARCH} ${SIZE} -o "${i}.tmp"
|
||||
|
||||
OFFSET=`${PAGESTUFF} ${i}.tmp -p | tail -2 | grep offset | sed 's/[^0-9]*//g'`
|
||||
OFFSET=`${PAGESTUFF} "${i}.tmp" -p | tail -2 | grep offset | sed 's/[^0-9]*//g'`
|
||||
if [ -z ${QUIET} ]; then
|
||||
echo "Attaching signature at offset ${OFFSET}"
|
||||
fi
|
||||
|
||||
dd if=$i of=${i}.tmp bs=1 seek=${OFFSET} count=${SIZE} 2>/dev/null
|
||||
mv ${i}.tmp ${TARGET_FILE}
|
||||
rm ${i}
|
||||
dd if="$i" of="${i}.tmp" bs=1 seek=${OFFSET} count=${SIZE} 2>/dev/null
|
||||
mv "${i}.tmp" "${TARGET_FILE}"
|
||||
rm "${i}"
|
||||
echo "Success."
|
||||
done
|
||||
mv ${TEMPDIR}/${ROOTDIR} ${OUTDIR}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
set -e
|
||||
|
||||
ROOTDIR=dist
|
||||
BUNDLE=${ROOTDIR}/Bitcoin-Qt.app
|
||||
BUNDLE="${ROOTDIR}/Bitcoin-Qt.app"
|
||||
CODESIGN=codesign
|
||||
TEMPDIR=sign.temp
|
||||
TEMPLIST=${TEMPDIR}/signatures.txt
|
||||
|
@ -19,19 +19,19 @@ mkdir -p ${TEMPDIR}
|
|||
|
||||
${CODESIGN} -f --file-list ${TEMPLIST} "$@" "${BUNDLE}"
|
||||
|
||||
for i in `grep -v CodeResources ${TEMPLIST}`; do
|
||||
TARGETFILE="${BUNDLE}/`echo ${i} | sed "s|.*${BUNDLE}/||"`"
|
||||
SIZE=`pagestuff $i -p | tail -2 | grep size | sed 's/[^0-9]*//g'`
|
||||
OFFSET=`pagestuff $i -p | tail -2 | grep offset | sed 's/[^0-9]*//g'`
|
||||
grep -v CodeResources < "${TEMPLIST}" | while read i; do
|
||||
TARGETFILE="${BUNDLE}/`echo "${i}" | sed "s|.*${BUNDLE}/||"`"
|
||||
SIZE=`pagestuff "$i" -p | tail -2 | grep size | sed 's/[^0-9]*//g'`
|
||||
OFFSET=`pagestuff "$i" -p | tail -2 | grep offset | sed 's/[^0-9]*//g'`
|
||||
SIGNFILE="${TEMPDIR}/${TARGETFILE}.sign"
|
||||
DIRNAME="`dirname ${SIGNFILE}`"
|
||||
DIRNAME="`dirname "${SIGNFILE}"`"
|
||||
mkdir -p "${DIRNAME}"
|
||||
echo "Adding detached signature for: ${TARGETFILE}. Size: ${SIZE}. Offset: ${OFFSET}"
|
||||
dd if=$i of=${SIGNFILE} bs=1 skip=${OFFSET} count=${SIZE} 2>/dev/null
|
||||
dd if="$i" of="${SIGNFILE}" bs=1 skip=${OFFSET} count=${SIZE} 2>/dev/null
|
||||
done
|
||||
|
||||
for i in `grep CodeResources ${TEMPLIST}`; do
|
||||
TARGETFILE="${BUNDLE}/`echo ${i} | sed "s|.*${BUNDLE}/||"`"
|
||||
grep CodeResources < "${TEMPLIST}" | while read i; do
|
||||
TARGETFILE="${BUNDLE}/`echo "${i}" | sed "s|.*${BUNDLE}/||"`"
|
||||
RESOURCE="${TEMPDIR}/${TARGETFILE}"
|
||||
DIRNAME="`dirname "${RESOURCE}"`"
|
||||
mkdir -p "${DIRNAME}"
|
||||
|
@ -41,6 +41,6 @@ done
|
|||
|
||||
rm ${TEMPLIST}
|
||||
|
||||
tar -C ${TEMPDIR} -czf ${OUT} .
|
||||
rm -rf ${TEMPDIR}
|
||||
tar -C "${TEMPDIR}" -czf "${OUT}" .
|
||||
rm -rf "${TEMPDIR}"
|
||||
echo "Created ${OUT}"
|
||||
|
|
|
@ -155,7 +155,7 @@ class FrameworkInfo(object):
|
|||
class ApplicationBundleInfo(object):
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
appName = os.path.splitext(os.path.basename(path))[0]
|
||||
appName = "Bitcoin-Qt"
|
||||
self.binaryPath = os.path.join(path, "Contents", "MacOS", appName)
|
||||
if not os.path.exists(self.binaryPath):
|
||||
raise RuntimeError("Could not find bundle binary for " + path)
|
||||
|
@ -596,7 +596,7 @@ if os.path.exists("dist"):
|
|||
|
||||
# ------------------------------------------------
|
||||
|
||||
target = os.path.join("dist", app_bundle)
|
||||
target = os.path.join("dist", "Bitcoin-Qt.app")
|
||||
|
||||
if verbose >= 2:
|
||||
print "+ Copying source bundle +"
|
||||
|
@ -757,7 +757,7 @@ if config.dmg is not None:
|
|||
|
||||
if fancy is None:
|
||||
try:
|
||||
runHDIUtil("create", dmg_name, srcfolder="dist", format="UDBZ", volname=app_bundle_name, ov=True)
|
||||
runHDIUtil("create", dmg_name, srcfolder="dist", format="UDBZ", volname="Bitcoin-Core", ov=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
sys.exit(e.returncode)
|
||||
else:
|
||||
|
@ -772,7 +772,7 @@ if config.dmg is not None:
|
|||
if verbose >= 3:
|
||||
print "Creating temp image for modification..."
|
||||
try:
|
||||
runHDIUtil("create", dmg_name + ".temp", srcfolder="dist", format="UDRW", size=size, volname=app_bundle_name, ov=True)
|
||||
runHDIUtil("create", dmg_name + ".temp", srcfolder="dist", format="UDRW", size=size, volname="Bitcoin-Core", ov=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
sys.exit(e.returncode)
|
||||
|
||||
|
@ -837,7 +837,7 @@ if config.dmg is not None:
|
|||
items_positions.append(itemscript.substitute(params))
|
||||
|
||||
params = {
|
||||
"disk" : "Bitcoin-Qt",
|
||||
"disk" : "Bitcoin-Core",
|
||||
"window_bounds" : "300,300,800,620",
|
||||
"icon_size" : "96",
|
||||
"background_commands" : "",
|
||||
|
|
|
@ -34,7 +34,7 @@ PROJECT_NAME = Bitcoin
|
|||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 0.10.99
|
||||
PROJECT_NUMBER = 0.11.99
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Bitcoin Core 0.10.99
|
||||
Bitcoin Core 0.11.99
|
||||
=====================
|
||||
|
||||
Setup
|
||||
|
@ -55,6 +55,7 @@ The Bitcoin repo's [root README](https://github.com/bitcoin/bitcoin/blob/master/
|
|||
- [Release Process](release-process.md)
|
||||
- [Source Code Documentation (External Link)](https://dev.visucore.com/bitcoin/doxygen/)
|
||||
- [Translation Process](translation_process.md)
|
||||
- [Translation Strings Policy](translation_strings_policy.md)
|
||||
- [Unit Tests](unit-tests.md)
|
||||
- [Unauthenticated REST Interface](REST-interface.md)
|
||||
- [BIPS](bips.md)
|
||||
|
|
|
@ -30,7 +30,7 @@ originally done in toolchain4.
|
|||
To complicate things further, all builds must target an Apple SDK. These SDKs
|
||||
are free to download, but not redistributable.
|
||||
To obtain it, register for a developer account, then download the XCode 6.1.1 dmg:
|
||||
https://developer.apple.com/downloads/download.action?path=Developer_Tools/xcode_6.1.1/xcode_6.1.1.dmg
|
||||
https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_6.1.1/xcode_6.1.1.dmg
|
||||
|
||||
This file is several gigabytes in size, but only a single directory inside is
|
||||
needed: Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Bitcoin Core 0.10.99
|
||||
Bitcoin Core 0.11.99
|
||||
=====================
|
||||
|
||||
Intro
|
||||
|
|
|
@ -47,7 +47,7 @@ Only supports JSON as output format.
|
|||
* chainwork : (string) total amount of work in active chain, in hexadecimal
|
||||
|
||||
####Query UTXO set
|
||||
`GET /rest/getutxos.<bin|hex|json>`
|
||||
`GET /rest/getutxos/<checkmempool>/<txid>-<n>/<txid>-<n>/.../<txid>-<n>.<bin|hex|json>`
|
||||
|
||||
The getutxo command allows querying of the UTXO set given a set of outpoints.
|
||||
See BIP64 for input and output serialisation:
|
||||
|
@ -55,7 +55,7 @@ https://github.com/bitcoin/bips/blob/master/bip-0064.mediawiki
|
|||
|
||||
Example:
|
||||
```
|
||||
$ curl --data '{"checkmempool":true,"outpoints":[{"txid":"b2cdfd7b89def827ff8af7cd9bff7627ff72e5e8b0f71210f92ea7a4000c5d75","n":0}]}' localhost:18332/rest/getutxos.json 2>/dev/null | json_pp
|
||||
$ curl localhost:18332/rest/getutxos/checkmempool/b2cdfd7b89def827ff8af7cd9bff7627ff72e5e8b0f71210f92ea7a4000c5d75-0.json 2>/dev/null | json_pp
|
||||
{
|
||||
"chaintipHash" : "00000000fb01a7f3745a717f8caebee056c484e6e0bfe4a9591c235bb70506fb",
|
||||
"chainHeight" : 325347,
|
||||
|
|
|
@ -102,7 +102,7 @@ CXXFLAGS="-g -ggdb -O0" or whatever debug flags you need.
|
|||
If the code is behaving strangely, take a look in the debug.log file in the data directory;
|
||||
error and debugging messages are written there.
|
||||
|
||||
The -debug=... command-line option controls debugging; running with just -debug will turn
|
||||
The -debug=... command-line option controls debugging; running with just -debug or -debug=1 will turn
|
||||
on all categories (and give you a very large debug.log file).
|
||||
|
||||
The Qt code routes qDebug() output to debug.log under category "qt": run with -debug=qt
|
||||
|
|
|
@ -1,3 +1,39 @@
|
|||
(note: this is a temporary file, to be added-to by anybody, and moved to
|
||||
release-notes at release time)
|
||||
|
||||
Notable changes
|
||||
===============
|
||||
|
||||
Example header
|
||||
----------------------
|
||||
|
||||
Example content.
|
||||
|
||||
0.12.0 Change log
|
||||
=================
|
||||
|
||||
Detailed release notes follow. This overview includes changes that affect
|
||||
behavior, not code moves, refactors and string updates. For convenience in locating
|
||||
the code changes and accompanying discussion, both the pull request and
|
||||
git merge commit are mentioned.
|
||||
|
||||
### RPC and REST
|
||||
|
||||
### Configuration and command-line options
|
||||
|
||||
### Block and transaction handling
|
||||
|
||||
### P2P protocol and network code
|
||||
|
||||
### Validation
|
||||
|
||||
### Build system
|
||||
|
||||
### Wallet
|
||||
|
||||
### GUI
|
||||
|
||||
### Tests
|
||||
|
||||
### Miscellaneous
|
||||
|
||||
|
|
60
doc/release-notes/release-notes-0.9.5.md
Normal file
60
doc/release-notes/release-notes-0.9.5.md
Normal file
|
@ -0,0 +1,60 @@
|
|||
Bitcoin Core version 0.9.5 is now available from:
|
||||
|
||||
https://bitcoin.org/bin/0.9.5/
|
||||
|
||||
This is a new minor version release, with the goal of backporting BIP66. There
|
||||
are also a few bug fixes and updated translations. Upgrading to this release is
|
||||
recommended.
|
||||
|
||||
Please report bugs using the issue tracker at github:
|
||||
|
||||
https://github.com/bitcoin/bitcoin/issues
|
||||
|
||||
How to Upgrade
|
||||
===============
|
||||
|
||||
If you are running an older version, shut it down. Wait until it has completely
|
||||
shut down (which might take a few minutes for older versions), then run the
|
||||
installer (on Windows) or just copy over /Applications/Bitcoin-Qt (on Mac) or
|
||||
bitcoind/bitcoin-qt (on Linux).
|
||||
|
||||
Notable changes
|
||||
================
|
||||
|
||||
Mining and relay policy enhancements
|
||||
------------------------------------
|
||||
|
||||
Bitcoin Core's block templates are now for version 3 blocks only, and any mining
|
||||
software relying on its `getblocktemplate` must be updated in parallel to use
|
||||
libblkmaker either version 0.4.2 or any version from 0.5.1 onward.
|
||||
If you are solo mining, this will affect you the moment you upgrade Bitcoin
|
||||
Core, which must be done prior to BIP66 achieving its 951/1001 status.
|
||||
If you are mining with the stratum mining protocol: this does not affect you.
|
||||
If you are mining with the getblocktemplate protocol to a pool: this will affect
|
||||
you at the pool operator's discretion, which must be no later than BIP66
|
||||
achieving its 951/1001 status.
|
||||
|
||||
0.9.5 changelog
|
||||
================
|
||||
|
||||
- `74f29c2` Check pindexBestForkBase for null
|
||||
- `9cd1dd9` Fix priority calculation in CreateTransaction
|
||||
- `6b4163b` Sanitize command strings before logging them.
|
||||
- `3230b32` Raise version of created blocks, and enforce DERSIG in mempool
|
||||
- `989d499` Backport of some of BIP66's tests
|
||||
- `ab03660` Implement BIP 66 validation rules and switchover logic
|
||||
- `8438074` build: fix dynamic boost check when --with-boost= is used
|
||||
|
||||
Credits
|
||||
--------
|
||||
|
||||
Thanks to who contributed to this release, at least:
|
||||
|
||||
- 21E14
|
||||
- Alex Morcos
|
||||
- Cory Fields
|
||||
- Gregory Maxwell
|
||||
- Pieter Wuille
|
||||
- Wladimir J. van der Laan
|
||||
|
||||
As well as everyone that helped translating on [Transifex](https://www.transifex.com/projects/p/bitcoin/).
|
|
@ -44,7 +44,7 @@ Release Process
|
|||
|
||||
Register and download the Apple SDK: (see OSX Readme for details)
|
||||
|
||||
https://developer.apple.com/downloads/download.action?path=Developer_Tools/xcode_6.1.1/xcode_6.1.1.dmg
|
||||
https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_6.1.1/xcode_6.1.1.dmg
|
||||
|
||||
Using a Mac, create a tarball for the 10.9 SDK and copy it to the inputs directory:
|
||||
|
||||
|
|
72
doc/translation_strings_policy.md
Normal file
72
doc/translation_strings_policy.md
Normal file
|
@ -0,0 +1,72 @@
|
|||
Translation Strings Policy
|
||||
===========================
|
||||
|
||||
This document provides guidelines for internationalization of the Bitcoin Core software.
|
||||
|
||||
How to translate?
|
||||
------------------
|
||||
|
||||
To mark a message as translatable
|
||||
|
||||
- In GUI source code (under `src/qt`): use `tr("...")`
|
||||
|
||||
- In non-GUI source code (under `src`): use `_("...")`
|
||||
|
||||
No internationalization is used for e.g. developer scripts outside `src`.
|
||||
|
||||
Strings to be translated
|
||||
-------------------------
|
||||
|
||||
On a high level, these strings are to be translated:
|
||||
|
||||
- GUI strings, anything that appears in a dialog or window
|
||||
|
||||
- Command-line option documentation
|
||||
|
||||
### GUI strings
|
||||
|
||||
Anything that appears to the user in the GUI is to be translated. This includes labels, menu items, button texts, tooltips and window titles.
|
||||
This includes messages passed to the GUI through the UI interface through `InitMessage`, `ThreadSafeMessageBox` or `ShowProgress`.
|
||||
|
||||
### Command-line options
|
||||
|
||||
Documentation for the command line options in the output of `--help` should be translated as well.
|
||||
|
||||
Make sure that default values do not end up in the string, but use string formatting like `strprintf(_("Threshold for disconnecting misbehaving peers (default: %u)"), 100)`. Putting default values in strings has led to accidental translations in the past, and forces the string to be retranslated every time the value changes.
|
||||
|
||||
Do not translate messages that are only shown to developers, such as those that only appear when `--help-debug` is used.
|
||||
|
||||
General recommendations
|
||||
------------------------
|
||||
|
||||
### Avoid unnecessary translation strings
|
||||
|
||||
Try not to burden translators with translating messages that are e.g. slight variations of other messages.
|
||||
In the GUI, avoid the use of text where an icon or symbol will do.
|
||||
Make sure that placeholder texts in forms don't end up in the list of strings to be translated (use `<string notr="true">`).
|
||||
|
||||
### Make translated strings understandable
|
||||
|
||||
Try to write translation strings in an understandable way, for both the user and the translator. Avoid overly technical or detailed messages
|
||||
|
||||
### Do not translate internal errors
|
||||
|
||||
Do not translate internal errors, or log messages, or messages that appear on the RPC interface. If an error is to be shown to the user,
|
||||
use a generic message, then log the detailed message to the log. E.g. "Error: A fatal internal error occurred, see debug.log for details".
|
||||
This helps troubleshooting; if the error is the same for everyone, the likelihood is increased that it can be found using a search engine.
|
||||
|
||||
### Avoid fragments
|
||||
|
||||
Avoid dividing up a message into fragments. Translators see every string separately, so may misunderstand the context if the messages are not self-contained.
|
||||
|
||||
### Avoid HTML in translation strings
|
||||
|
||||
There have been difficulties with use of HTML in translation strings; translators should not be able to accidentally affect the formatting of messages.
|
||||
This may sometimes be at conflict with the recommendation in the previous section.
|
||||
|
||||
### String freezes
|
||||
|
||||
During a string freeze (often before a major release), no translation strings are to be added, modified or removed.
|
||||
|
||||
This can be checked by executing `make translate` in the `src` directory, then verifying that `bitcoin_en.ts` remains unchanged.
|
||||
|
|
@ -31,18 +31,47 @@ testScripts=(
|
|||
'proxy_test.py'
|
||||
'merkle_blocks.py'
|
||||
'signrawtransactions.py'
|
||||
'walletbackup.py'
|
||||
);
|
||||
testScriptsExt=(
|
||||
'bipdersig-p2p.py'
|
||||
'bipdersig.py'
|
||||
'getblocktemplate_longpoll.py'
|
||||
'getblocktemplate_proposals.py'
|
||||
'pruning.py'
|
||||
'forknotify.py'
|
||||
'invalidateblock.py'
|
||||
'keypool.py'
|
||||
'receivedby.py'
|
||||
'reindex.py'
|
||||
'rpcbind_test.py'
|
||||
# 'script_test.py'
|
||||
'smartfees.py'
|
||||
'maxblocksinflight.py'
|
||||
'invalidblockrequest.py'
|
||||
'rawtransactions.py'
|
||||
# 'forknotify.py'
|
||||
'p2p-acceptblock.py'
|
||||
);
|
||||
|
||||
extArg="-extended"
|
||||
passOn=${@#$extArg}
|
||||
|
||||
if [ "x${ENABLE_BITCOIND}${ENABLE_UTILS}${ENABLE_WALLET}" = "x111" ]; then
|
||||
for (( i = 0; i < ${#testScripts[@]}; i++ ))
|
||||
do
|
||||
if [ -z "$1" ] || [ "$1" == "${testScripts[$i]}" ] || [ "$1.py" == "${testScripts[$i]}" ]
|
||||
if [ -z "$1" ] || [ "${1:0:1}" == "-" ] || [ "$1" == "${testScripts[$i]}" ] || [ "$1.py" == "${testScripts[$i]}" ]
|
||||
then
|
||||
echo -e "Running testscript \033[1m${testScripts[$i]}...\033[0m"
|
||||
${BUILDDIR}/qa/rpc-tests/${testScripts[$i]} --srcdir "${BUILDDIR}/src"
|
||||
${BUILDDIR}/qa/rpc-tests/${testScripts[$i]} --srcdir "${BUILDDIR}/src" ${passOn}
|
||||
fi
|
||||
done
|
||||
for (( i = 0; i < ${#testScriptsExt[@]}; i++ ))
|
||||
do
|
||||
if [ "$1" == $extArg ] || [ "$1" == "${testScriptsExt[$i]}" ] || [ "$1.py" == "${testScriptsExt[$i]}" ]
|
||||
then
|
||||
echo -e "Running \033[1m2nd level\033[0m testscript \033[1m${testScriptsExt[$i]}...\033[0m"
|
||||
${BUILDDIR}/qa/rpc-tests/${testScriptsExt[$i]} --srcdir "${BUILDDIR}/src" ${passOn}
|
||||
fi
|
||||
done
|
||||
else
|
||||
|
|
|
@ -6,25 +6,37 @@ Git subtree of [https://github.com/jgarzik/python-bitcoinrpc](https://github.com
|
|||
Changes to python-bitcoinrpc should be made upstream, and then
|
||||
pulled here using git subtree.
|
||||
|
||||
### [test_framework.py](test_framework.py)
|
||||
### [test_framework/test_framework.py](test_framework/test_framework.py)
|
||||
Base class for new regression tests.
|
||||
|
||||
### [listtransactions.py](listtransactions.py)
|
||||
Tests for the listtransactions RPC call.
|
||||
|
||||
### [util.py](util.py)
|
||||
### [test_framework/util.py](test_framework/util.py)
|
||||
Generally useful functions.
|
||||
|
||||
Bash-based tests, to be ported to Python:
|
||||
-----------------------------------------
|
||||
- wallet.sh : Exercise wallet send/receive code.
|
||||
- walletbackup.sh : Exercise wallet backup / dump / import
|
||||
- txnmall.sh : Test proper accounting of malleable transactions
|
||||
- conflictedbalance.sh : More testing of malleable transaction handling
|
||||
|
||||
Notes
|
||||
=====
|
||||
|
||||
You can run a single test by calling `qa/pull-tester/rpc-tests.sh <testname>`.
|
||||
|
||||
Run all possible tests with `qa/pull-tester/rpc-tests.sh -extended`.
|
||||
|
||||
Possible options:
|
||||
|
||||
````
|
||||
-h, --help show this help message and exit
|
||||
--nocleanup Leave bitcoinds and test.* datadir on exit or error
|
||||
--noshutdown Don't stop bitcoinds after the test execution
|
||||
--srcdir=SRCDIR Source directory containing bitcoind/bitcoin-cli (default:
|
||||
../../src)
|
||||
--tmpdir=TMPDIR Root directory for datadirs
|
||||
--tracerpc Print out all RPC calls as they are made
|
||||
```
|
||||
|
||||
If you set the environment variable `PYTHON_DEBUG=1` you will get some debug output (example: `PYTHON_DEBUG=1 qa/pull-tester/rpc-tests.sh wallet`).
|
||||
|
||||
A 200-block -regtest blockchain and wallets for four nodes
|
||||
is created the first time a regression test is run and
|
||||
is stored in the cache/ directory. Each node has 25 mature
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
|
||||
from test_framework import ComparisonTestFramework
|
||||
from util import *
|
||||
from mininode import CTransaction, NetworkThread
|
||||
from blocktools import create_coinbase, create_block
|
||||
from test_framework.test_framework import ComparisonTestFramework
|
||||
from test_framework.util import *
|
||||
from test_framework.mininode import CTransaction, NetworkThread
|
||||
from test_framework.blocktools import create_coinbase, create_block
|
||||
from test_framework.comptool import TestInstance, TestManager
|
||||
from test_framework.script import CScript
|
||||
from binascii import hexlify, unhexlify
|
||||
import cStringIO
|
||||
from comptool import TestInstance, TestManager
|
||||
from script import CScript
|
||||
import time
|
||||
|
||||
# A canonical signature consists of:
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
# Test the BIP66 changeover logic
|
||||
#
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
# Test -alertnotify
|
||||
#
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
|
||||
|
||||
def check_array_result(object_array, to_match, expected):
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
|
||||
from binascii import a2b_hex, b2a_hex
|
||||
from hashlib import sha256
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
# on chains of different lengths, and join the network together again.
|
||||
# This gives us two tips, verify that it works.
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from util import assert_equal
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_equal
|
||||
|
||||
class GetChainTipsTest (BitcoinTestFramework):
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
# Test REST interface
|
||||
#
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import base64
|
||||
|
||||
try:
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
# Test InvalidateBlock code
|
||||
#
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
|
||||
class InvalidateTest(BitcoinTestFramework):
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
|
||||
from test_framework import ComparisonTestFramework
|
||||
from util import *
|
||||
from comptool import TestManager, TestInstance
|
||||
from mininode import *
|
||||
from blocktools import *
|
||||
from test_framework.test_framework import ComparisonTestFramework
|
||||
from test_framework.util import *
|
||||
from test_framework.comptool import TestManager, TestInstance
|
||||
from test_framework.mininode import *
|
||||
from test_framework.blocktools import *
|
||||
import logging
|
||||
import copy
|
||||
import time
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
# Add python-bitcoinrpc to module search path:
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "python-bitcoinrpc"))
|
||||
|
||||
import json
|
||||
import shutil
|
||||
|
@ -16,8 +15,7 @@ import subprocess
|
|||
import tempfile
|
||||
import traceback
|
||||
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
from test_framework.util import *
|
||||
|
||||
|
||||
def check_array_result(object_array, to_match, expected):
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
|
||||
# Exercise the listtransactions API
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
|
||||
|
||||
def check_array_result(object_array, to_match, expected):
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
|
||||
from mininode import *
|
||||
from test_framework import BitcoinTestFramework
|
||||
from util import *
|
||||
from test_framework.mininode import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import logging
|
||||
|
||||
'''
|
||||
|
|
|
@ -8,9 +8,8 @@
|
|||
# that spend (directly or indirectly) coinbase transactions.
|
||||
#
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
|
|
@ -8,9 +8,8 @@
|
|||
# the blockchain is re-organized.
|
||||
#
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
@ -34,7 +33,6 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
|||
|
||||
def run_test(self):
|
||||
node0_address = self.nodes[0].getnewaddress()
|
||||
|
||||
# Spend block 1/2/3's coinbase transactions
|
||||
# Mine a block.
|
||||
# Create three more transactions, spending the spends
|
||||
|
|
|
@ -13,9 +13,8 @@
|
|||
# but less mature coinbase spends are NOT.
|
||||
#
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
# Test merkleblock fetch/validation
|
||||
#
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
|
226
qa/rpc-tests/p2p-acceptblock.py
Executable file
226
qa/rpc-tests/p2p-acceptblock.py
Executable file
|
@ -0,0 +1,226 @@
|
|||
#!/usr/bin/env python2
|
||||
#
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
|
||||
from test_framework.mininode import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import time
|
||||
from test_framework.blocktools import create_block, create_coinbase
|
||||
|
||||
'''
|
||||
AcceptBlockTest -- test processing of unrequested blocks.
|
||||
|
||||
Since behavior differs when receiving unrequested blocks from whitelisted peers
|
||||
versus non-whitelisted peers, this tests the behavior of both (effectively two
|
||||
separate tests running in parallel).
|
||||
|
||||
Setup: two nodes, node0 and node1, not connected to each other. Node0 does not
|
||||
whitelist localhost, but node1 does. They will each be on their own chain for
|
||||
this test.
|
||||
|
||||
We have one NodeConn connection to each, test_node and white_node respectively.
|
||||
|
||||
The test:
|
||||
1. Generate one block on each node, to leave IBD.
|
||||
|
||||
2. Mine a new block on each tip, and deliver to each node from node's peer.
|
||||
The tip should advance.
|
||||
|
||||
3. Mine a block that forks the previous block, and deliver to each node from
|
||||
corresponding peer.
|
||||
Node0 should not process this block (just accept the header), because it is
|
||||
unrequested and doesn't have more work than the tip.
|
||||
Node1 should process because this is coming from a whitelisted peer.
|
||||
|
||||
4. Send another block that builds on the forking block.
|
||||
Node0 should process this block but be stuck on the shorter chain, because
|
||||
it's missing an intermediate block.
|
||||
Node1 should reorg to this longer chain.
|
||||
|
||||
5. Send a duplicate of the block in #3 to Node0.
|
||||
Node0 should not process the block because it is unrequested, and stay on
|
||||
the shorter chain.
|
||||
|
||||
6. Send Node0 an inv for the height 3 block produced in #4 above.
|
||||
Node0 should figure out that Node0 has the missing height 2 block and send a
|
||||
getdata.
|
||||
|
||||
7. Send Node0 the missing block again.
|
||||
Node0 should process and the tip should advance.
|
||||
'''
|
||||
|
||||
# TestNode: bare-bones "peer". Used mostly as a conduit for a test to sending
|
||||
# p2p messages to a node, generating the messages in the main testing logic.
|
||||
class TestNode(NodeConnCB):
|
||||
def __init__(self):
|
||||
NodeConnCB.__init__(self)
|
||||
self.create_callback_map()
|
||||
self.connection = None
|
||||
|
||||
def add_connection(self, conn):
|
||||
self.connection = conn
|
||||
|
||||
# Track the last getdata message we receive (used in the test)
|
||||
def on_getdata(self, conn, message):
|
||||
self.last_getdata = message
|
||||
|
||||
# Spin until verack message is received from the node.
|
||||
# We use this to signal that our test can begin. This
|
||||
# is called from the testing thread, so it needs to acquire
|
||||
# the global lock.
|
||||
def wait_for_verack(self):
|
||||
while True:
|
||||
with mininode_lock:
|
||||
if self.verack_received:
|
||||
return
|
||||
time.sleep(0.05)
|
||||
|
||||
# Wrapper for the NodeConn's send_message function
|
||||
def send_message(self, message):
|
||||
self.connection.send_message(message)
|
||||
|
||||
class AcceptBlockTest(BitcoinTestFramework):
|
||||
def add_options(self, parser):
|
||||
parser.add_option("--testbinary", dest="testbinary",
|
||||
default=os.getenv("BITCOIND", "bitcoind"),
|
||||
help="bitcoind binary to test")
|
||||
|
||||
def setup_chain(self):
|
||||
initialize_chain_clean(self.options.tmpdir, 2)
|
||||
|
||||
def setup_network(self):
|
||||
# Node0 will be used to test behavior of processing unrequested blocks
|
||||
# from peers which are not whitelisted, while Node1 will be used for
|
||||
# the whitelisted case.
|
||||
self.nodes = []
|
||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug"],
|
||||
binary=self.options.testbinary))
|
||||
self.nodes.append(start_node(1, self.options.tmpdir,
|
||||
["-debug", "-whitelist=127.0.0.1"],
|
||||
binary=self.options.testbinary))
|
||||
|
||||
def run_test(self):
|
||||
# Setup the p2p connections and start up the network thread.
|
||||
test_node = TestNode() # connects to node0 (not whitelisted)
|
||||
white_node = TestNode() # connects to node1 (whitelisted)
|
||||
|
||||
connections = []
|
||||
connections.append(NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], test_node))
|
||||
connections.append(NodeConn('127.0.0.1', p2p_port(1), self.nodes[1], white_node))
|
||||
test_node.add_connection(connections[0])
|
||||
white_node.add_connection(connections[1])
|
||||
|
||||
NetworkThread().start() # Start up network handling in another thread
|
||||
|
||||
# Test logic begins here
|
||||
test_node.wait_for_verack()
|
||||
white_node.wait_for_verack()
|
||||
|
||||
# 1. Have both nodes mine a block (leave IBD)
|
||||
[ n.generate(1) for n in self.nodes ]
|
||||
tips = [ int ("0x" + n.getbestblockhash() + "L", 0) for n in self.nodes ]
|
||||
|
||||
# 2. Send one block that builds on each tip.
|
||||
# This should be accepted.
|
||||
blocks_h2 = [] # the height 2 blocks on each node's chain
|
||||
for i in xrange(2):
|
||||
blocks_h2.append(create_block(tips[i], create_coinbase(), time.time()+1))
|
||||
blocks_h2[i].solve()
|
||||
test_node.send_message(msg_block(blocks_h2[0]))
|
||||
white_node.send_message(msg_block(blocks_h2[1]))
|
||||
|
||||
time.sleep(1)
|
||||
assert_equal(self.nodes[0].getblockcount(), 2)
|
||||
assert_equal(self.nodes[1].getblockcount(), 2)
|
||||
print "First height 2 block accepted by both nodes"
|
||||
|
||||
# 3. Send another block that builds on the original tip.
|
||||
blocks_h2f = [] # Blocks at height 2 that fork off the main chain
|
||||
for i in xrange(2):
|
||||
blocks_h2f.append(create_block(tips[i], create_coinbase(), blocks_h2[i].nTime+1))
|
||||
blocks_h2f[i].solve()
|
||||
test_node.send_message(msg_block(blocks_h2f[0]))
|
||||
white_node.send_message(msg_block(blocks_h2f[1]))
|
||||
|
||||
time.sleep(1) # Give time to process the block
|
||||
for x in self.nodes[0].getchaintips():
|
||||
if x['hash'] == blocks_h2f[0].hash:
|
||||
assert_equal(x['status'], "headers-only")
|
||||
|
||||
for x in self.nodes[1].getchaintips():
|
||||
if x['hash'] == blocks_h2f[1].hash:
|
||||
assert_equal(x['status'], "valid-headers")
|
||||
|
||||
print "Second height 2 block accepted only from whitelisted peer"
|
||||
|
||||
# 4. Now send another block that builds on the forking chain.
|
||||
blocks_h3 = []
|
||||
for i in xrange(2):
|
||||
blocks_h3.append(create_block(blocks_h2f[i].sha256, create_coinbase(), blocks_h2f[i].nTime+1))
|
||||
blocks_h3[i].solve()
|
||||
test_node.send_message(msg_block(blocks_h3[0]))
|
||||
white_node.send_message(msg_block(blocks_h3[1]))
|
||||
|
||||
time.sleep(1)
|
||||
# Since the earlier block was not processed by node0, the new block
|
||||
# can't be fully validated.
|
||||
for x in self.nodes[0].getchaintips():
|
||||
if x['hash'] == blocks_h3[0].hash:
|
||||
assert_equal(x['status'], "headers-only")
|
||||
|
||||
# But this block should be accepted by node0 since it has more work.
|
||||
try:
|
||||
self.nodes[0].getblock(blocks_h3[0].hash)
|
||||
print "Unrequested more-work block accepted from non-whitelisted peer"
|
||||
except:
|
||||
raise AssertionError("Unrequested more work block was not processed")
|
||||
|
||||
# Node1 should have accepted and reorged.
|
||||
assert_equal(self.nodes[1].getblockcount(), 3)
|
||||
print "Successfully reorged to length 3 chain from whitelisted peer"
|
||||
|
||||
# 5. Test handling of unrequested block on the node that didn't process
|
||||
# Should still not be processed (even though it has a child that has more
|
||||
# work).
|
||||
test_node.send_message(msg_block(blocks_h2f[0]))
|
||||
|
||||
# Here, if the sleep is too short, the test could falsely succeed (if the
|
||||
# node hasn't processed the block by the time the sleep returns, and then
|
||||
# the node processes it and incorrectly advances the tip).
|
||||
# But this would be caught later on, when we verify that an inv triggers
|
||||
# a getdata request for this block.
|
||||
time.sleep(1)
|
||||
assert_equal(self.nodes[0].getblockcount(), 2)
|
||||
print "Unrequested block that would complete more-work chain was ignored"
|
||||
|
||||
# 6. Try to get node to request the missing block.
|
||||
# Poke the node with an inv for block at height 3 and see if that
|
||||
# triggers a getdata on block 2 (it should if block 2 is missing).
|
||||
with mininode_lock:
|
||||
# Clear state so we can check the getdata request
|
||||
test_node.last_getdata = None
|
||||
test_node.send_message(msg_inv([CInv(2, blocks_h3[0].sha256)]))
|
||||
|
||||
time.sleep(1)
|
||||
with mininode_lock:
|
||||
getdata = test_node.last_getdata
|
||||
|
||||
# Check that the getdata is for the right block
|
||||
assert_equal(len(getdata.inv), 1)
|
||||
assert_equal(getdata.inv[0].hash, blocks_h2f[0].sha256)
|
||||
print "Inv at tip triggered getdata for unprocessed block"
|
||||
|
||||
# 7. Send the missing block for the third time (now it is requested)
|
||||
test_node.send_message(msg_block(blocks_h2f[0]))
|
||||
|
||||
time.sleep(1)
|
||||
assert_equal(self.nodes[0].getblockcount(), 3)
|
||||
print "Successfully reorged to length 3 chain from non-whitelisted peer"
|
||||
|
||||
[ c.disconnect_node() for c in connections ]
|
||||
|
||||
if __name__ == '__main__':
|
||||
AcceptBlockTest().main()
|
|
@ -7,9 +7,9 @@ import traceback, sys
|
|||
from binascii import hexlify
|
||||
import time, os
|
||||
|
||||
from socks5 import Socks5Configuration, Socks5Command, Socks5Server, AddressType
|
||||
from test_framework import BitcoinTestFramework
|
||||
from util import *
|
||||
from test_framework.socks5 import Socks5Configuration, Socks5Command, Socks5Server, AddressType
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
'''
|
||||
Test plan:
|
||||
- Start bitcoind's with different proxy configurations
|
||||
|
|
|
@ -11,9 +11,8 @@
|
|||
# This test takes 30 mins or more (up to 2 hours)
|
||||
# ********
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os.path
|
||||
|
||||
def calc_usage(blockdir):
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
*.pyc
|
|
@ -1,15 +0,0 @@
|
|||
#!/usr/bin/env python2
|
||||
|
||||
from distutils.core import setup
|
||||
|
||||
setup(name='python-bitcoinrpc',
|
||||
version='0.1',
|
||||
description='Enhanced version of python-jsonrpc for use with Bitcoin',
|
||||
long_description=open('README').read(),
|
||||
author='Jeff Garzik',
|
||||
author_email='<jgarzik@exmulti.com>',
|
||||
maintainer='Jeff Garzik',
|
||||
maintainer_email='<jgarzik@exmulti.com>',
|
||||
url='http://www.github.com/jgarzik/python-bitcoinrpc',
|
||||
packages=['bitcoinrpc'],
|
||||
classifiers=['License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)', 'Operating System :: OS Independent'])
|
|
@ -8,8 +8,8 @@
|
|||
# that spend (directly or indirectly) coinbase transactions.
|
||||
#
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
from pprint import pprint
|
||||
from time import sleep
|
||||
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
|
||||
# Exercise the listreceivedbyaddress API
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
|
||||
|
||||
def get_sub_array_from_array(object_array, to_match):
|
||||
|
|
|
@ -6,9 +6,8 @@
|
|||
#
|
||||
# Test -reindex with CheckBlockIndex
|
||||
#
|
||||
from test_framework import BitcoinTestFramework
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os.path
|
||||
|
||||
class ReindexTest(BitcoinTestFramework):
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
# Test REST interface
|
||||
#
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from util import *
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
from struct import *
|
||||
import binascii
|
||||
import json
|
||||
|
@ -54,78 +55,78 @@ class RESTTest (BitcoinTestFramework):
|
|||
connect_nodes_bi(self.nodes,0,2)
|
||||
self.is_network_split=False
|
||||
self.sync_all()
|
||||
|
||||
|
||||
def run_test(self):
|
||||
url = urlparse.urlparse(self.nodes[0].url)
|
||||
print "Mining blocks..."
|
||||
|
||||
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
self.nodes[2].generate(100)
|
||||
self.sync_all()
|
||||
|
||||
|
||||
assert_equal(self.nodes[0].getbalance(), 50)
|
||||
|
||||
|
||||
txid = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.1)
|
||||
self.sync_all()
|
||||
self.nodes[2].generate(1)
|
||||
self.sync_all()
|
||||
bb_hash = self.nodes[0].getbestblockhash()
|
||||
|
||||
|
||||
assert_equal(self.nodes[1].getbalance(), Decimal("0.1")) #balance now should be 0.1 on node 1
|
||||
|
||||
|
||||
# load the latest 0.1 tx over the REST API
|
||||
json_string = http_get_call(url.hostname, url.port, '/rest/tx/'+txid+self.FORMAT_SEPARATOR+"json")
|
||||
json_obj = json.loads(json_string)
|
||||
vintx = json_obj['vin'][0]['txid'] # get the vin to later check for utxo (should be spent by then)
|
||||
# get n of 0.1 outpoint
|
||||
# get n of 0.1 outpoint
|
||||
n = 0
|
||||
for vout in json_obj['vout']:
|
||||
if vout['value'] == 0.1:
|
||||
n = vout['n']
|
||||
|
||||
|
||||
|
||||
|
||||
######################################
|
||||
# GETUTXOS: query a unspent outpoint #
|
||||
######################################
|
||||
json_request = '{"checkmempool":true,"outpoints":[{"txid":"'+txid+'","n":'+str(n)+'}]}'
|
||||
json_string = http_get_call(url.hostname, url.port, '/rest/getutxos'+self.FORMAT_SEPARATOR+'json', json_request)
|
||||
json_request = '/checkmempool/'+txid+'-'+str(n)
|
||||
json_string = http_get_call(url.hostname, url.port, '/rest/getutxos'+json_request+self.FORMAT_SEPARATOR+'json')
|
||||
json_obj = json.loads(json_string)
|
||||
|
||||
|
||||
#check chainTip response
|
||||
assert_equal(json_obj['chaintipHash'], bb_hash)
|
||||
|
||||
|
||||
#make sure there is one utxo
|
||||
assert_equal(len(json_obj['utxos']), 1)
|
||||
assert_equal(json_obj['utxos'][0]['value'], 0.1)
|
||||
|
||||
|
||||
|
||||
|
||||
################################################
|
||||
# GETUTXOS: now query a already spent outpoint #
|
||||
################################################
|
||||
json_request = '{"checkmempool":true,"outpoints":[{"txid":"'+vintx+'","n":0}]}'
|
||||
json_string = http_get_call(url.hostname, url.port, '/rest/getutxos'+self.FORMAT_SEPARATOR+'json', json_request)
|
||||
json_request = '/checkmempool/'+vintx+'-0'
|
||||
json_string = http_get_call(url.hostname, url.port, '/rest/getutxos'+json_request+self.FORMAT_SEPARATOR+'json')
|
||||
json_obj = json.loads(json_string)
|
||||
|
||||
|
||||
#check chainTip response
|
||||
assert_equal(json_obj['chaintipHash'], bb_hash)
|
||||
|
||||
#make sure there is no utox in the response because this oupoint has been spent
|
||||
assert_equal(len(json_obj['utxos']), 0)
|
||||
|
||||
|
||||
#check bitmap
|
||||
assert_equal(json_obj['bitmap'], "0")
|
||||
|
||||
|
||||
|
||||
|
||||
##################################################
|
||||
# GETUTXOS: now check both with the same request #
|
||||
##################################################
|
||||
json_request = '{"checkmempool":true,"outpoints":[{"txid":"'+txid+'","n":'+str(n)+'},{"txid":"'+vintx+'","n":0}]}'
|
||||
json_string = http_get_call(url.hostname, url.port, '/rest/getutxos'+self.FORMAT_SEPARATOR+'json', json_request)
|
||||
json_request = '/checkmempool/'+txid+'-'+str(n)+'/'+vintx+'-0'
|
||||
json_string = http_get_call(url.hostname, url.port, '/rest/getutxos'+json_request+self.FORMAT_SEPARATOR+'json')
|
||||
json_obj = json.loads(json_string)
|
||||
assert_equal(len(json_obj['utxos']), 1)
|
||||
assert_equal(json_obj['bitmap'], "10")
|
||||
|
||||
|
||||
#test binary response
|
||||
bb_hash = self.nodes[0].getbestblockhash()
|
||||
|
||||
|
@ -134,19 +135,18 @@ class RESTTest (BitcoinTestFramework):
|
|||
binaryRequest += pack("i", n);
|
||||
binaryRequest += binascii.unhexlify(vintx);
|
||||
binaryRequest += pack("i", 0);
|
||||
|
||||
|
||||
bin_response = http_get_call(url.hostname, url.port, '/rest/getutxos'+self.FORMAT_SEPARATOR+'bin', binaryRequest)
|
||||
|
||||
output = StringIO.StringIO()
|
||||
output.write(bin_response)
|
||||
output.seek(0)
|
||||
chainHeight = unpack("i", output.read(4))[0]
|
||||
hashFromBinResponse = hex(deser_uint256(output))[2:].zfill(65).rstrip("L")
|
||||
|
||||
|
||||
assert_equal(bb_hash, hashFromBinResponse) #check if getutxo's chaintip during calculation was fine
|
||||
assert_equal(chainHeight, 102) #chain height must be 102
|
||||
|
||||
|
||||
|
||||
|
||||
############################
|
||||
# GETUTXOS: mempool checks #
|
||||
############################
|
||||
|
@ -156,55 +156,56 @@ class RESTTest (BitcoinTestFramework):
|
|||
json_string = http_get_call(url.hostname, url.port, '/rest/tx/'+txid+self.FORMAT_SEPARATOR+"json")
|
||||
json_obj = json.loads(json_string)
|
||||
vintx = json_obj['vin'][0]['txid'] # get the vin to later check for utxo (should be spent by then)
|
||||
# get n of 0.1 outpoint
|
||||
# get n of 0.1 outpoint
|
||||
n = 0
|
||||
for vout in json_obj['vout']:
|
||||
if vout['value'] == 0.1:
|
||||
n = vout['n']
|
||||
|
||||
json_request = '{"checkmempool":false,"outpoints":[{"txid":"'+txid+'","n":'+str(n)+'}]}'
|
||||
json_string = http_get_call(url.hostname, url.port, '/rest/getutxos'+self.FORMAT_SEPARATOR+'json', json_request)
|
||||
|
||||
json_request = '/'+txid+'-'+str(n)
|
||||
json_string = http_get_call(url.hostname, url.port, '/rest/getutxos'+json_request+self.FORMAT_SEPARATOR+'json')
|
||||
json_obj = json.loads(json_string)
|
||||
assert_equal(len(json_obj['utxos']), 0) #there should be a outpoint because it has just added to the mempool
|
||||
|
||||
json_request = '{"checkmempool":true,"outpoints":[{"txid":"'+txid+'","n":'+str(n)+'}]}'
|
||||
json_string = http_get_call(url.hostname, url.port, '/rest/getutxos'+self.FORMAT_SEPARATOR+'json', json_request)
|
||||
|
||||
json_request = '/checkmempool/'+txid+'-'+str(n)
|
||||
json_string = http_get_call(url.hostname, url.port, '/rest/getutxos'+json_request+self.FORMAT_SEPARATOR+'json')
|
||||
json_obj = json.loads(json_string)
|
||||
assert_equal(len(json_obj['utxos']), 1) #there should be a outpoint because it has just added to the mempool
|
||||
|
||||
|
||||
#do some invalid requests
|
||||
json_request = '{"checkmempool'
|
||||
response = http_get_call(url.hostname, url.port, '/rest/getutxos'+self.FORMAT_SEPARATOR+'json', json_request, True)
|
||||
assert_equal(response.status, 500) #must be a 500 because we send a invalid json request
|
||||
|
||||
|
||||
json_request = '{"checkmempool'
|
||||
response = http_get_call(url.hostname, url.port, '/rest/getutxos'+self.FORMAT_SEPARATOR+'bin', json_request, True)
|
||||
assert_equal(response.status, 500) #must be a 500 because we send a invalid bin request
|
||||
|
||||
|
||||
response = http_get_call(url.hostname, url.port, '/rest/getutxos/checkmempool'+self.FORMAT_SEPARATOR+'bin', '', True)
|
||||
assert_equal(response.status, 500) #must be a 500 because we send a invalid bin request
|
||||
|
||||
#test limits
|
||||
json_request = '{"checkmempool":true,"outpoints":['
|
||||
for x in range(0, 200):
|
||||
json_request += '{"txid":"'+txid+'","n":'+str(n)+'},'
|
||||
json_request = json_request.rstrip(",")
|
||||
json_request+="]}";
|
||||
response = http_get_call(url.hostname, url.port, '/rest/getutxos'+self.FORMAT_SEPARATOR+'json', json_request, True)
|
||||
json_request = '/checkmempool/'
|
||||
for x in range(0, 20):
|
||||
json_request += txid+'-'+str(n)+'/'
|
||||
json_request = json_request.rstrip("/")
|
||||
response = http_get_call(url.hostname, url.port, '/rest/getutxos'+json_request+self.FORMAT_SEPARATOR+'json', '', True)
|
||||
assert_equal(response.status, 500) #must be a 500 because we exceeding the limits
|
||||
|
||||
json_request = '{"checkmempool":true,"outpoints":['
|
||||
for x in range(0, 90):
|
||||
json_request += '{"txid":"'+txid+'","n":'+str(n)+'},'
|
||||
json_request = json_request.rstrip(",")
|
||||
json_request+="]}";
|
||||
response = http_get_call(url.hostname, url.port, '/rest/getutxos'+self.FORMAT_SEPARATOR+'json', json_request, True)
|
||||
|
||||
json_request = '/checkmempool/'
|
||||
for x in range(0, 15):
|
||||
json_request += txid+'-'+str(n)+'/'
|
||||
json_request = json_request.rstrip("/");
|
||||
response = http_get_call(url.hostname, url.port, '/rest/getutxos'+json_request+self.FORMAT_SEPARATOR+'json', '', True)
|
||||
assert_equal(response.status, 200) #must be a 500 because we exceeding the limits
|
||||
|
||||
self.nodes[0].generate(1) #generate block to not affect upcomming tests
|
||||
self.sync_all()
|
||||
|
||||
|
||||
################
|
||||
# /rest/block/ #
|
||||
################
|
||||
|
||||
|
||||
# check binary format
|
||||
response = http_get_call(url.hostname, url.port, '/rest/block/'+bb_hash+self.FORMAT_SEPARATOR+"bin", "", True)
|
||||
assert_equal(response.status, 200)
|
||||
|
@ -248,7 +249,7 @@ class RESTTest (BitcoinTestFramework):
|
|||
hex_string = http_get_call(url.hostname, url.port, '/rest/tx/'+tx_hash+self.FORMAT_SEPARATOR+"hex", "", True)
|
||||
assert_equal(hex_string.status, 200)
|
||||
assert_greater_than(int(response.getheader('content-length')), 10)
|
||||
|
||||
|
||||
|
||||
|
||||
# check block tx details
|
||||
|
@ -278,7 +279,7 @@ class RESTTest (BitcoinTestFramework):
|
|||
|
||||
#test rest bestblock
|
||||
bb_hash = self.nodes[0].getbestblockhash()
|
||||
|
||||
|
||||
json_string = http_get_call(url.hostname, url.port, '/rest/chaininfo.json')
|
||||
json_obj = json.loads(json_string)
|
||||
assert_equal(json_obj['bestblockhash'], bb_hash)
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
# Add python-bitcoinrpc to module search path:
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "python-bitcoinrpc"))
|
||||
|
||||
import json
|
||||
import shutil
|
||||
|
@ -16,9 +15,8 @@ import subprocess
|
|||
import tempfile
|
||||
import traceback
|
||||
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
from netutil import *
|
||||
from test_framework.util import *
|
||||
from test_framework.netutil import *
|
||||
|
||||
def run_bind_test(tmpdir, allow_ips, connect_to, addresses, expected):
|
||||
'''
|
||||
|
|
|
@ -19,12 +19,12 @@ that flag, we use a block time before the switchover date).
|
|||
NOTE: This test is very slow and may take more than 40 minutes to run.
|
||||
'''
|
||||
|
||||
from test_framework import ComparisonTestFramework
|
||||
from util import *
|
||||
from comptool import TestInstance, TestManager
|
||||
from mininode import *
|
||||
from blocktools import *
|
||||
from script import *
|
||||
from test_framework.test_framework import ComparisonTestFramework
|
||||
from test_framework.util import *
|
||||
from test_framework.comptool import TestInstance, TestManager
|
||||
from test_framework.mininode import *
|
||||
from test_framework.blocktools import *
|
||||
from test_framework.script import *
|
||||
import logging
|
||||
import copy
|
||||
import json
|
||||
|
@ -42,7 +42,7 @@ class ScriptTestFile(object):
|
|||
|
||||
def load_files(self):
|
||||
for f in self.files:
|
||||
self.data.extend(json.loads(open(f).read()))
|
||||
self.data.extend(json.loads(open(os.path.dirname(os.path.abspath(__file__))+"/"+f).read()))
|
||||
|
||||
# Skip over records that are not long enough to be tests
|
||||
def get_records(self):
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
|
||||
|
||||
class SignRawTransactionsTest(BitcoinTestFramework):
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
# Test fee estimation code
|
||||
#
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
|
||||
# Construct 2 trivial P2SH's and the ScriptSigs that spend them
|
||||
# So we can create many many transactions without needing to spend
|
||||
|
|
|
@ -14,7 +14,7 @@ Functionality to build scripts, as well as SignatureHash().
|
|||
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
from mininode import CTransaction, CTxOut, hash256
|
||||
from test_framework.mininode import CTransaction, CTxOut, hash256
|
||||
|
||||
import sys
|
||||
bchr = chr
|
||||
|
@ -27,7 +27,7 @@ if sys.version > '3':
|
|||
import copy
|
||||
import struct
|
||||
|
||||
import bignum
|
||||
import test_framework.bignum
|
||||
|
||||
MAX_SCRIPT_SIZE = 10000
|
||||
MAX_SCRIPT_ELEMENT_SIZE = 520
|
|
@ -8,13 +8,12 @@
|
|||
# Add python-bitcoinrpc to module search path:
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "python-bitcoinrpc"))
|
||||
|
||||
import shutil
|
||||
import tempfile
|
||||
import traceback
|
||||
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
|
||||
|
|
@ -8,7 +8,6 @@
|
|||
# Add python-bitcoinrpc to module search path:
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "python-bitcoinrpc"))
|
||||
|
||||
from decimal import Decimal, ROUND_DOWN
|
||||
import json
|
||||
|
@ -18,7 +17,7 @@ import subprocess
|
|||
import time
|
||||
import re
|
||||
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from authproxy import AuthServiceProxy, JSONRPCException
|
||||
from util import *
|
||||
|
||||
def p2p_port(n):
|
|
@ -7,10 +7,9 @@
|
|||
# Test proper accounting with malleable transactions
|
||||
#
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
from decimal import Decimal
|
||||
from util import *
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
|
|
@ -19,9 +19,8 @@
|
|||
# k) test ResendWalletTransactions - create transactions, startup fourth node, make sure it syncs
|
||||
#
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from util import *
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
|
||||
class WalletTest (BitcoinTestFramework):
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ Shutdown again, restore using importwallet,
|
|||
and confirm again balances are correct.
|
||||
"""
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
from random import randint
|
||||
import logging
|
||||
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
from test_framework import BitcoinTestFramework
|
||||
from util import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
|
||||
|
||||
class ZapWalletTXesTest (BitcoinTestFramework):
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.6.0</string>
|
||||
<string>10.7.0</string>
|
||||
|
||||
<key>LSArchitecturePriority</key>
|
||||
<array>
|
||||
|
@ -30,6 +30,12 @@
|
|||
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Bitcoin-Qt</string>
|
||||
|
||||
<key>CFBundleName</key>
|
||||
<string>Bitcoin-Qt</string>
|
||||
|
||||
<key>LSHasLocalizedDisplayName</key>
|
||||
<true/>
|
||||
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.bitcoinfoundation.Bitcoin-Qt</string>
|
||||
|
|
|
@ -92,6 +92,7 @@ BITCOIN_CORE_H = \
|
|||
compressor.h \
|
||||
consensus/consensus.h \
|
||||
consensus/params.h \
|
||||
consensus/validation.h \
|
||||
core_io.h \
|
||||
eccryptoverify.h \
|
||||
ecwrapper.h \
|
||||
|
@ -155,17 +156,6 @@ BITCOIN_CORE_H = \
|
|||
wallet/wallet_ismine.h \
|
||||
wallet/walletdb.h
|
||||
|
||||
JSON_H = \
|
||||
json/json_spirit.h \
|
||||
json/json_spirit_error_position.h \
|
||||
json/json_spirit_reader.h \
|
||||
json/json_spirit_reader_template.h \
|
||||
json/json_spirit_stream_reader.h \
|
||||
json/json_spirit_utils.h \
|
||||
json/json_spirit_value.h \
|
||||
json/json_spirit_writer.h \
|
||||
json/json_spirit_writer_template.h
|
||||
|
||||
obj/build.h: FORCE
|
||||
@$(MKDIR_P) $(builddir)/obj
|
||||
@$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \
|
||||
|
@ -203,7 +193,6 @@ libbitcoin_server_a_SOURCES = \
|
|||
txdb.cpp \
|
||||
txmempool.cpp \
|
||||
validationinterface.cpp \
|
||||
$(JSON_H) \
|
||||
$(BITCOIN_CORE_H)
|
||||
|
||||
# wallet: shared between bitcoind and bitcoin-qt, but only linked
|
||||
|
@ -346,6 +335,7 @@ endif
|
|||
|
||||
bitcoin_cli_LDADD = \
|
||||
$(LIBBITCOIN_CLI) \
|
||||
$(LIBBITCOIN_UNIVALUE) \
|
||||
$(LIBBITCOIN_UTIL) \
|
||||
$(LIBSECP256K1)
|
||||
|
||||
|
@ -357,6 +347,10 @@ bitcoin_tx_SOURCES = bitcoin-tx.cpp
|
|||
bitcoin_tx_CPPFLAGS = $(BITCOIN_INCLUDES)
|
||||
bitcoin_tx_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
|
||||
if TARGET_WINDOWS
|
||||
bitcoin_tx_SOURCES += bitcoin-tx-res.rc
|
||||
endif
|
||||
|
||||
bitcoin_tx_LDADD = \
|
||||
$(LIBBITCOIN_UNIVALUE) \
|
||||
$(LIBBITCOIN_COMMON) \
|
||||
|
|
|
@ -50,7 +50,7 @@ std::string CUnsignedAlert::ToString() const
|
|||
BOOST_FOREACH(int n, setCancel)
|
||||
strSetCancel += strprintf("%d ", n);
|
||||
std::string strSetSubVer;
|
||||
BOOST_FOREACH(std::string str, setSubVer)
|
||||
BOOST_FOREACH(const std::string& str, setSubVer)
|
||||
strSetSubVer += "\"" + str + "\" ";
|
||||
return strprintf(
|
||||
"CAlert(\n"
|
||||
|
@ -110,7 +110,7 @@ bool CAlert::Cancels(const CAlert& alert) const
|
|||
return (alert.nID <= nCancel || setCancel.count(alert.nID));
|
||||
}
|
||||
|
||||
bool CAlert::AppliesTo(int nVersion, std::string strSubVerIn) const
|
||||
bool CAlert::AppliesTo(int nVersion, const std::string& strSubVerIn) const
|
||||
{
|
||||
// TODO: rework for client-version-embedded-in-strSubVer ?
|
||||
return (IsInEffect() &&
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
uint256 GetHash() const;
|
||||
bool IsInEffect() const;
|
||||
bool Cancels(const CAlert& alert) const;
|
||||
bool AppliesTo(int nVersion, std::string strSubVerIn) const;
|
||||
bool AppliesTo(int nVersion, const std::string& strSubVerIn) const;
|
||||
bool AppliesToMe() const;
|
||||
bool RelayTo(CNode* pnode) const;
|
||||
bool CheckSignature(const std::vector<unsigned char>& alertKey) const;
|
||||
|
|
10
src/amount.h
10
src/amount.h
|
@ -16,7 +16,15 @@ typedef int64_t CAmount;
|
|||
static const CAmount COIN = 100000000;
|
||||
static const CAmount CENT = 1000000;
|
||||
|
||||
/** No amount larger than this (in satoshi) is valid */
|
||||
/** No amount larger than this (in satoshi) is valid.
|
||||
*
|
||||
* Note that this constant is *not* the total money supply, which in Bitcoin
|
||||
* currently happens to be less than 21,000,000 BTC for various reasons, but
|
||||
* rather a sanity check. As this sanity check is used by consensus-critical
|
||||
* validation code, the exact value of the MAX_MONEY constant is consensus
|
||||
* critical; in unusual circumstances like a(nother) overflow bug that allowed
|
||||
* for the creation of coins out of thin air modification could lead to a fork.
|
||||
* */
|
||||
static const CAmount MAX_MONEY = 21000000000 * COIN;
|
||||
inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
|
||||
|
||||
|
|
|
@ -17,13 +17,13 @@ BEGIN
|
|||
BLOCK "040904E4" // U.S. English - multilingual (hex)
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Bitcoin"
|
||||
VALUE "FileDescription", "Bitcoin-cli (OSS RPC client for Bitcoin)"
|
||||
VALUE "FileDescription", "bitcoin-cli (JSON-RPC client for Bitcoin Core)"
|
||||
VALUE "FileVersion", VER_FILEVERSION_STR
|
||||
VALUE "InternalName", "bitcoin-cli"
|
||||
VALUE "LegalCopyright", COPYRIGHT_STR
|
||||
VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php."
|
||||
VALUE "OriginalFilename", "bitcoin-cli.exe"
|
||||
VALUE "ProductName", "Bitcoin-cli"
|
||||
VALUE "ProductName", "bitcoin-cli"
|
||||
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
|
||||
END
|
||||
END
|
||||
|
|
|
@ -12,8 +12,9 @@
|
|||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
#include "univalue/univalue.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace json_spirit;
|
||||
|
||||
std::string HelpMessageCli()
|
||||
{
|
||||
|
@ -94,7 +95,7 @@ static bool AppInitRPC(int argc, char* argv[])
|
|||
return true;
|
||||
}
|
||||
|
||||
Object CallRPC(const string& strMethod, const Array& params)
|
||||
UniValue CallRPC(const string& strMethod, const UniValue& params)
|
||||
{
|
||||
if (mapArgs["-rpcuser"] == "" && mapArgs["-rpcpassword"] == "")
|
||||
throw runtime_error(strprintf(
|
||||
|
@ -142,10 +143,10 @@ Object CallRPC(const string& strMethod, const Array& params)
|
|||
throw runtime_error("no response from server");
|
||||
|
||||
// Parse reply
|
||||
Value valReply;
|
||||
if (!read_string(strReply, valReply))
|
||||
UniValue valReply(UniValue::VSTR);
|
||||
if (!valReply.read(strReply))
|
||||
throw runtime_error("couldn't parse reply from server");
|
||||
const Object& reply = valReply.get_obj();
|
||||
const UniValue& reply = valReply.get_obj();
|
||||
if (reply.empty())
|
||||
throw runtime_error("expected reply to have result, error and id properties");
|
||||
|
||||
|
@ -170,35 +171,34 @@ int CommandLineRPC(int argc, char *argv[])
|
|||
|
||||
// Parameters default to strings
|
||||
std::vector<std::string> strParams(&argv[2], &argv[argc]);
|
||||
Array params = RPCConvertValues(strMethod, strParams);
|
||||
UniValue params = RPCConvertValues(strMethod, strParams);
|
||||
|
||||
// Execute and handle connection failures with -rpcwait
|
||||
const bool fWait = GetBoolArg("-rpcwait", false);
|
||||
do {
|
||||
try {
|
||||
const Object reply = CallRPC(strMethod, params);
|
||||
const UniValue reply = CallRPC(strMethod, params);
|
||||
|
||||
// Parse reply
|
||||
const Value& result = find_value(reply, "result");
|
||||
const Value& error = find_value(reply, "error");
|
||||
const UniValue& result = find_value(reply, "result");
|
||||
const UniValue& error = find_value(reply, "error");
|
||||
|
||||
if (error.type() != null_type) {
|
||||
if (!error.isNull()) {
|
||||
// Error
|
||||
const int code = find_value(error.get_obj(), "code").get_int();
|
||||
int code = error["code"].get_int();
|
||||
if (fWait && code == RPC_IN_WARMUP)
|
||||
throw CConnectionFailed("server in warmup");
|
||||
strPrint = "error: " + write_string(error, false);
|
||||
strPrint = "error: " + error.write();
|
||||
nRet = abs(code);
|
||||
} else {
|
||||
// Result
|
||||
if (result.type() == null_type)
|
||||
if (result.isNull())
|
||||
strPrint = "";
|
||||
else if (result.type() == str_type)
|
||||
else if (result.isStr())
|
||||
strPrint = result.get_str();
|
||||
else
|
||||
strPrint = write_string(result, true);
|
||||
strPrint = result.write(2);
|
||||
}
|
||||
|
||||
// Connection succeeded, no need to retry.
|
||||
break;
|
||||
}
|
||||
|
|
35
src/bitcoin-tx-res.rc
Normal file
35
src/bitcoin-tx-res.rc
Normal file
|
@ -0,0 +1,35 @@
|
|||
#include <windows.h> // needed for VERSIONINFO
|
||||
#include "clientversion.h" // holds the needed client version information
|
||||
|
||||
#define VER_PRODUCTVERSION CLIENT_VERSION_MAJOR,CLIENT_VERSION_MINOR,CLIENT_VERSION_REVISION,CLIENT_VERSION_BUILD
|
||||
#define VER_PRODUCTVERSION_STR STRINGIZE(CLIENT_VERSION_MAJOR) "." STRINGIZE(CLIENT_VERSION_MINOR) "." STRINGIZE(CLIENT_VERSION_REVISION) "." STRINGIZE(CLIENT_VERSION_BUILD)
|
||||
#define VER_FILEVERSION VER_PRODUCTVERSION
|
||||
#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION VER_FILEVERSION
|
||||
PRODUCTVERSION VER_PRODUCTVERSION
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904E4" // U.S. English - multilingual (hex)
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Bitcoin"
|
||||
VALUE "FileDescription", "bitcoin-tx (CLI Bitcoin transaction editor utility)"
|
||||
VALUE "FileVersion", VER_FILEVERSION_STR
|
||||
VALUE "InternalName", "bitcoin-tx"
|
||||
VALUE "LegalCopyright", COPYRIGHT_STR
|
||||
VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php."
|
||||
VALUE "OriginalFilename", "bitcoin-tx.exe"
|
||||
VALUE "ProductName", "bitcoin-tx"
|
||||
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
|
||||
END
|
||||
END
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0, 1252 // language neutral - multilingual (decimal)
|
||||
END
|
||||
END
|
|
@ -346,7 +346,7 @@ static void MutateTxSign(CMutableTransaction& tx, const string& flagStr)
|
|||
UniValue keysObj = registers["privatekeys"];
|
||||
fGivenKeys = true;
|
||||
|
||||
for (unsigned int kidx = 0; kidx < keysObj.count(); kidx++) {
|
||||
for (unsigned int kidx = 0; kidx < keysObj.size(); kidx++) {
|
||||
if (!keysObj[kidx].isStr())
|
||||
throw runtime_error("privatekey not a string");
|
||||
CBitcoinSecret vchSecret;
|
||||
|
@ -363,7 +363,7 @@ static void MutateTxSign(CMutableTransaction& tx, const string& flagStr)
|
|||
throw runtime_error("prevtxs register variable must be set.");
|
||||
UniValue prevtxsObj = registers["prevtxs"];
|
||||
{
|
||||
for (unsigned int previdx = 0; previdx < prevtxsObj.count(); previdx++) {
|
||||
for (unsigned int previdx = 0; previdx < prevtxsObj.size(); previdx++) {
|
||||
UniValue prevOut = prevtxsObj[previdx];
|
||||
if (!prevOut.isObject())
|
||||
throw runtime_error("expected prevtxs internal object");
|
||||
|
|
|
@ -17,13 +17,13 @@ BEGIN
|
|||
BLOCK "040904E4" // U.S. English - multilingual (hex)
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Bitcoin"
|
||||
VALUE "FileDescription", "Bitcoind (OSS daemon/client for Bitcoin)"
|
||||
VALUE "FileDescription", "bitcoind (Bitcoin node with a JSON-RPC server)"
|
||||
VALUE "FileVersion", VER_FILEVERSION_STR
|
||||
VALUE "InternalName", "bitcoind"
|
||||
VALUE "LegalCopyright", COPYRIGHT_STR
|
||||
VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php."
|
||||
VALUE "OriginalFilename", "bitcoind.exe"
|
||||
VALUE "ProductName", "Bitcoind"
|
||||
VALUE "ProductName", "bitcoind"
|
||||
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
|
||||
END
|
||||
END
|
||||
|
|
|
@ -82,9 +82,10 @@ CBlockIndex* CBlockIndex::GetAncestor(int height)
|
|||
while (heightWalk > height) {
|
||||
int heightSkip = GetSkipHeight(heightWalk);
|
||||
int heightSkipPrev = GetSkipHeight(heightWalk - 1);
|
||||
if (heightSkip == height ||
|
||||
(heightSkip > height && !(heightSkipPrev < heightSkip - 2 &&
|
||||
heightSkipPrev >= height))) {
|
||||
if (pindexWalk->pskip != NULL &&
|
||||
(heightSkip == height ||
|
||||
(heightSkip > height && !(heightSkipPrev < heightSkip - 2 &&
|
||||
heightSkipPrev >= height)))) {
|
||||
// Only follow pskip if pprev->pskip isn't better than pskip->pprev.
|
||||
pindexWalk = pindexWalk->pskip;
|
||||
heightWalk = heightSkip;
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
*/
|
||||
const char* pszTimestamp = "insert timestamp string";//"The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
|
||||
CMutableTransaction txNew;
|
||||
txNew.nVersion = 1;
|
||||
txNew.vin.resize(1);
|
||||
txNew.vout.resize(1);
|
||||
txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
|
||||
|
|
|
@ -24,15 +24,6 @@ namespace Checkpoints {
|
|||
*/
|
||||
static const double SIGCHECK_VERIFICATION_FACTOR = 5.0;
|
||||
|
||||
bool CheckBlock(const CCheckpointData& data, int nHeight, const uint256& hash)
|
||||
{
|
||||
const MapCheckpoints& checkpoints = data.mapCheckpoints;
|
||||
|
||||
MapCheckpoints::const_iterator i = checkpoints.find(nHeight);
|
||||
if (i == checkpoints.end()) return true;
|
||||
return hash == i->second;
|
||||
}
|
||||
|
||||
//! Guess how far we are in the verification process at the given block index
|
||||
double GuessVerificationProgress(const CCheckpointData& data, CBlockIndex *pindex, bool fSigchecks) {
|
||||
if (pindex==NULL)
|
||||
|
|
|
@ -26,9 +26,6 @@ struct CCheckpointData {
|
|||
double fTransactionsPerDay;
|
||||
};
|
||||
|
||||
//! Returns true if block passes checkpoint checks
|
||||
bool CheckBlock(const CCheckpointData& data, int nHeight, const uint256& hash);
|
||||
|
||||
//! Return conservative estimate of total number of blocks, 0 if unknown
|
||||
int GetTotalBlocksEstimate(const CCheckpointData& data);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
//! These need to be macros, as clientversion.cpp's and bitcoin*-res.rc's voodoo requires it
|
||||
#define CLIENT_VERSION_MAJOR 0
|
||||
#define CLIENT_VERSION_MINOR 10
|
||||
#define CLIENT_VERSION_MINOR 11
|
||||
#define CLIENT_VERSION_REVISION 99
|
||||
#define CLIENT_VERSION_BUILD 0
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
#if defined(HAVE_ENDIAN_H)
|
||||
#include <endian.h>
|
||||
#elif defined(HAVE_SYS_ENDIAN_H)
|
||||
#include <sys/endian.h>
|
||||
#endif
|
||||
|
||||
#if defined(WORDS_BIGENDIAN)
|
||||
|
|
80
src/consensus/validation.h
Normal file
80
src/consensus/validation.h
Normal file
|
@ -0,0 +1,80 @@
|
|||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_CONSENSUS_VALIDATION_H
|
||||
#define BITCOIN_CONSENSUS_VALIDATION_H
|
||||
|
||||
#include <string>
|
||||
|
||||
/** "reject" message codes */
|
||||
static const unsigned char REJECT_MALFORMED = 0x01;
|
||||
static const unsigned char REJECT_INVALID = 0x10;
|
||||
static const unsigned char REJECT_OBSOLETE = 0x11;
|
||||
static const unsigned char REJECT_DUPLICATE = 0x12;
|
||||
static const unsigned char REJECT_NONSTANDARD = 0x40;
|
||||
static const unsigned char REJECT_DUST = 0x41;
|
||||
static const unsigned char REJECT_INSUFFICIENTFEE = 0x42;
|
||||
static const unsigned char REJECT_CHECKPOINT = 0x43;
|
||||
|
||||
/** Capture information about block/transaction validation */
|
||||
class CValidationState {
|
||||
private:
|
||||
enum mode_state {
|
||||
MODE_VALID, //! everything ok
|
||||
MODE_INVALID, //! network rule violation (DoS value may be set)
|
||||
MODE_ERROR, //! run-time error
|
||||
} mode;
|
||||
int nDoS;
|
||||
std::string strRejectReason;
|
||||
unsigned char chRejectCode;
|
||||
bool corruptionPossible;
|
||||
public:
|
||||
CValidationState() : mode(MODE_VALID), nDoS(0), chRejectCode(0), corruptionPossible(false) {}
|
||||
bool DoS(int level, bool ret = false,
|
||||
unsigned char chRejectCodeIn=0, std::string strRejectReasonIn="",
|
||||
bool corruptionIn=false) {
|
||||
chRejectCode = chRejectCodeIn;
|
||||
strRejectReason = strRejectReasonIn;
|
||||
corruptionPossible = corruptionIn;
|
||||
if (mode == MODE_ERROR)
|
||||
return ret;
|
||||
nDoS += level;
|
||||
mode = MODE_INVALID;
|
||||
return ret;
|
||||
}
|
||||
bool Invalid(bool ret = false,
|
||||
unsigned char _chRejectCode=0, std::string _strRejectReason="") {
|
||||
return DoS(0, ret, _chRejectCode, _strRejectReason);
|
||||
}
|
||||
bool Error(const std::string& strRejectReasonIn) {
|
||||
if (mode == MODE_VALID)
|
||||
strRejectReason = strRejectReasonIn;
|
||||
mode = MODE_ERROR;
|
||||
return false;
|
||||
}
|
||||
bool IsValid() const {
|
||||
return mode == MODE_VALID;
|
||||
}
|
||||
bool IsInvalid() const {
|
||||
return mode == MODE_INVALID;
|
||||
}
|
||||
bool IsError() const {
|
||||
return mode == MODE_ERROR;
|
||||
}
|
||||
bool IsInvalid(int &nDoSOut) const {
|
||||
if (IsInvalid()) {
|
||||
nDoSOut = nDoS;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool CorruptionPossible() const {
|
||||
return corruptionPossible;
|
||||
}
|
||||
unsigned char GetRejectCode() const { return chRejectCode; }
|
||||
std::string GetRejectReason() const { return strRejectReason; }
|
||||
};
|
||||
|
||||
#endif // BITCOIN_CONSENSUS_VALIDATION_H
|
|
@ -15,7 +15,7 @@ class uint256;
|
|||
class UniValue;
|
||||
|
||||
// core_read.cpp
|
||||
extern CScript ParseScript(std::string s);
|
||||
extern CScript ParseScript(const std::string& s);
|
||||
extern bool DecodeHexTx(CTransaction& tx, const std::string& strHexTx);
|
||||
extern bool DecodeHexBlk(CBlock&, const std::string& strHexBlk);
|
||||
extern uint256 ParseHashUV(const UniValue& v, const std::string& strName);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
CScript ParseScript(std::string s)
|
||||
CScript ParseScript(const std::string& s)
|
||||
{
|
||||
CScript result;
|
||||
|
||||
|
|
186
src/init.cpp
186
src/init.cpp
|
@ -13,6 +13,7 @@
|
|||
#include "amount.h"
|
||||
#include "checkpoints.h"
|
||||
#include "compat/sanity.h"
|
||||
#include "consensus/validation.h"
|
||||
#include "key.h"
|
||||
#include "main.h"
|
||||
#include "miner.h"
|
||||
|
@ -39,7 +40,9 @@
|
|||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/interprocess/sync/file_lock.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <openssl/crypto.h>
|
||||
|
@ -190,7 +193,11 @@ void Shutdown()
|
|||
pwalletMain->Flush(true);
|
||||
#endif
|
||||
#ifndef WIN32
|
||||
boost::filesystem::remove(GetPidFile());
|
||||
try {
|
||||
boost::filesystem::remove(GetPidFile());
|
||||
} catch (const boost::filesystem::filesystem_error& e) {
|
||||
LogPrintf("%s: Unable to remove pidfile: %s\n", __func__, e.what());
|
||||
}
|
||||
#endif
|
||||
UnregisterAllValidationInterfaces();
|
||||
#ifdef ENABLE_WALLET
|
||||
|
@ -255,8 +262,10 @@ void OnRPCPreCommand(const CRPCCommand& cmd)
|
|||
|
||||
std::string HelpMessage(HelpMessageMode mode)
|
||||
{
|
||||
const bool showDebug = GetBoolArg("-help-debug", false);
|
||||
|
||||
// When adding new options to the categories, please keep and ensure alphabetical ordering.
|
||||
// Do not translate _(...) -help-debug options, Many technical terms, and only a very small audience, so is unnecessary stress to translators.
|
||||
string strUsage = HelpMessageGroup(_("Options:"));
|
||||
strUsage += HelpMessageOpt("-?", _("This help message"));
|
||||
strUsage += HelpMessageOpt("-alertnotify=<cmd>", _("Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)"));
|
||||
|
@ -313,7 +322,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||
strUsage += HelpMessageOpt("-timeout=<n>", strprintf(_("Specify connection timeout in milliseconds (minimum: 1, default: %d)"), DEFAULT_CONNECT_TIMEOUT));
|
||||
#ifdef USE_UPNP
|
||||
#if USE_UPNP
|
||||
strUsage += HelpMessageOpt("-upnp", _("Use UPnP to map the listening port (default: 1 when listening)"));
|
||||
strUsage += HelpMessageOpt("-upnp", _("Use UPnP to map the listening port (default: 1 when listening and no -proxy)"));
|
||||
#else
|
||||
strUsage += HelpMessageOpt("-upnp", strprintf(_("Use UPnP to map the listening port (default: %u)"), 0));
|
||||
#endif
|
||||
|
@ -321,14 +330,13 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||
strUsage += HelpMessageOpt("-whitebind=<addr>", _("Bind to given address and whitelist peers connecting to it. Use [host]:port notation for IPv6"));
|
||||
strUsage += HelpMessageOpt("-whitelist=<netmask>", _("Whitelist peers connecting from the given netmask or IP address. Can be specified multiple times.") +
|
||||
" " + _("Whitelisted peers cannot be DoS banned and their transactions are always relayed, even if they are already in the mempool, useful e.g. for a gateway"));
|
||||
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
strUsage += HelpMessageGroup(_("Wallet options:"));
|
||||
strUsage += HelpMessageOpt("-disablewallet", _("Do not load the wallet and disable wallet RPC calls"));
|
||||
strUsage += HelpMessageOpt("-keypool=<n>", strprintf(_("Set key pool size to <n> (default: %u)"), 100));
|
||||
if (GetBoolArg("-help-debug", false))
|
||||
strUsage += HelpMessageOpt("-mintxfee=<amt>", strprintf(_("Fees (in BTC/Kb) smaller than this are considered zero fee for transaction creation (default: %s)"),
|
||||
if (showDebug)
|
||||
strUsage += HelpMessageOpt("-mintxfee=<amt>", strprintf("Fees (in BTC/Kb) smaller than this are considered zero fee for transaction creation (default: %s)",
|
||||
FormatMoney(CWallet::minTxFee.GetFeePerK())));
|
||||
strUsage += HelpMessageOpt("-paytxfee=<amt>", strprintf(_("Fee (in BTC/kB) to add to transactions you send (default: %s)"), FormatMoney(payTxFee.GetFeePerK())));
|
||||
strUsage += HelpMessageOpt("-rescan", _("Rescan the block chain for missing wallet transactions") + " " + _("on startup"));
|
||||
|
@ -344,26 +352,25 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||
strUsage += HelpMessageOpt("-walletnotify=<cmd>", _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)"));
|
||||
strUsage += HelpMessageOpt("-zapwallettxes=<mode>", _("Delete all wallet transactions and only recover those parts of the blockchain through -rescan on startup") +
|
||||
" " + _("(1 = keep tx meta data e.g. account owner and payment request information, 2 = drop tx meta data)"));
|
||||
|
||||
#endif
|
||||
|
||||
strUsage += HelpMessageGroup(_("Debugging/Testing options:"));
|
||||
if (GetBoolArg("-help-debug", false))
|
||||
if (showDebug)
|
||||
{
|
||||
strUsage += HelpMessageOpt("-checkpoints", strprintf(_("Only accept block chain matching built-in checkpoints (default: %u)"), 1));
|
||||
strUsage += HelpMessageOpt("-dblogsize=<n>", strprintf(_("Flush database activity from memory pool to disk log every <n> megabytes (default: %u)"), 100));
|
||||
strUsage += HelpMessageOpt("-disablesafemode", strprintf(_("Disable safemode, override a real safe mode event (default: %u)"), 0));
|
||||
strUsage += HelpMessageOpt("-testsafemode", strprintf(_("Force safe mode (default: %u)"), 0));
|
||||
strUsage += HelpMessageOpt("-dropmessagestest=<n>", _("Randomly drop 1 of every <n> network messages"));
|
||||
strUsage += HelpMessageOpt("-fuzzmessagestest=<n>", _("Randomly fuzz 1 of every <n> network messages"));
|
||||
strUsage += HelpMessageOpt("-flushwallet", strprintf(_("Run a thread to flush wallet periodically (default: %u)"), 1));
|
||||
strUsage += HelpMessageOpt("-stopafterblockimport", strprintf(_("Stop running after importing blocks from disk (default: %u)"), 0));
|
||||
strUsage += HelpMessageOpt("-checkpoints", strprintf("Disable expensive verification for known chain history (default: %u)", 1));
|
||||
strUsage += HelpMessageOpt("-dblogsize=<n>", strprintf("Flush database activity from memory pool to disk log every <n> megabytes (default: %u)", 100));
|
||||
strUsage += HelpMessageOpt("-disablesafemode", strprintf("Disable safemode, override a real safe mode event (default: %u)", 0));
|
||||
strUsage += HelpMessageOpt("-testsafemode", strprintf("Force safe mode (default: %u)", 0));
|
||||
strUsage += HelpMessageOpt("-dropmessagestest=<n>", "Randomly drop 1 of every <n> network messages");
|
||||
strUsage += HelpMessageOpt("-fuzzmessagestest=<n>", "Randomly fuzz 1 of every <n> network messages");
|
||||
strUsage += HelpMessageOpt("-flushwallet", strprintf("Run a thread to flush wallet periodically (default: %u)", 1));
|
||||
strUsage += HelpMessageOpt("-stopafterblockimport", strprintf("Stop running after importing blocks from disk (default: %u)", 0));
|
||||
}
|
||||
string debugCategories = "addrman, alert, bench, coindb, db, lock, rand, rpc, selectcoins, mempool, net, proxy, prune"; // Don't translate these and qt below
|
||||
if (mode == HMM_BITCOIN_QT)
|
||||
debugCategories += ", qt";
|
||||
strUsage += HelpMessageOpt("-debug=<category>", strprintf(_("Output debugging information (default: %u, supplying <category> is optional)"), 0) + ". " +
|
||||
_("If <category> is not supplied, output all debugging information.") + _("<category> can be:") + " " + debugCategories + ".");
|
||||
_("If <category> is not supplied or if <category> = 1, output all debugging information.") + _("<category> can be:") + " " + debugCategories + ".");
|
||||
#ifdef ENABLE_WALLET
|
||||
strUsage += HelpMessageOpt("-gen", strprintf(_("Generate coins (default: %u)"), 0));
|
||||
strUsage += HelpMessageOpt("-genproclimit=<n>", strprintf(_("Set the number of threads for coin generation if enabled (-1 = all cores, default: %d)"), 1));
|
||||
|
@ -371,21 +378,20 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||
strUsage += HelpMessageOpt("-help-debug", _("Show all debugging options (usage: --help -help-debug)"));
|
||||
strUsage += HelpMessageOpt("-logips", strprintf(_("Include IP addresses in debug output (default: %u)"), 0));
|
||||
strUsage += HelpMessageOpt("-logtimestamps", strprintf(_("Prepend debug output with timestamp (default: %u)"), 1));
|
||||
if (GetBoolArg("-help-debug", false))
|
||||
if (showDebug)
|
||||
{
|
||||
strUsage += HelpMessageOpt("-limitfreerelay=<n>", strprintf(_("Continuously rate-limit free transactions to <n>*1000 bytes per minute (default: %u)"), 15));
|
||||
strUsage += HelpMessageOpt("-relaypriority", strprintf(_("Require high priority for relaying free or low-fee transactions (default: %u)"), 1));
|
||||
strUsage += HelpMessageOpt("-maxsigcachesize=<n>", strprintf(_("Limit size of signature cache to <n> entries (default: %u)"), 50000));
|
||||
strUsage += HelpMessageOpt("-limitfreerelay=<n>", strprintf("Continuously rate-limit free transactions to <n>*1000 bytes per minute (default: %u)", 15));
|
||||
strUsage += HelpMessageOpt("-relaypriority", strprintf("Require high priority for relaying free or low-fee transactions (default: %u)", 1));
|
||||
strUsage += HelpMessageOpt("-maxsigcachesize=<n>", strprintf("Limit size of signature cache to <n> entries (default: %u)", 50000));
|
||||
}
|
||||
strUsage += HelpMessageOpt("-minrelaytxfee=<amt>", strprintf(_("Fees (in BTC/Kb) smaller than this are considered zero fee for relaying (default: %s)"), FormatMoney(::minRelayTxFee.GetFeePerK())));
|
||||
strUsage += HelpMessageOpt("-printtoconsole", _("Send trace/debug info to console instead of debug.log file"));
|
||||
if (GetBoolArg("-help-debug", false))
|
||||
if (showDebug)
|
||||
{
|
||||
strUsage += HelpMessageOpt("-printpriority", strprintf(_("Log transaction priority and fee per kB when mining blocks (default: %u)"), 0));
|
||||
strUsage += HelpMessageOpt("-privdb", strprintf(_("Sets the DB_PRIVATE flag in the wallet db environment (default: %u)"), 1));
|
||||
strUsage += HelpMessageOpt("-regtest", _("Enter regression test mode, which uses a special chain in which blocks can be solved instantly.") + " " +
|
||||
_("This is intended for regression testing tools and app development.") + " " +
|
||||
_("In this mode -genproclimit controls how many blocks are generated immediately."));
|
||||
strUsage += HelpMessageOpt("-printpriority", strprintf("Log transaction priority and fee per kB when mining blocks (default: %u)", 0));
|
||||
strUsage += HelpMessageOpt("-privdb", strprintf("Sets the DB_PRIVATE flag in the wallet db environment (default: %u)", 1));
|
||||
strUsage += HelpMessageOpt("-regtest", "Enter regression test mode, which uses a special chain in which blocks can be solved instantly. "
|
||||
"This is intended for regression testing tools and app development.");
|
||||
}
|
||||
strUsage += HelpMessageOpt("-shrinkdebugfile", _("Shrink debug.log file on client startup (default: 1 when no -debug)"));
|
||||
strUsage += HelpMessageOpt("-testnet", _("Use the test network"));
|
||||
|
@ -398,6 +404,8 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||
strUsage += HelpMessageOpt("-blockminsize=<n>", strprintf(_("Set minimum block size in bytes (default: %u)"), 0));
|
||||
strUsage += HelpMessageOpt("-blockmaxsize=<n>", strprintf(_("Set maximum block size in bytes (default: %d)"), DEFAULT_BLOCK_MAX_SIZE));
|
||||
strUsage += HelpMessageOpt("-blockprioritysize=<n>", strprintf(_("Set maximum size of high-priority/low-fee transactions in bytes (default: %d)"), DEFAULT_BLOCK_PRIORITY_SIZE));
|
||||
if (showDebug)
|
||||
strUsage += HelpMessageOpt("-blockversion=<n>", strprintf("Override block version to test forking scenarios (default: %d)", (int)CBlock::CURRENT_VERSION));
|
||||
|
||||
strUsage += HelpMessageGroup(_("RPC server options:"));
|
||||
strUsage += HelpMessageOpt("-server", _("Accept command line and JSON-RPC commands"));
|
||||
|
@ -419,8 +427,8 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||
if (mode == HMM_BITCOIN_QT)
|
||||
{
|
||||
strUsage += HelpMessageGroup(_("UI Options:"));
|
||||
if (GetBoolArg("-help-debug", false)) {
|
||||
strUsage += HelpMessageOpt("-allowselfsignedrootcertificates", _("Allow self signed root certificates (default: 0)"));
|
||||
if (showDebug) {
|
||||
strUsage += HelpMessageOpt("-allowselfsignedrootcertificates", "Allow self signed root certificates (default: 0)");
|
||||
}
|
||||
strUsage += HelpMessageOpt("-choosedatadir", _("Choose data directory on startup (default: 0)"));
|
||||
strUsage += HelpMessageOpt("-lang=<lang>", _("Set language, for example \"de_DE\" (default: system locale)"));
|
||||
|
@ -468,25 +476,44 @@ struct CImportingNow
|
|||
|
||||
// If we're using -prune with -reindex, then delete block files that will be ignored by the
|
||||
// reindex. Since reindexing works by starting at block file 0 and looping until a blockfile
|
||||
// is missing, and since pruning works by deleting the oldest block file first, just check
|
||||
// for block file 0, and if it doesn't exist, delete all the block files in the
|
||||
// directory (since they won't be read by the reindex but will take up disk space).
|
||||
void DeleteAllBlockFiles()
|
||||
// is missing, do the same here to delete any later block files after a gap. Also delete all
|
||||
// rev files since they'll be rewritten by the reindex anyway. This ensures that vinfoBlockFile
|
||||
// is in sync with what's actually on disk by the time we start downloading, so that pruning
|
||||
// works correctly.
|
||||
void CleanupBlockRevFiles()
|
||||
{
|
||||
if (boost::filesystem::exists(GetBlockPosFilename(CDiskBlockPos(0, 0), "blk")))
|
||||
return;
|
||||
using namespace boost::filesystem;
|
||||
map<string, path> mapBlockFiles;
|
||||
|
||||
LogPrintf("Removing all blk?????.dat and rev?????.dat files for -reindex with -prune\n");
|
||||
boost::filesystem::path blocksdir = GetDataDir() / "blocks";
|
||||
for (boost::filesystem::directory_iterator it(blocksdir); it != boost::filesystem::directory_iterator(); it++) {
|
||||
if (is_regular_file(*it)) {
|
||||
if ((it->path().filename().string().length() == 12) &&
|
||||
(it->path().filename().string().substr(8,4) == ".dat") &&
|
||||
((it->path().filename().string().substr(0,3) == "blk") ||
|
||||
(it->path().filename().string().substr(0,3) == "rev")))
|
||||
boost::filesystem::remove(it->path());
|
||||
// Glob all blk?????.dat and rev?????.dat files from the blocks directory.
|
||||
// Remove the rev files immediately and insert the blk file paths into an
|
||||
// ordered map keyed by block file index.
|
||||
LogPrintf("Removing unusable blk?????.dat and rev?????.dat files for -reindex with -prune\n");
|
||||
path blocksdir = GetDataDir() / "blocks";
|
||||
for (directory_iterator it(blocksdir); it != directory_iterator(); it++) {
|
||||
if (is_regular_file(*it) &&
|
||||
it->path().filename().string().length() == 12 &&
|
||||
it->path().filename().string().substr(8,4) == ".dat")
|
||||
{
|
||||
if (it->path().filename().string().substr(0,3) == "blk")
|
||||
mapBlockFiles[it->path().filename().string().substr(3,5)] = it->path();
|
||||
else if (it->path().filename().string().substr(0,3) == "rev")
|
||||
remove(it->path());
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all block files that aren't part of a contiguous set starting at
|
||||
// zero by walking the ordered map (keys are block file indices) by
|
||||
// keeping a separate counter. Once we hit a gap (or if 0 doesn't exist)
|
||||
// start removing block files.
|
||||
int nContigCounter = 0;
|
||||
BOOST_FOREACH(const PAIRTYPE(string, path)& item, mapBlockFiles) {
|
||||
if (atoi(item.first) == nContigCounter) {
|
||||
nContigCounter++;
|
||||
continue;
|
||||
}
|
||||
remove(item.second);
|
||||
}
|
||||
}
|
||||
|
||||
void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
|
||||
|
@ -530,7 +557,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
|
|||
}
|
||||
|
||||
// -loadblock=
|
||||
BOOST_FOREACH(boost::filesystem::path &path, vImportFiles) {
|
||||
BOOST_FOREACH(const boost::filesystem::path& path, vImportFiles) {
|
||||
FILE *file = fopen(path.string().c_str(), "rb");
|
||||
if (file) {
|
||||
CImportingNow imp;
|
||||
|
@ -663,6 +690,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
// to protect privacy, do not listen by default if a default proxy server is specified
|
||||
if (SoftSetBoolArg("-listen", false))
|
||||
LogPrintf("%s: parameter interaction: -proxy set -> setting -listen=0\n", __func__);
|
||||
// to protect privacy, do not use UPNP when a proxy is set. The user may still specify -listen=1
|
||||
// to listen locally, so don't rely on this happening through -listen below.
|
||||
if (SoftSetBoolArg("-upnp", false))
|
||||
LogPrintf("%s: parameter interaction: -proxy set -> setting -upnp=0\n", __func__);
|
||||
// to protect privacy, do not discover addresses by default
|
||||
if (SoftSetBoolArg("-discover", false))
|
||||
LogPrintf("%s: parameter interaction: -proxy set -> setting -discover=0\n", __func__);
|
||||
|
@ -705,16 +736,12 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
nMaxConnections = nFD - MIN_CORE_FILEDESCRIPTORS;
|
||||
|
||||
// if using block pruning, then disable txindex
|
||||
// also disable the wallet (for now, until SPV support is implemented in wallet)
|
||||
if (GetArg("-prune", 0)) {
|
||||
if (GetBoolArg("-txindex", false))
|
||||
return InitError(_("Prune mode is incompatible with -txindex."));
|
||||
#ifdef ENABLE_WALLET
|
||||
if (!GetBoolArg("-disablewallet", false)) {
|
||||
if (SoftSetBoolArg("-disablewallet", true))
|
||||
LogPrintf("%s : parameter interaction: -prune -> setting -disablewallet=1\n", __func__);
|
||||
else
|
||||
return InitError(_("Can't run with a wallet in prune mode."));
|
||||
if (GetBoolArg("-rescan", false)) {
|
||||
return InitError(_("Rescans are not possible in pruned mode. You will need to use -reindex which will download the whole blockchain again."));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -778,12 +805,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
if (nConnectTimeout <= 0)
|
||||
nConnectTimeout = DEFAULT_CONNECT_TIMEOUT;
|
||||
|
||||
// Continue to put "/P2SH/" in the coinbase to monitor
|
||||
// BIP16 support.
|
||||
// This can be removed eventually...
|
||||
const char* pszP2SH = "/P2SH/";
|
||||
COINBASE_FLAGS << std::vector<unsigned char>(pszP2SH, pszP2SH+strlen(pszP2SH));
|
||||
|
||||
// Fee-per-kilobyte amount considered the same as "free"
|
||||
// If you are mining, be careful setting this:
|
||||
// if you set it to zero then
|
||||
|
@ -865,9 +886,15 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
boost::filesystem::path pathLockFile = GetDataDir() / ".lock";
|
||||
FILE* file = fopen(pathLockFile.string().c_str(), "a"); // empty lock file; created if it doesn't exist.
|
||||
if (file) fclose(file);
|
||||
static boost::interprocess::file_lock lock(pathLockFile.string().c_str());
|
||||
if (!lock.try_lock())
|
||||
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. Bitcoin Core is probably already running."), strDataDir));
|
||||
|
||||
try {
|
||||
static boost::interprocess::file_lock lock(pathLockFile.string().c_str());
|
||||
if (!lock.try_lock())
|
||||
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. Bitcoin Core is probably already running."), strDataDir));
|
||||
} catch(const boost::interprocess::interprocess_exception& e) {
|
||||
return InitError(strprintf(_("Cannot obtain a lock on data directory %s. Bitcoin Core is probably already running.") + " %s.", strDataDir, e.what()));
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
CreatePidFile(GetPidFile(), getpid());
|
||||
#endif
|
||||
|
@ -920,15 +947,15 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
|
||||
std::string warningString;
|
||||
std::string errorString;
|
||||
|
||||
|
||||
if (!CWallet::Verify(strWalletFile, warningString, errorString))
|
||||
return false;
|
||||
|
||||
|
||||
if (!warningString.empty())
|
||||
InitWarning(warningString);
|
||||
if (!errorString.empty())
|
||||
return InitError(warningString);
|
||||
|
||||
|
||||
} // (!fDisableWallet)
|
||||
#endif // ENABLE_WALLET
|
||||
// ********************************************************* Step 6: network initialization
|
||||
|
@ -937,7 +964,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
|
||||
if (mapArgs.count("-onlynet")) {
|
||||
std::set<enum Network> nets;
|
||||
BOOST_FOREACH(std::string snet, mapMultiArgs["-onlynet"]) {
|
||||
BOOST_FOREACH(const std::string& snet, mapMultiArgs["-onlynet"]) {
|
||||
enum Network net = ParseNetwork(snet);
|
||||
if (net == NET_UNROUTABLE)
|
||||
return InitError(strprintf(_("Unknown network specified in -onlynet: '%s'"), snet));
|
||||
|
@ -994,13 +1021,13 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
bool fBound = false;
|
||||
if (fListen) {
|
||||
if (mapArgs.count("-bind") || mapArgs.count("-whitebind")) {
|
||||
BOOST_FOREACH(std::string strBind, mapMultiArgs["-bind"]) {
|
||||
BOOST_FOREACH(const std::string& strBind, mapMultiArgs["-bind"]) {
|
||||
CService addrBind;
|
||||
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false))
|
||||
return InitError(strprintf(_("Cannot resolve -bind address: '%s'"), strBind));
|
||||
fBound |= Bind(addrBind, (BF_EXPLICIT | BF_REPORT_ERROR));
|
||||
}
|
||||
BOOST_FOREACH(std::string strBind, mapMultiArgs["-whitebind"]) {
|
||||
BOOST_FOREACH(const std::string& strBind, mapMultiArgs["-whitebind"]) {
|
||||
CService addrBind;
|
||||
if (!Lookup(strBind.c_str(), addrBind, 0, false))
|
||||
return InitError(strprintf(_("Cannot resolve -whitebind address: '%s'"), strBind));
|
||||
|
@ -1020,7 +1047,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
}
|
||||
|
||||
if (mapArgs.count("-externalip")) {
|
||||
BOOST_FOREACH(string strAddr, mapMultiArgs["-externalip"]) {
|
||||
BOOST_FOREACH(const std::string& strAddr, mapMultiArgs["-externalip"]) {
|
||||
CService addrLocal(strAddr, GetListenPort(), fNameLookup);
|
||||
if (!addrLocal.IsValid())
|
||||
return InitError(strprintf(_("Cannot resolve -externalip address: '%s'"), strAddr));
|
||||
|
@ -1028,7 +1055,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_FOREACH(string strDest, mapMultiArgs["-seednode"])
|
||||
BOOST_FOREACH(const std::string& strDest, mapMultiArgs["-seednode"])
|
||||
AddOneShot(strDest);
|
||||
|
||||
// ********************************************************* Step 7: load block chain
|
||||
|
@ -1103,9 +1130,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
|
||||
if (fReindex) {
|
||||
pblocktree->WriteReindexing(true);
|
||||
//If we're reindexing in prune mode, wipe away all our block and undo data files
|
||||
//If we're reindexing in prune mode, wipe away unusable block files and all undo data files
|
||||
if (fPruneMode)
|
||||
DeleteAllBlockFiles();
|
||||
CleanupBlockRevFiles();
|
||||
}
|
||||
|
||||
if (!LoadBlockIndex()) {
|
||||
|
@ -1309,6 +1336,19 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
}
|
||||
if (chainActive.Tip() && chainActive.Tip() != pindexRescan)
|
||||
{
|
||||
//We can't rescan beyond non-pruned blocks, stop and throw an error
|
||||
//this might happen if a user uses a old wallet within a pruned node
|
||||
// or if he ran -disablewallet for a longer time, then decided to re-enable
|
||||
if (fPruneMode)
|
||||
{
|
||||
CBlockIndex *block = chainActive.Tip();
|
||||
while (block && block->pprev && (block->pprev->nStatus & BLOCK_HAVE_DATA) && block->pprev->nTx > 0 && pindexRescan != block)
|
||||
block = block->pprev;
|
||||
|
||||
if (pindexRescan != block)
|
||||
return InitError(_("Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of pruned node)"));
|
||||
}
|
||||
|
||||
uiInterface.InitMessage(_("Rescanning..."));
|
||||
LogPrintf("Rescanning last %i blocks (from block %i)...\n", chainActive.Height() - pindexRescan->nHeight, pindexRescan->nHeight);
|
||||
nStart = GetTimeMillis();
|
||||
|
@ -1361,7 +1401,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
std::vector<boost::filesystem::path> vImportFiles;
|
||||
if (mapArgs.count("-loadblock"))
|
||||
{
|
||||
BOOST_FOREACH(string strFile, mapMultiArgs["-loadblock"])
|
||||
BOOST_FOREACH(const std::string& strFile, mapMultiArgs["-loadblock"])
|
||||
vImportFiles.push_back(strFile);
|
||||
}
|
||||
threadGroup.create_thread(boost::bind(&ThreadImport, vImportFiles));
|
||||
|
@ -1392,6 +1432,12 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
|
||||
StartNode(threadGroup, scheduler);
|
||||
|
||||
// Monitor the chain, and alert if we get blocks much quicker or slower than expected
|
||||
int64_t nPowTargetSpacing = Params().GetConsensus().nPowTargetSpacing;
|
||||
CScheduler::Function f = boost::bind(&PartitionCheck, &IsInitialBlockDownload,
|
||||
boost::ref(cs_main), boost::cref(chainActive), nPowTargetSpacing);
|
||||
scheduler.scheduleEvery(f, nPowTargetSpacing);
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
// Generate coins in the background
|
||||
if (pwalletMain)
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
The MIT License
|
||||
|
||||
Copyright (c) 2007 - 2009 John W. Wilkinson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,18 +0,0 @@
|
|||
#ifndef JSON_SPIRIT
|
||||
#define JSON_SPIRIT
|
||||
|
||||
// Copyright John W. Wilkinson 2007 - 2009.
|
||||
// Distributed under the MIT License, see accompanying file LICENSE.txt
|
||||
|
||||
// json spirit version 4.03
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include "json_spirit_value.h"
|
||||
#include "json_spirit_reader.h"
|
||||
#include "json_spirit_writer.h"
|
||||
#include "json_spirit_utils.h"
|
||||
|
||||
#endif
|
|
@ -1,54 +0,0 @@
|
|||
#ifndef JSON_SPIRIT_ERROR_POSITION
|
||||
#define JSON_SPIRIT_ERROR_POSITION
|
||||
|
||||
// Copyright John W. Wilkinson 2007 - 2009.
|
||||
// Distributed under the MIT License, see accompanying file LICENSE.txt
|
||||
|
||||
// json spirit version 4.03
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace json_spirit
|
||||
{
|
||||
// An Error_position exception is thrown by the "read_or_throw" functions below on finding an error.
|
||||
// Note the "read_or_throw" functions are around 3 times slower than the standard functions "read"
|
||||
// functions that return a bool.
|
||||
//
|
||||
struct Error_position
|
||||
{
|
||||
Error_position();
|
||||
Error_position( unsigned int line, unsigned int column, const std::string& reason );
|
||||
bool operator==( const Error_position& lhs ) const;
|
||||
unsigned int line_;
|
||||
unsigned int column_;
|
||||
std::string reason_;
|
||||
};
|
||||
|
||||
inline Error_position::Error_position()
|
||||
: line_( 0 )
|
||||
, column_( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
inline Error_position::Error_position( unsigned int line, unsigned int column, const std::string& reason )
|
||||
: line_( line )
|
||||
, column_( column )
|
||||
, reason_( reason )
|
||||
{
|
||||
}
|
||||
|
||||
inline bool Error_position::operator==( const Error_position& lhs ) const
|
||||
{
|
||||
if( this == &lhs ) return true;
|
||||
|
||||
return ( reason_ == lhs.reason_ ) &&
|
||||
( line_ == lhs.line_ ) &&
|
||||
( column_ == lhs.column_ );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue