aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore18
-rw-r--r--Makefile.am6
-rw-r--r--configure.ac17
-rw-r--r--contrib/gitian-descriptors/deps-win32.yml9
-rw-r--r--contrib/gitian-descriptors/gitian.yml6
-rw-r--r--contrib/gitian-descriptors/protobuf-win32.yml4
-rw-r--r--contrib/gitian-descriptors/qt-win32.yml4
-rwxr-xr-xqa/pull-tester/build-tests.sh.in35
-rwxr-xr-xqa/pull-tester/pull-tester.py9
-rwxr-xr-xqa/pull-tester/run-bitcoind-for-test.sh.in7
-rw-r--r--src/Makefile.am4
-rw-r--r--src/addrman.h4
-rw-r--r--src/bignum.h6
-rw-r--r--src/bitcoind.cpp6
-rw-r--r--src/bitcoinrpc.cpp2
-rw-r--r--src/checkqueue.h1
-rw-r--r--src/core.cpp2
-rw-r--r--src/core.h3
-rw-r--r--src/init.cpp46
-rw-r--r--src/init.h7
-rw-r--r--src/key.h7
-rw-r--r--src/limitedmap.h1
-rw-r--r--src/main.cpp518
-rw-r--r--src/main.h107
-rw-r--r--src/miner.cpp4
-rw-r--r--src/net.cpp53
-rw-r--r--src/net.h10
-rw-r--r--src/qt/aboutdialog.cpp4
-rw-r--r--src/qt/aboutdialog.h4
-rw-r--r--src/qt/addressbookpage.cpp11
-rw-r--r--src/qt/addressbookpage.h7
-rw-r--r--src/qt/addresstablemodel.cpp4
-rw-r--r--src/qt/addresstablemodel.h7
-rw-r--r--src/qt/askpassphrasedialog.cpp4
-rw-r--r--src/qt/askpassphrasedialog.h6
-rw-r--r--src/qt/bitcoin.cpp10
-rw-r--r--src/qt/bitcoinaddressvalidator.cpp4
-rw-r--r--src/qt/bitcoinaddressvalidator.h4
-rw-r--r--src/qt/bitcoinamountfield.cpp4
-rw-r--r--src/qt/bitcoinamountfield.h4
-rw-r--r--src/qt/bitcoingui.cpp15
-rw-r--r--src/qt/bitcoingui.h9
-rw-r--r--src/qt/bitcoinstrings.cpp12
-rw-r--r--src/qt/bitcoinunits.cpp4
-rw-r--r--src/qt/bitcoinunits.h4
-rw-r--r--src/qt/clientmodel.cpp4
-rw-r--r--src/qt/clientmodel.h4
-rw-r--r--src/qt/csvmodelwriter.cpp4
-rw-r--r--src/qt/csvmodelwriter.h4
-rw-r--r--src/qt/editaddressdialog.cpp4
-rw-r--r--src/qt/editaddressdialog.h4
-rw-r--r--src/qt/forms/receivecoinsdialog.ui32
-rw-r--r--src/qt/forms/receiverequestdialog.ui3
-rw-r--r--src/qt/forms/rpcconsole.ui2
-rw-r--r--src/qt/forms/sendcoinsdialog.ui13
-rw-r--r--src/qt/forms/sendcoinsentry.ui514
-rw-r--r--src/qt/guiconstants.h4
-rw-r--r--src/qt/guiutil.cpp14
-rw-r--r--src/qt/guiutil.h4
-rw-r--r--src/qt/intro.cpp8
-rw-r--r--src/qt/intro.h4
-rw-r--r--src/qt/locale/bitcoin_en.ts777
-rw-r--r--src/qt/macdockiconhandler.h4
-rw-r--r--src/qt/macnotificationhandler.h4
-rw-r--r--src/qt/monitoreddatamapper.cpp4
-rw-r--r--src/qt/monitoreddatamapper.h4
-rw-r--r--src/qt/notificator.cpp4
-rw-r--r--src/qt/notificator.h4
-rw-r--r--src/qt/optionsdialog.cpp4
-rw-r--r--src/qt/optionsdialog.h4
-rw-r--r--src/qt/optionsmodel.cpp7
-rw-r--r--src/qt/optionsmodel.h4
-rw-r--r--src/qt/overviewpage.cpp4
-rw-r--r--src/qt/overviewpage.h4
-rw-r--r--src/qt/paymentrequestplus.cpp7
-rw-r--r--src/qt/paymentrequestplus.h4
-rw-r--r--src/qt/paymentserver.cpp106
-rw-r--r--src/qt/paymentserver.h6
-rw-r--r--src/qt/qvalidatedlineedit.cpp4
-rw-r--r--src/qt/qvalidatedlineedit.h4
-rw-r--r--src/qt/qvaluecombobox.cpp4
-rw-r--r--src/qt/qvaluecombobox.h4
-rw-r--r--src/qt/receivecoinsdialog.cpp4
-rw-r--r--src/qt/receivecoinsdialog.h4
-rw-r--r--src/qt/receiverequestdialog.cpp4
-rw-r--r--src/qt/receiverequestdialog.h4
-rw-r--r--src/qt/rpcconsole.cpp12
-rw-r--r--src/qt/rpcconsole.h7
-rw-r--r--src/qt/sendcoinsdialog.cpp123
-rw-r--r--src/qt/sendcoinsdialog.h14
-rw-r--r--src/qt/sendcoinsentry.cpp70
-rw-r--r--src/qt/sendcoinsentry.h4
-rw-r--r--src/qt/signverifymessagedialog.cpp4
-rw-r--r--src/qt/signverifymessagedialog.h4
-rw-r--r--src/qt/splashscreen.cpp4
-rw-r--r--src/qt/splashscreen.h4
-rw-r--r--src/qt/trafficgraphwidget.cpp4
-rw-r--r--src/qt/trafficgraphwidget.h4
-rw-r--r--src/qt/transactiondesc.cpp4
-rw-r--r--src/qt/transactiondesc.h4
-rw-r--r--src/qt/transactiondescdialog.cpp4
-rw-r--r--src/qt/transactiondescdialog.h4
-rw-r--r--src/qt/transactionfilterproxy.cpp4
-rw-r--r--src/qt/transactionfilterproxy.h4
-rw-r--r--src/qt/transactionrecord.cpp4
-rw-r--r--src/qt/transactionrecord.h4
-rw-r--r--src/qt/transactiontablemodel.cpp4
-rw-r--r--src/qt/transactiontablemodel.h4
-rw-r--r--src/qt/transactionview.cpp27
-rw-r--r--src/qt/transactionview.h7
-rw-r--r--src/qt/walletframe.cpp19
-rw-r--r--src/qt/walletframe.h16
-rw-r--r--src/qt/walletmodel.cpp8
-rw-r--r--src/qt/walletmodel.h15
-rw-r--r--src/qt/walletmodeltransaction.cpp4
-rw-r--r--src/qt/walletmodeltransaction.h4
-rw-r--r--src/qt/walletview.cpp104
-rw-r--r--src/qt/walletview.h22
-rw-r--r--src/rpcdump.cpp3
-rw-r--r--src/rpcmining.cpp8
-rw-r--r--src/rpcrawtransaction.cpp6
-rw-r--r--src/script.cpp12
-rw-r--r--src/serialize.h17
-rw-r--r--src/test/bignum_tests.cpp8
-rw-r--r--src/test/serialize_tests.cpp48
-rw-r--r--src/test/transaction_tests.cpp15
-rw-r--r--src/test/uint256_tests.cpp9
-rw-r--r--src/txdb.cpp6
-rw-r--r--src/txdb.h1
-rw-r--r--src/txmempool.cpp162
-rw-r--r--src/txmempool.h67
-rw-r--r--src/uint256.h15
-rw-r--r--src/util.cpp32
-rw-r--r--src/util.h1
-rw-r--r--src/wallet.cpp66
-rw-r--r--src/wallet.h13
136 files changed, 2407 insertions, 1220 deletions
diff --git a/.gitignore b/.gitignore
index da0437835b..f867868185 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,6 @@
*.tar.gz
*.exe
-src/*.exe
-src/*/*.exe
src/bitcoin
src/bitcoind
src/bitcoin-cli
@@ -15,33 +13,21 @@ autom4te.cache/
config.log
config.status
configure
-src/.deps/
-src/Makefile.in
src/bitcoin-config.h
src/bitcoin-config.h.in
src/build-aux/
-src/qt/Makefile.in
src/stamp-h1
share/setup.nsi
share/qt/Info.plist
-src/leveldb/.deps/
-
-src/test/.deps
-src/test/.dirstamp
-
-src/qt/.deps/
-src/qt/.dirstamp
src/qt/*.moc
src/qt/moc_*.cpp
src/qt/forms/ui_*.h
-src/qt/test/.deps/
-src/qt/test/.dirstamp
src/qt/test/moc*.cpp
-src/qt/res/.deps/
-src/qt/res/.dirstamp
+.deps
+.dirstamp
.*.swp
*.*~*
*.bak
diff --git a/Makefile.am b/Makefile.am
index dc0e6d8f76..243166b3f7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -118,7 +118,8 @@ test_bitcoin_filtered.info: test_bitcoin.info
$(LCOV) -r $< "/usr/include/*" -o $@
block_test.info: test_bitcoin_filtered.info
- -@TIMEOUT=15 qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -Xmx2G -jar $(JAVA_COMPARISON_TOOL) 1 18444
+ $(MKDIR_P) qa/tmp
+ -@TIMEOUT=15 qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -jar $(JAVA_COMPARISON_TOOL) qa/tmp/compTool 0
$(LCOV) -c -d $(abs_builddir)/src --t BitcoinJBlockTest -o $@
$(LCOV) -z -d $(abs_builddir)/src
$(LCOV) -z -d $(abs_builddir)/src/leveldb
@@ -146,7 +147,8 @@ endif
if USE_COMPARISON_TOOL
check-local:
- @qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -Xmx2G -jar $(JAVA_COMPARISON_TOOL) 1 18444
+ $(MKDIR_P) qa/tmp
+ @qa/pull-tester/run-bitcoind-for-test.sh $(JAVA) -jar $(JAVA_COMPARISON_TOOL) qa/tmp/compTool $(COMPARISON_TOOL_REORG_TESTS)
endif
EXTRA_DIST = $(top_srcdir)/share/genbuild.sh qa/pull-tester/pull-tester.sh $(WINDOWS_PACKAGING) $(OSX_PACKAGING)
diff --git a/configure.ac b/configure.ac
index 905acd573c..f6d870f332 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,10 +69,15 @@ AC_ARG_ENABLE(tests,
[use_tests=yes])
AC_ARG_WITH([comparison-tool],
- AS_HELP_STRING([with-comparison-tool],[path to java comparison tool (requires --enable-tests)]),
+ AS_HELP_STRING([--with-comparison-tool],[path to java comparison tool (requires --enable-tests)]),
[use_comparison_tool=$withval],
[use_comparison_tool=no])
+AC_ARG_ENABLE([comparison-tool-reorg-tests],
+ AS_HELP_STRING([--enable-comparison-tool-reorg-tests],[enable expensive reorg tests in the comparison tool (default no)]),
+ [use_comparison_tool_reorg_tests=$enableval],
+ [use_comparison_tool_reorg_tests=no])
+
AC_ARG_WITH([qrencode],
[AS_HELP_STRING([--with-qrencode],
[enable QR code support (default is yes if qt is enabled and libqrencode is found)])],
@@ -235,6 +240,15 @@ if test x$use_comparison_tool != xno; then
AC_SUBST(JAVA_COMPARISON_TOOL, $use_comparison_tool)
fi
+if test x$use_comparison_tool_reorg_tests != xno; then
+ if test x$use_comparison_tool == x; then
+ AC_MSG_ERROR("comparison tool reorg tests but comparison tool was not specified")
+ fi
+ AC_SUBST(COMPARISON_TOOL_REORG_TESTS, 1)
+else
+ AC_SUBST(COMPARISON_TOOL_REORG_TESTS, 0)
+fi
+
if test x$use_lcov == xyes; then
if test x$LCOV == x; then
AC_MSG_ERROR("lcov testing requested but lcov not found")
@@ -678,6 +692,7 @@ AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows])
AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes])
AM_CONDITIONAL([USE_LCOV],[test x$use_lcov == xyes])
AM_CONDITIONAL([USE_COMPARISON_TOOL],[test x$use_comparison_tool != xno])
+AM_CONDITIONAL([USE_COMPARISON_TOOL_REORG_TESTS],[test x$use_comparison_tool_reorg_test != xno])
AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version])
AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version])
diff --git a/contrib/gitian-descriptors/deps-win32.yml b/contrib/gitian-descriptors/deps-win32.yml
index 7ad00fcb01..3f4e4e27f2 100644
--- a/contrib/gitian-descriptors/deps-win32.yml
+++ b/contrib/gitian-descriptors/deps-win32.yml
@@ -27,7 +27,14 @@ script: |
export TZ=UTC
export INSTALLPREFIX=$OUTDIR/staging/deps
export HOST=i686-w64-mingw32
- #
+ # Input Integrity Check
+ echo "2a9eb3cd4e8b114eb9179c0d3884d61658e7d8e8bf4984798a5f5bd48e325ebe openssl-1.0.1c.tar.gz" | sha256sum -c
+ echo "b75dae26151f9b031062c8d2f577a094b08da0ae44fe8c11175d0b9ff434cc02 libpng-1.5.9.tar.gz" | sha256sum -c
+ echo "12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz" | sha256sum -c
+ echo "21235e08552e6feba09ea5e8d750805b3391c62fb81c71a235c0044dc7a8a61b zlib-1.2.6.tar.gz" | sha256sum -c
+ echo "b75dae26151f9b031062c8d2f577a094b08da0ae44fe8c11175d0b9ff434cc02 libpng-1.5.9.tar.gz" | sha256sum -c
+ echo "03c4bc7cd9a75747c3815d509bbe061907d615764f2357923f0db948c567068f qrencode-3.2.0.tar.bz2" | sha256sum -c
+
mkdir -p $INSTALLPREFIX
tar xzf openssl-1.0.1c.tar.gz
diff --git a/contrib/gitian-descriptors/gitian.yml b/contrib/gitian-descriptors/gitian.yml
index 18e4cc2803..e29033d29b 100644
--- a/contrib/gitian-descriptors/gitian.yml
+++ b/contrib/gitian-descriptors/gitian.yml
@@ -35,7 +35,11 @@ files:
script: |
STAGING="$HOME/install"
export LIBRARY_PATH="$STAGING/lib"
- #
+ # Integrity Check
+ echo "bbd6b756e6af44b5a5b0f9b93eada3fb8922ed1d6451b7d6f184d0ae0c813994 miniupnpc-1.6.tar.gz" | sha256sum -c
+ echo "03c4bc7cd9a75747c3815d509bbe061907d615764f2357923f0db948c567068f qrencode-3.2.0.tar.bz2" | sha256sum -c
+ echo "13bfc5ae543cf3aa180ac2485c0bc89495e3ae711fc6fab4f8ffe90dfb4bb677 protobuf-2.5.0.tar.bz2" | sha256sum -c
+
tar xzfm miniupnpc-1.6.tar.gz
cd miniupnpc-1.6
INSTALLPREFIX=$STAGING make $MAKEOPTS install
diff --git a/contrib/gitian-descriptors/protobuf-win32.yml b/contrib/gitian-descriptors/protobuf-win32.yml
index 35f261e1a2..b2e3d0b465 100644
--- a/contrib/gitian-descriptors/protobuf-win32.yml
+++ b/contrib/gitian-descriptors/protobuf-win32.yml
@@ -18,7 +18,9 @@ script: |
export TZ=UTC
export INSTALLPREFIX=$OUTDIR/staging/deps
export HOST=i686-w64-mingw32
- #
+ # Integrity Check
+ echo "13bfc5ae543cf3aa180ac2485c0bc89495e3ae711fc6fab4f8ffe90dfb4bb677 protobuf-2.5.0.tar.bz2" | sha256sum -c
+
#
mkdir -p $INSTALLPREFIX
diff --git a/contrib/gitian-descriptors/qt-win32.yml b/contrib/gitian-descriptors/qt-win32.yml
index 1fc6f861e0..ffa8bcab46 100644
--- a/contrib/gitian-descriptors/qt-win32.yml
+++ b/contrib/gitian-descriptors/qt-win32.yml
@@ -20,7 +20,9 @@ script: |
#
HOST=i686-w64-mingw32
INSTDIR="$HOME/qt/"
- #
+ # Integrity Check
+ echo "f1f72974f924861be04019f49f07cd43ab3c95056db2ba8f34b283487cccc728 qt-everywhere-opensource-src-4.8.3.tar.gz" | sha256sum -c
+
mkdir $INSTDIR
mkdir -p $INSTDIR/host/bin
#
diff --git a/qa/pull-tester/build-tests.sh.in b/qa/pull-tester/build-tests.sh.in
index 461e7be048..73f046a0f5 100755
--- a/qa/pull-tester/build-tests.sh.in
+++ b/qa/pull-tester/build-tests.sh.in
@@ -9,8 +9,9 @@ set -o xtrace
MINGWPREFIX=$1
JAVA_COMPARISON_TOOL=$2
-JOBS=${3-1}
-OUT_DIR=${4-}
+RUN_EXPENSIVE_TESTS=$3
+JOBS=${4-1}
+OUT_DIR=${5-}
if [ $# -lt 2 ]; then
echo "Usage: $0 [mingw-prefix] [java-comparison-tool] <make jobs> <save output dir>"
@@ -22,20 +23,30 @@ DISTDIR=@PACKAGE@-@VERSION@
# Cross-compile for windows first (breaking the mingw/windows build is most common)
cd @abs_top_srcdir@
make distdir
-mv $DISTDIR win32-build
+mkdir -p win32-build
+rsync -av $DISTDIR/ win32-build/
+rm -r $DISTDIR
cd win32-build
-./configure --disable-silent-rules --disable-ccache --prefix=$MINGWPREFIX --host=i586-mingw32msvc --with-qt-bindir=$MINGWPREFIX/host/bin --with-qt-plugindir=$MINGWPREFIX/plugins --with-qt-incdir=$MINGWPREFIX/include --with-boost=$MINGWPREFIX --with-protoc-bindir=$MINGWPREFIX/host/bin CPPFLAGS=-I$MINGWPREFIX/include LDFLAGS=-L$MINGWPREFIX/lib
+
+if [ $RUN_EXPENSIVE_TESTS = 1 ]; then
+ ./configure --disable-silent-rules --disable-ccache --prefix=$MINGWPREFIX --host=i586-mingw32msvc --with-qt-bindir=$MINGWPREFIX/host/bin --with-qt-plugindir=$MINGWPREFIX/plugins --with-qt-incdir=$MINGWPREFIX/include --with-boost=$MINGWPREFIX --with-protoc-bindir=$MINGWPREFIX/host/bin CPPFLAGS=-I$MINGWPREFIX/include LDFLAGS=-L$MINGWPREFIX/lib --with-comparison-tool="$JAVA_COMPARISON_TOOL" --enable-comparison-tool-reorg-tests
+else
+ ./configure --disable-silent-rules --disable-ccache --prefix=$MINGWPREFIX --host=i586-mingw32msvc --with-qt-bindir=$MINGWPREFIX/host/bin --with-qt-plugindir=$MINGWPREFIX/plugins --with-qt-incdir=$MINGWPREFIX/include --with-boost=$MINGWPREFIX --with-protoc-bindir=$MINGWPREFIX/host/bin CPPFLAGS=-I$MINGWPREFIX/include LDFLAGS=-L$MINGWPREFIX/lib
+fi
make -j$JOBS
# And compile for Linux:
cd @abs_top_srcdir@
make distdir
-mv $DISTDIR linux-build
+mkdir -p linux-build
+rsync -av $DISTDIR/ linux-build/
+rm -r $DISTDIR
cd linux-build
-# TODO: re-enable blockchain tester tool, as of 11 Oct 2013 is it not working properly
-# on the pull-tester machine.
-#./configure --disable-silent-rules --disable-ccache --with-comparison-tool="$JAVA_COMPARISON_TOOL"
-./configure --disable-silent-rules --disable-ccache
+if [ $RUN_EXPENSIVE_TESTS = 1 ]; then
+ ./configure --disable-silent-rules --disable-ccache --with-comparison-tool="$JAVA_COMPARISON_TOOL" --enable-comparison-tool-reorg-tests
+else
+ ./configure --disable-silent-rules --disable-ccache --with-comparison-tool="$JAVA_COMPARISON_TOOL"
+fi
make -j$JOBS
# link interesting binaries to parent out/ directory, if it exists. Do this before
@@ -57,6 +68,12 @@ fi
cd @abs_top_srcdir@/linux-build
make check
+if [ $RUN_EXPENSIVE_TESTS = 1 ]; then
+ # Run unit tests and blockchain-tester on Windows:
+ cd @abs_top_srcdir@/win32-build
+ make check
+fi
+
# Clean up builds (pull-tester machine doesn't have infinite disk space)
cd @abs_top_srcdir@/linux-build
make clean
diff --git a/qa/pull-tester/pull-tester.py b/qa/pull-tester/pull-tester.py
index 34dd74c7e0..6a7c45ccd1 100755
--- a/qa/pull-tester/pull-tester.py
+++ b/qa/pull-tester/pull-tester.py
@@ -67,7 +67,12 @@ Contact BlueMatt on freenode if something looks broken."""
auth=(os.environ['GITHUB_USER'], os.environ["GITHUB_AUTH_TOKEN"]))
if success == True:
- post_data = { "body" : "Automatic sanity-testing: PASSED, see " + linkUrl + " for binaries and test log." + common_message}
+ if needTests:
+ message = "Automatic sanity-testing: PLEASE ADD TEST-CASES, though technically passed. See " + linkUrl + " for binaries and test log."
+ else:
+ message = "Automatic sanity-testing: PASSED, see " + linkUrl + " for binaries and test log."
+
+ post_data = { "body" : message + common_message}
elif inMerge:
post_data = { "body" : "Automatic sanity-testing: FAILED MERGE, see " + linkUrl + " for test log." + """
@@ -113,7 +118,7 @@ def testpull(number, comment_url, clone_url, commit):
run("chown -R ${BUILD_USER}:${BUILD_GROUP} ${CHROOT_COPY}/${OUT_DIR}", fail_hard=False)
script = os.environ["BUILD_PATH"]+"/qa/pull-tester/pull-tester.sh"
- script += " ${BUILD_PATH} ${MINGW_DEPS_DIR} ${SCRIPTS_DIR}/BitcoindComparisonTool.jar 6 ${OUT_DIR}"
+ script += " ${BUILD_PATH} ${MINGW_DEPS_DIR} ${SCRIPTS_DIR}/BitcoindComparisonTool_jar/BitcoindComparisonTool.jar 0 6 ${OUT_DIR}"
returncode = run("chroot ${CHROOT_COPY} sudo -u ${BUILD_USER} -H timeout ${TEST_TIMEOUT} "+script,
fail_hard=False, stdout=out, stderr=out)
diff --git a/qa/pull-tester/run-bitcoind-for-test.sh.in b/qa/pull-tester/run-bitcoind-for-test.sh.in
index e02fef3b56..25faf9c42d 100755
--- a/qa/pull-tester/run-bitcoind-for-test.sh.in
+++ b/qa/pull-tester/run-bitcoind-for-test.sh.in
@@ -5,7 +5,8 @@ mkdir -p "$DATADIR"/regtest
touch "$DATADIR/regtest/debug.log"
tail -q -n 1 -F "$DATADIR/regtest/debug.log" | grep -m 1 -q "Done loading" &
WAITER=$!
-"@abs_top_builddir@/src/bitcoind@EXEEXT@" -connect=0.0.0.0 -datadir="$DATADIR" -rpcuser=user -rpcpassword=pass -listen -keypool=3 -debug -logtimestamps -port=18444 -regtest &
+PORT=`expr $BASHPID + 10000`
+"@abs_top_builddir@/src/bitcoind@EXEEXT@" -connect=0.0.0.0 -datadir="$DATADIR" -rpcuser=user -rpcpassword=pass -listen -keypool=3 -debug -debug=net -logtimestamps -port=$PORT -regtest -rpcport=`expr $PORT + 1` &
BITCOIND=$!
#Install a watchdog.
@@ -13,10 +14,10 @@ BITCOIND=$!
wait $WAITER
if [ -n "$TIMEOUT" ]; then
- timeout "$TIMEOUT"s "$@"
+ timeout "$TIMEOUT"s "$@" $PORT
RETURN=$?
else
- "$@"
+ "$@" $PORT
RETURN=$?
fi
diff --git a/src/Makefile.am b/src/Makefile.am
index 14d1dd03a6..508063d5e2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -17,7 +17,7 @@ BITCOIN_CORE_H = addrman.h alert.h allocators.h base58.h bignum.h \
clientversion.h compat.h core.h crypter.h db.h hash.h init.h \
key.h keystore.h leveldb.h limitedmap.h main.h miner.h mruset.h \
netbase.h net.h protocol.h script.h serialize.h sync.h threadsafety.h \
- txdb.h ui_interface.h uint256.h util.h version.h walletdb.h wallet.h
+ txdb.h txmempool.h ui_interface.h uint256.h util.h version.h walletdb.h wallet.h
JSON_H = json/json_spirit.h json/json_spirit_error_position.h \
json/json_spirit_reader.h json/json_spirit_reader_template.h \
@@ -36,7 +36,7 @@ libbitcoin_a_SOURCES = addrman.cpp alert.cpp allocators.cpp bitcoinrpc.cpp bloom
init.cpp key.cpp keystore.cpp leveldb.cpp main.cpp miner.cpp \
netbase.cpp net.cpp noui.cpp protocol.cpp rpcblockchain.cpp rpcdump.cpp \
rpcmining.cpp rpcnet.cpp rpcrawtransaction.cpp rpcwallet.cpp script.cpp \
- sync.cpp txdb.cpp util.cpp version.cpp wallet.cpp walletdb.cpp $(JSON_H) \
+ sync.cpp txdb.cpp txmempool.cpp util.cpp version.cpp wallet.cpp walletdb.cpp $(JSON_H) \
$(BITCOIN_CORE_H)
nodist_libbitcoin_a_SOURCES = $(top_srcdir)/src/obj/build.h
diff --git a/src/addrman.h b/src/addrman.h
index 081543ace4..d703e1091e 100644
--- a/src/addrman.h
+++ b/src/addrman.h
@@ -419,7 +419,7 @@ public:
Check();
}
if (fRet)
- LogPrint("addr", "Added %s from %s: %i tried, %i new\n", addr.ToStringIPPort().c_str(), source.ToString().c_str(), nTried, nNew);
+ LogPrint("addrman", "Added %s from %s: %i tried, %i new\n", addr.ToStringIPPort().c_str(), source.ToString().c_str(), nTried, nNew);
return fRet;
}
@@ -435,7 +435,7 @@ public:
Check();
}
if (nAdd)
- LogPrint("addr", "Added %i addresses from %s: %i tried, %i new\n", nAdd, source.ToString().c_str(), nTried, nNew);
+ LogPrint("addrman", "Added %i addresses from %s: %i tried, %i new\n", nAdd, source.ToString().c_str(), nTried, nNew);
return nAdd > 0;
}
diff --git a/src/bignum.h b/src/bignum.h
index 582e6f1517..e9d9007d3d 100644
--- a/src/bignum.h
+++ b/src/bignum.h
@@ -347,13 +347,13 @@ public:
psz++;
// hex string to bignum
- static const signed char phexdigit[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0 };
*this = 0;
- while (isxdigit(*psz))
+ int n;
+ while ((n = HexDigit(*psz)) != -1)
{
*this <<= 4;
- int n = phexdigit[(unsigned char)*psz++];
*this += n;
+ ++psz;
}
if (fNegative)
*this = 0 - *this;
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
index fbacbd2e24..e0cf1a706a 100644
--- a/src/bitcoind.cpp
+++ b/src/bitcoind.cpp
@@ -3,7 +3,10 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include "ui_interface.h"
#include "init.h"
+#include "util.h"
+#include "main.h"
#include "bitcoinrpc.h"
#include <boost/algorithm/string/predicate.hpp>
@@ -105,7 +108,7 @@ bool AppInit(int argc, char* argv[])
#endif
detectShutdownThread = new boost::thread(boost::bind(&DetectShutdownThread, &threadGroup));
- fRet = AppInit2(threadGroup);
+ fRet = AppInit2(threadGroup, true);
}
catch (std::exception& e) {
PrintExceptionContinue(&e, "AppInit()");
@@ -139,7 +142,6 @@ extern void noui_connect();
int main(int argc, char* argv[])
{
bool fRet = false;
- fHaveGUI = false;
// Connect bitcoind signal handlers
noui_connect();
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp
index f2a52e92ed..f3ea0adb40 100644
--- a/src/bitcoinrpc.cpp
+++ b/src/bitcoinrpc.cpp
@@ -4,6 +4,8 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "chainparams.h"
+#include "main.h"
+#include "wallet.h"
#include "init.h"
#include "util.h"
#include "sync.h"
diff --git a/src/checkqueue.h b/src/checkqueue.h
index eba424fbaa..6e2f609fcf 100644
--- a/src/checkqueue.h
+++ b/src/checkqueue.h
@@ -4,6 +4,7 @@
#ifndef CHECKQUEUE_H
#define CHECKQUEUE_H
+#include <boost/foreach.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/locks.hpp>
#include <boost/thread/condition_variable.hpp>
diff --git a/src/core.cpp b/src/core.cpp
index 99b5c6641a..5512f81b61 100644
--- a/src/core.cpp
+++ b/src/core.cpp
@@ -63,8 +63,6 @@ uint256 CTxOut::GetHash() const
std::string CTxOut::ToString() const
{
- if (scriptPubKey.size() < 6)
- return "CTxOut(error)";
return strprintf("CTxOut(nValue=%"PRI64d".%08"PRI64d", scriptPubKey=%s)", nValue / COIN, nValue % COIN, scriptPubKey.ToString().substr(0,30).c_str());
}
diff --git a/src/core.h b/src/core.h
index 9ee8b2edce..70e62716f3 100644
--- a/src/core.h
+++ b/src/core.h
@@ -421,6 +421,9 @@ public:
// equality test
friend bool operator==(const CCoins &a, const CCoins &b) {
+ // Empty CCoins objects are always equal.
+ if (a.IsPruned() && b.IsPruned())
+ return true;
return a.fCoinBase == b.fCoinBase &&
a.nHeight == b.nHeight &&
a.nVersion == b.nVersion &&
diff --git a/src/init.cpp b/src/init.cpp
index 72b53ebecc..80ba65f807 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -106,7 +106,7 @@ void Shutdown()
if (!lockShutdown) return;
RenameThread("bitcoin-shutoff");
- nTransactionsUpdated++;
+ mempool.AddTransactionsUpdated(1);
StopRPCThreads();
ShutdownRPCMining();
if (pwalletMain)
@@ -215,9 +215,19 @@ std::string HelpMessage(HelpMessageMode hmm)
#endif
#endif
strUsage += " -paytxfee=<amt> " + _("Fee per KB to add to transactions you send") + "\n";
- strUsage += " -debug " + _("Output extra debugging information. Implies all other -debug* options") + "\n";
- strUsage += " -debugnet " + _("Output extra network debugging information") + "\n";
- strUsage += " -logtimestamps " + _("Prepend debug output with timestamp") + "\n";
+ strUsage += " -debug=<category> " + _("Output debugging information (default: 0, supplying <category> is optional)") + "\n";
+ strUsage += _("If <category> is not supplied, output all debugging information.") + "\n";
+ strUsage += _("<category> can be:");
+ strUsage += " addrman, alert, coindb, db, lock, rand, rpc, selectcoins, mempool, net"; // Don't translate these and qt below
+ if (hmm == HMM_BITCOIN_QT)
+ {
+ strUsage += ", qt.\n";
+ }
+ else
+ {
+ strUsage += ".\n";
+ }
+ strUsage += " -logtimestamps " + _("Prepend debug output with timestamp (default: 1)") + "\n";
strUsage += " -shrinkdebugfile " + _("Shrink debug.log file on client startup (default: 1 when no -debug)") + "\n";
strUsage += " -printtoconsole " + _("Send trace/debug info to console instead of debug.log file") + "\n";
strUsage += " -regtest " + _("Enter regression test mode, which uses a special chain in which blocks can be "
@@ -353,7 +363,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
/** Initialize bitcoin.
* @pre Parameters should be parsed and config file should be read.
*/
-bool AppInit2(boost::thread_group& threadGroup)
+bool AppInit2(boost::thread_group& threadGroup, bool fForceServer)
{
// ********************************************************* Step 1: setup
#ifdef _MSC_VER
@@ -457,9 +467,18 @@ bool AppInit2(boost::thread_group& threadGroup)
// ********************************************************* Step 3: parameter-to-internal-flags
- if (mapMultiArgs.count("-debug")) fDebug = true;
+ fDebug = !mapMultiArgs["-debug"].empty();
+ // Special-case: if -debug=0/-nodebug is set, turn off debugging messages
+ const vector<string>& categories = mapMultiArgs["-debug"];
+ if (GetBoolArg("-nodebug", false) || find(categories.begin(), categories.end(), string("0")) != categories.end())
+ fDebug = false;
+
+ // Check for -debugnet (deprecated)
+ if (GetBoolArg("-debugnet", false))
+ InitWarning(_("Warning: Deprecated argument -debugnet ignored, use -debug=net"));
+
fBenchmark = GetBoolArg("-benchmark", false);
- mempool.fChecks = GetBoolArg("-checkmempool", RegTest());
+ mempool.setSanityCheck(GetBoolArg("-checkmempool", RegTest()));
Checkpoints::fEnabled = GetBoolArg("-checkpoints", true);
// -par=0 means autodetect, but nScriptCheckThreads==0 means no concurrency
@@ -471,23 +490,14 @@ bool AppInit2(boost::thread_group& threadGroup)
else if (nScriptCheckThreads > MAX_SCRIPTCHECK_THREADS)
nScriptCheckThreads = MAX_SCRIPTCHECK_THREADS;
- // -debug implies fDebug*
- if (fDebug)
- fDebugNet = true;
- else
- fDebugNet = GetBoolArg("-debugnet", false);
-
- if (fDaemon)
+ if (fDaemon || fForceServer)
fServer = true;
else
fServer = GetBoolArg("-server", false);
- /* force fServer when running without GUI */
- if (!fHaveGUI)
- fServer = true;
fPrintToConsole = GetBoolArg("-printtoconsole", false);
fPrintToDebugger = GetBoolArg("-printtodebugger", false);
- fLogTimestamps = GetBoolArg("-logtimestamps", false);
+ fLogTimestamps = GetBoolArg("-logtimestamps", true);
if (mapArgs.count("-timeout"))
{
diff --git a/src/init.h b/src/init.h
index 785a6cdba1..c33da94259 100644
--- a/src/init.h
+++ b/src/init.h
@@ -5,7 +5,10 @@
#ifndef BITCOIN_INIT_H
#define BITCOIN_INIT_H
-#include "wallet.h"
+#include <string>
+#include <boost/thread.hpp>
+
+class CWallet;
extern std::string strWalletFile;
extern CWallet* pwalletMain;
@@ -13,7 +16,7 @@ extern CWallet* pwalletMain;
void StartShutdown();
bool ShutdownRequested();
void Shutdown();
-bool AppInit2(boost::thread_group& threadGroup);
+bool AppInit2(boost::thread_group& threadGroup, bool fForceServer);
/* The help message mode determines what help message to show */
enum HelpMessageMode
diff --git a/src/key.h b/src/key.h
index ac050356f2..bbe64d6685 100644
--- a/src/key.h
+++ b/src/key.h
@@ -205,7 +205,8 @@ public:
}
friend bool operator==(const CKey &a, const CKey &b) {
- return a.fCompressed == b.fCompressed && memcmp(&a.vch[0], &b.vch[0], 32);
+ return a.fCompressed == b.fCompressed && a.size() == b.size() &&
+ memcmp(&a.vch[0], &b.vch[0], a.size()) == 0;
}
// Initialize using begin and end iterators to byte data.
@@ -261,9 +262,9 @@ public:
// Derive BIP32 child key.
bool Derive(CKey& keyChild, unsigned char ccChild[32], unsigned int nChild, const unsigned char cc[32]) const;
-
+
// Load private key and check that public key matches.
- bool Load(CPrivKey &privkey, CPubKey &vchPubKey, bool fSkipCheck);
+ bool Load(CPrivKey &privkey, CPubKey &vchPubKey, bool fSkipCheck);
};
struct CExtPubKey {
diff --git a/src/limitedmap.h b/src/limitedmap.h
index 7049d68e5a..01d1b07df4 100644
--- a/src/limitedmap.h
+++ b/src/limitedmap.h
@@ -4,6 +4,7 @@
#ifndef BITCOIN_LIMITEDMAP_H
#define BITCOIN_LIMITEDMAP_H
+#include <assert.h> // TODO: remove
#include <map>
#include <deque>
diff --git a/src/main.cpp b/src/main.cpp
index 0c775b6779..145ff7857e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3,18 +3,20 @@
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include <boost/algorithm/string/replace.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
+
#include "alert.h"
+#include "chainparams.h"
#include "checkpoints.h"
+#include "checkqueue.h"
#include "db.h"
-#include "txdb.h"
-#include "net.h"
#include "init.h"
+#include "net.h"
+#include "txdb.h"
+#include "txmempool.h"
#include "ui_interface.h"
-#include "checkqueue.h"
-#include "chainparams.h"
-#include <boost/algorithm/string/replace.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/filesystem/fstream.hpp>
using namespace std;
using namespace boost;
@@ -29,12 +31,9 @@ set<CWallet*> setpwalletRegistered;
CCriticalSection cs_main;
CTxMemPool mempool;
-unsigned int nTransactionsUpdated = 0;
map<uint256, CBlockIndex*> mapBlockIndex;
CChain chainActive;
-uint256 nBestInvalidWork = 0;
-set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexValid; // may contain all CBlockIndex*'s that have validness >=BLOCK_VALID_TRANSACTIONS, and must contain those who aren't failed
int64 nTimeBestReceived = 0;
int nScriptCheckThreads = 0;
bool fImporting = false;
@@ -42,14 +41,13 @@ bool fReindex = false;
bool fBenchmark = false;
bool fTxIndex = false;
unsigned int nCoinCacheSize = 5000;
-bool fHaveGUI = false;
/** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */
int64 CTransaction::nMinTxFee = 10000; // Override with -mintxfee
/** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */
int64 CTransaction::nMinRelayTxFee = 10000;
-CMedianFilter<int> cPeerBlockCounts(8, 0); // Amount of blocks that other nodes claim to have
+static CMedianFilter<int> cPeerBlockCounts(8, 0); // Amount of blocks that other nodes claim to have
map<uint256, CBlock*> mapOrphanBlocks;
multimap<uint256, CBlock*> mapOrphanBlocksByPrev;
@@ -65,102 +63,82 @@ const string strMessageMagic = "Bitcoin Signed Message:\n";
// Settings
int64 nTransactionFee = 0;
-
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// dispatching functions
-//
-
-// These functions dispatch to one or all registered wallets
-
-
-void RegisterWallet(CWallet* pwalletIn)
+// Internal stuff
+namespace {
+struct CBlockIndexWorkComparator
{
- {
- LOCK(cs_setpwalletRegistered);
- setpwalletRegistered.insert(pwalletIn);
- }
-}
+ bool operator()(CBlockIndex *pa, CBlockIndex *pb) {
+ if (pa->nChainWork > pb->nChainWork) return false;
+ if (pa->nChainWork < pb->nChainWork) return true;
-void UnregisterWallet(CWallet* pwalletIn)
-{
- {
- LOCK(cs_setpwalletRegistered);
- setpwalletRegistered.erase(pwalletIn);
+ if (pa->GetBlockHash() < pb->GetBlockHash()) return false;
+ if (pa->GetBlockHash() > pb->GetBlockHash()) return true;
+
+ return false; // identical blocks
}
-}
+};
-void UnregisterAllWallets()
-{
- LOCK(cs_setpwalletRegistered);
- setpwalletRegistered.clear();
-}
+CBlockIndex *pindexBestInvalid;
+set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexValid; // may contain all CBlockIndex*'s that have validness >=BLOCK_VALID_TRANSACTIONS, and must contain those who aren't failed
-// get the wallet transaction with the given hash (if it exists)
-bool static GetTransaction(const uint256& hashTx, CWalletTx& wtx)
-{
- LOCK(cs_setpwalletRegistered);
- BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
- if (pwallet->GetTransaction(hashTx,wtx))
- return true;
- return false;
+CCriticalSection cs_LastBlockFile;
+CBlockFileInfo infoLastBlockFile;
+int nLastBlockFile = 0;
}
-// erases transaction with the given hash from all wallets
-void static EraseFromWallets(uint256 hash)
-{
- LOCK(cs_setpwalletRegistered);
- BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
- pwallet->EraseFromWallet(hash);
-}
+//////////////////////////////////////////////////////////////////////////////
+//
+// dispatching functions
+//
-// make sure all wallets know about the given transaction, in the given block
-void SyncWithWallets(const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate)
-{
- LOCK(cs_setpwalletRegistered);
- BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
- pwallet->AddToWalletIfInvolvingMe(hash, tx, pblock, fUpdate);
-}
+// These functions dispatch to one or all registered wallets
-// notify wallets about a new best chain
-void static SetBestChain(const CBlockLocator& loc)
-{
- LOCK(cs_setpwalletRegistered);
- BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
- pwallet->SetBestChain(loc);
+namespace {
+struct CMainSignals {
+ // Notifies listeners of updated transaction data (passing hash, transaction, and optionally the block it is found in.
+ boost::signals2::signal<void (const uint256 &, const CTransaction &, const CBlock *)> SyncTransaction;
+ // Notifies listeners of an erased transaction (currently disabled, requires transaction replacement).
+ boost::signals2::signal<void (const uint256 &)> EraseTransaction;
+ // Notifies listeners of an updated transaction without new data (for now: a coinbase potentially becoming visible).
+ boost::signals2::signal<void (const uint256 &)> UpdatedTransaction;
+ // Notifies listeners of a new active block chain.
+ boost::signals2::signal<void (const CBlockLocator &)> SetBestChain;
+ // Notifies listeners about an inventory item being seen on the network.
+ boost::signals2::signal<void (const uint256 &)> Inventory;
+ // Tells listeners to broadcast their data.
+ boost::signals2::signal<void ()> Broadcast;
+} g_signals;
}
-// notify wallets about an updated transaction
-void static UpdatedTransaction(const uint256& hashTx)
-{
- LOCK(cs_setpwalletRegistered);
- BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
- pwallet->UpdatedTransaction(hashTx);
+void RegisterWallet(CWalletInterface* pwalletIn) {
+ g_signals.SyncTransaction.connect(boost::bind(&CWalletInterface::SyncTransaction, pwalletIn, _1, _2, _3));
+ g_signals.EraseTransaction.connect(boost::bind(&CWalletInterface::EraseFromWallet, pwalletIn, _1));
+ g_signals.UpdatedTransaction.connect(boost::bind(&CWalletInterface::UpdatedTransaction, pwalletIn, _1));
+ g_signals.SetBestChain.connect(boost::bind(&CWalletInterface::SetBestChain, pwalletIn, _1));
+ g_signals.Inventory.connect(boost::bind(&CWalletInterface::Inventory, pwalletIn, _1));
+ g_signals.Broadcast.connect(boost::bind(&CWalletInterface::ResendWalletTransactions, pwalletIn));
}
-// dump all wallets
-void static PrintWallets(const CBlock& block)
-{
- LOCK(cs_setpwalletRegistered);
- BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
- pwallet->PrintWallet(block);
+void UnregisterWallet(CWalletInterface* pwalletIn) {
+ g_signals.Broadcast.disconnect(boost::bind(&CWalletInterface::ResendWalletTransactions, pwalletIn));
+ g_signals.Inventory.disconnect(boost::bind(&CWalletInterface::Inventory, pwalletIn, _1));
+ g_signals.SetBestChain.disconnect(boost::bind(&CWalletInterface::SetBestChain, pwalletIn, _1));
+ g_signals.UpdatedTransaction.disconnect(boost::bind(&CWalletInterface::UpdatedTransaction, pwalletIn, _1));
+ g_signals.EraseTransaction.disconnect(boost::bind(&CWalletInterface::EraseFromWallet, pwalletIn, _1));
+ g_signals.SyncTransaction.disconnect(boost::bind(&CWalletInterface::SyncTransaction, pwalletIn, _1, _2, _3));
}
-// notify wallets about an incoming inventory (for request counts)
-void static Inventory(const uint256& hash)
-{
- LOCK(cs_setpwalletRegistered);
- BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
- pwallet->Inventory(hash);
+void UnregisterAllWallets() {
+ g_signals.Broadcast.disconnect_all_slots();
+ g_signals.Inventory.disconnect_all_slots();
+ g_signals.SetBestChain.disconnect_all_slots();
+ g_signals.UpdatedTransaction.disconnect_all_slots();
+ g_signals.EraseTransaction.disconnect_all_slots();
+ g_signals.SyncTransaction.disconnect_all_slots();
}
-// ask wallets to resend their transactions
-void static ResendWalletTransactions()
-{
- LOCK(cs_setpwalletRegistered);
- BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
- pwallet->ResendWalletTransactions();
+void SyncWithWallets(const uint256 &hash, const CTransaction &tx, const CBlock *pblock) {
+ g_signals.SyncTransaction(hash, tx, pblock);
}
//////////////////////////////////////////////////////////////////////////////
@@ -341,6 +319,15 @@ unsigned int CCoinsViewCache::GetCacheSize() {
return cacheCoins.size();
}
+/** Helper; lookup from tip (used calling mempool.check()
+ NOTE: code calling this MUST hold the cs_main lock so
+ another thread doesn't modify pcoinsTip. When we switch
+ to C++11 this should be replaced by lambda expressions...
+ **/
+static CCoins &LookupFromTip(const uint256& hash) {
+ return pcoinsTip->GetCoins(hash);
+}
+
/** CCoinsView that brings transactions from a memorypool into view.
It does not check for spendings by memory pool transactions. */
CCoinsViewMemPool::CCoinsViewMemPool(CCoinsView &baseIn, CTxMemPool &mempoolIn) : CCoinsViewBacked(baseIn), mempool(mempoolIn) { }
@@ -348,8 +335,8 @@ CCoinsViewMemPool::CCoinsViewMemPool(CCoinsView &baseIn, CTxMemPool &mempoolIn)
bool CCoinsViewMemPool::GetCoins(const uint256 &txid, CCoins &coins) {
if (base->GetCoins(txid, coins))
return true;
- if (mempool.exists(txid)) {
- const CTransaction &tx = mempool.lookup(txid);
+ CTransaction tx;
+ if (mempool.lookup(txid, tx)) {
coins = CCoins(tx, MEMPOOL_HEIGHT);
return true;
}
@@ -756,56 +743,39 @@ int64 GetMinFee(const CTransaction& tx, bool fAllowFree, enum GetMinFee_mode mod
return nMinFee;
}
-void CTxMemPool::pruneSpent(const uint256 &hashTx, CCoins &coins)
-{
- LOCK(cs);
- std::map<COutPoint, CInPoint>::iterator it = mapNextTx.lower_bound(COutPoint(hashTx, 0));
-
- // iterate over all COutPoints in mapNextTx whose hash equals the provided hashTx
- while (it != mapNextTx.end() && it->first.hash == hashTx) {
- coins.Spend(it->first.n); // and remove those outputs from coins
- it++;
- }
-}
-
-bool CTxMemPool::accept(CValidationState &state, const CTransaction &tx, bool fLimitFree,
+bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,
bool* pfMissingInputs, bool fRejectInsaneFee)
{
if (pfMissingInputs)
*pfMissingInputs = false;
if (!CheckTransaction(tx, state))
- return error("CTxMemPool::accept() : CheckTransaction failed");
+ return error("AcceptToMemoryPool: : CheckTransaction failed");
// Coinbase is only valid in a block, not as a loose transaction
if (tx.IsCoinBase())
- return state.DoS(100, error("CTxMemPool::accept() : coinbase as individual tx"));
-
- // To help v0.1.5 clients who would see it as a negative number
- if ((int64)tx.nLockTime > std::numeric_limits<int>::max())
- return error("CTxMemPool::accept() : not accepting nLockTime beyond 2038 yet");
+ return state.DoS(100, error("AcceptToMemoryPool: : coinbase as individual tx"));
// Rather not work on nonstandard transactions (unless -testnet/-regtest)
string reason;
if (Params().NetworkID() == CChainParams::MAIN && !IsStandardTx(tx, reason))
- return error("CTxMemPool::accept() : nonstandard transaction: %s",
+ return error("AcceptToMemoryPool: : nonstandard transaction: %s",
reason.c_str());
// is it already in the memory pool?
uint256 hash = tx.GetHash();
- {
- LOCK(cs);
- if (mapTx.count(hash))
- return false;
- }
+ if (pool.exists(hash))
+ return false;
// Check for conflicts with in-memory transactions
CTransaction* ptxOld = NULL;
+ {
+ LOCK(pool.cs); // protect pool.mapNextTx
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
COutPoint outpoint = tx.vin[i].prevout;
- if (mapNextTx.count(outpoint))
+ if (pool.mapNextTx.count(outpoint))
{
// Disable replacement feature for now
return false;
@@ -813,7 +783,7 @@ bool CTxMemPool::accept(CValidationState &state, const CTransaction &tx, bool fL
// Allow replacing with a newer version of the same transaction
if (i != 0)
return false;
- ptxOld = mapNextTx[outpoint].ptx;
+ ptxOld = pool.mapNextTx[outpoint].ptx;
if (IsFinalTx(*ptxOld))
return false;
if (!tx.IsNewerThan(*ptxOld))
@@ -821,20 +791,21 @@ bool CTxMemPool::accept(CValidationState &state, const CTransaction &tx, bool fL
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
COutPoint outpoint = tx.vin[i].prevout;
- if (!mapNextTx.count(outpoint) || mapNextTx[outpoint].ptx != ptxOld)
+ if (!pool.mapNextTx.count(outpoint) || pool.mapNextTx[outpoint].ptx != ptxOld)
return false;
}
break;
}
}
+ }
{
CCoinsView dummy;
CCoinsViewCache view(dummy);
{
- LOCK(cs);
- CCoinsViewMemPool viewMemPool(*pcoinsTip, *this);
+ LOCK(pool.cs);
+ CCoinsViewMemPool viewMemPool(*pcoinsTip, pool);
view.SetBackend(viewMemPool);
// do we already have it?
@@ -854,7 +825,7 @@ bool CTxMemPool::accept(CValidationState &state, const CTransaction &tx, bool fL
// are the actual inputs available?
if (!view.HaveInputs(tx))
- return state.Invalid(error("CTxMemPool::accept() : inputs already spent"));
+ return state.Invalid(error("AcceptToMemoryPool: : inputs already spent"));
// Bring the best block into scope
view.GetBestBlock();
@@ -865,7 +836,7 @@ bool CTxMemPool::accept(CValidationState &state, const CTransaction &tx, bool fL
// Check for non-standard pay-to-script-hash in inputs
if (Params().NetworkID() == CChainParams::MAIN && !AreInputsStandard(tx, view))
- return error("CTxMemPool::accept() : nonstandard transaction input");
+ return error("AcceptToMemoryPool: : nonstandard transaction input");
// Note: if you modify this code to accept non-standard transactions, then
// you should add code here to check that the transaction does a
@@ -877,7 +848,7 @@ bool CTxMemPool::accept(CValidationState &state, const CTransaction &tx, bool fL
// Don't accept it if it can't get into a block
int64 txMinFee = GetMinFee(tx, true, GMF_RELAY);
if (fLimitFree && nFees < txMinFee)
- return error("CTxMemPool::accept() : not enough fees %s, %"PRI64d" < %"PRI64d,
+ return error("AcceptToMemoryPool: : not enough fees %s, %"PRI64d" < %"PRI64d,
hash.ToString().c_str(),
nFees, txMinFee);
@@ -886,11 +857,12 @@ bool CTxMemPool::accept(CValidationState &state, const CTransaction &tx, bool fL
// be annoying or make others' transactions take longer to confirm.
if (fLimitFree && nFees < CTransaction::nMinRelayTxFee)
{
+ static CCriticalSection csFreeLimiter;
static double dFreeCount;
static int64 nLastTime;
int64 nNow = GetTime();
- LOCK(cs);
+ LOCK(csFreeLimiter);
// Use an exponentially decaying ~10-minute window:
dFreeCount *= pow(1.0 - 1.0/600.0, (double)(nNow - nLastTime));
@@ -898,14 +870,13 @@ bool CTxMemPool::accept(CValidationState &state, const CTransaction &tx, bool fL
// -limitfreerelay unit is thousand-bytes-per-minute
// At default rate it would take over a month to fill 1GB
if (dFreeCount >= GetArg("-limitfreerelay", 15)*10*1000)
- return error("CTxMemPool::accept() : free transaction rejected by rate limiter");
- if (fDebug)
- LogPrint("mempool", "Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount+nSize);
+ return error("AcceptToMemoryPool: : free transaction rejected by rate limiter");
+ LogPrint("mempool", "Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount+nSize);
dFreeCount += nSize;
}
if (fRejectInsaneFee && nFees > CTransaction::nMinRelayTxFee * 10000)
- return error("CTxMemPool::accept() : insane fees %s, %"PRI64d" > %"PRI64d,
+ return error("AcceptToMemoryPool: : insane fees %s, %"PRI64d" > %"PRI64d,
hash.ToString().c_str(),
nFees, CTransaction::nMinRelayTxFee * 10000);
@@ -913,146 +884,32 @@ bool CTxMemPool::accept(CValidationState &state, const CTransaction &tx, bool fL
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
if (!CheckInputs(tx, state, view, true, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC))
{
- return error("CTxMemPool::accept() : ConnectInputs failed %s", hash.ToString().c_str());
+ return error("AcceptToMemoryPool: : ConnectInputs failed %s", hash.ToString().c_str());
}
}
// Store transaction in memory
{
- LOCK(cs);
if (ptxOld)
{
- LogPrint("mempool", "CTxMemPool::accept() : replacing tx %s with new version\n", ptxOld->GetHash().ToString().c_str());
- remove(*ptxOld);
+ LogPrint("mempool", "AcceptToMemoryPool: : replacing tx %s with new version\n", ptxOld->GetHash().ToString().c_str());
+ pool.remove(*ptxOld);
}
- addUnchecked(hash, tx);
+ pool.addUnchecked(hash, tx);
}
///// are we sure this is ok when loading transactions or restoring block txes
// If updated, erase old tx from wallet
if (ptxOld)
- EraseFromWallets(ptxOld->GetHash());
- SyncWithWallets(hash, tx, NULL, true);
-
- LogPrint("mempool", "CTxMemPool::accept() : accepted %s (poolsz %"PRIszu")\n",
- hash.ToString().c_str(),
- mapTx.size());
- return true;
-}
-
-
-bool CTxMemPool::addUnchecked(const uint256& hash, const CTransaction &tx)
-{
- // Add to memory pool without checking anything. Don't call this directly,
- // call CTxMemPool::accept to properly check the transaction first.
- {
- mapTx[hash] = tx;
- for (unsigned int i = 0; i < tx.vin.size(); i++)
- mapNextTx[tx.vin[i].prevout] = CInPoint(&mapTx[hash], i);
- nTransactionsUpdated++;
- }
- return true;
-}
-
-
-bool CTxMemPool::remove(const CTransaction &tx, bool fRecursive)
-{
- // Remove transaction from memory pool
- {
- LOCK(cs);
- uint256 hash = tx.GetHash();
- if (fRecursive) {
- for (unsigned int i = 0; i < tx.vout.size(); i++) {
- std::map<COutPoint, CInPoint>::iterator it = mapNextTx.find(COutPoint(hash, i));
- if (it != mapNextTx.end())
- remove(*it->second.ptx, true);
- }
- }
- if (mapTx.count(hash))
- {
- BOOST_FOREACH(const CTxIn& txin, tx.vin)
- mapNextTx.erase(txin.prevout);
- mapTx.erase(hash);
- nTransactionsUpdated++;
- }
- }
- return true;
-}
+ g_signals.EraseTransaction(ptxOld->GetHash());
+ g_signals.SyncTransaction(hash, tx, NULL);
-bool CTxMemPool::removeConflicts(const CTransaction &tx)
-{
- // Remove transactions which depend on inputs of tx, recursively
- LOCK(cs);
- BOOST_FOREACH(const CTxIn &txin, tx.vin) {
- std::map<COutPoint, CInPoint>::iterator it = mapNextTx.find(txin.prevout);
- if (it != mapNextTx.end()) {
- const CTransaction &txConflict = *it->second.ptx;
- if (txConflict != tx)
- remove(txConflict, true);
- }
- }
+ LogPrint("mempool", "AcceptToMemoryPool: : accepted %s (poolsz %"PRIszu")\n",
+ hash.ToString().c_str(),
+ pool.mapTx.size());
return true;
}
-void CTxMemPool::clear()
-{
- LOCK(cs);
- mapTx.clear();
- mapNextTx.clear();
- ++nTransactionsUpdated;
-}
-
-bool CTxMemPool::fChecks = false;
-
-void CTxMemPool::check(CCoinsViewCache *pcoins) const
-{
- if (!fChecks)
- return;
-
- LogPrintf("Checking mempool with %u transactions and %u inputs\n", (unsigned int)mapTx.size(), (unsigned int)mapNextTx.size());
-
- LOCK(cs);
- for (std::map<uint256, CTransaction>::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) {
- unsigned int i = 0;
- BOOST_FOREACH(const CTxIn &txin, it->second.vin) {
- // Check that every mempool transaction's inputs refer to available coins, or other mempool tx's.
- std::map<uint256, CTransaction>::const_iterator it2 = mapTx.find(txin.prevout.hash);
- if (it2 != mapTx.end()) {
- assert(it2->second.vout.size() > txin.prevout.n && !it2->second.vout[txin.prevout.n].IsNull());
- } else {
- CCoins &coins = pcoins->GetCoins(txin.prevout.hash);
- assert(coins.IsAvailable(txin.prevout.n));
- }
- // Check whether its inputs are marked in mapNextTx.
- std::map<COutPoint, CInPoint>::const_iterator it3 = mapNextTx.find(txin.prevout);
- assert(it3 != mapNextTx.end());
- assert(it3->second.ptx == &it->second);
- assert(it3->second.n == i);
- i++;
- }
- }
- for (std::map<COutPoint, CInPoint>::const_iterator it = mapNextTx.begin(); it != mapNextTx.end(); it++) {
- uint256 hash = it->second.ptx->GetHash();
- std::map<uint256, CTransaction>::const_iterator it2 = mapTx.find(hash);
- assert(it2 != mapTx.end());
- assert(&it2->second == it->second.ptx);
- assert(it2->second.vin.size() > it->second.n);
- assert(it->first == it->second.ptx->vin[it->second.n].prevout);
- }
-}
-
-void CTxMemPool::queryHashes(std::vector<uint256>& vtxid)
-{
- vtxid.clear();
-
- LOCK(cs);
- vtxid.reserve(mapTx.size());
- for (map<uint256, CTransaction>::iterator mi = mapTx.begin(); mi != mapTx.end(); ++mi)
- vtxid.push_back((*mi).first);
-}
-
-
-
int CMerkleTx::GetDepthInMainChain(CBlockIndex* &pindexRet) const
{
@@ -1091,28 +948,7 @@ int CMerkleTx::GetBlocksToMaturity() const
bool CMerkleTx::AcceptToMemoryPool(bool fLimitFree)
{
CValidationState state;
- return mempool.accept(state, *this, fLimitFree, NULL);
-}
-
-
-
-bool CWalletTx::AcceptWalletTransaction()
-{
- {
- LOCK(mempool.cs);
- // Add previous supporting transactions first
- BOOST_FOREACH(CMerkleTx& tx, vtxPrev)
- {
- if (!tx.IsCoinBase())
- {
- uint256 hash = tx.GetHash();
- if (!mempool.exists(hash) && pcoinsTip->HaveCoins(hash))
- tx.AcceptToMemoryPool(false);
- }
- }
- return AcceptToMemoryPool(false);
- }
- return false;
+ return ::AcceptToMemoryPool(mempool, state, *this, fLimitFree, NULL);
}
@@ -1123,10 +959,8 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock
{
LOCK(cs_main);
{
- LOCK(mempool.cs);
- if (mempool.exists(hash))
+ if (mempool.lookup(hash, txOut))
{
- txOut = mempool.lookup(hash);
return true;
}
}
@@ -1411,7 +1245,7 @@ void CheckForkWarningConditions()
if (pindexBestForkTip && chainActive.Height() - pindexBestForkTip->nHeight >= 72)
pindexBestForkTip = NULL;
- if (pindexBestForkTip || nBestInvalidWork > chainActive.Tip()->nChainWork + (chainActive.Tip()->GetBlockWork() * 6).getuint256())
+ if (pindexBestForkTip || (pindexBestInvalid && pindexBestInvalid->nChainWork > chainActive.Tip()->nChainWork + (chainActive.Tip()->GetBlockWork() * 6).getuint256()))
{
if (!fLargeWorkForkFound)
{
@@ -1478,10 +1312,13 @@ void CheckForkWarningConditionsOnNewFork(CBlockIndex* pindexNewForkTip)
void static InvalidChainFound(CBlockIndex* pindexNew)
{
- if (pindexNew->nChainWork > nBestInvalidWork)
+ if (!pindexBestInvalid || pindexNew->nChainWork > pindexBestInvalid->nChainWork)
{
- nBestInvalidWork = pindexNew->nChainWork;
- pblocktree->WriteBestInvalidWork(CBigNum(nBestInvalidWork));
+ pindexBestInvalid = pindexNew;
+ // The current code doesn't actually read the BestInvalidWork entry in
+ // the block database anymore, as it is derived from the flags in block
+ // index entry. We only write it for backward compatibility.
+ pblocktree->WriteBestInvalidWork(CBigNum(pindexBestInvalid->nChainWork));
uiInterface.NotifyBlocksChanged();
}
LogPrintf("InvalidChainFound: invalid block=%s height=%d log2_work=%.8g date=%s\n",
@@ -1750,12 +1587,12 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
const CTransaction &tx = block.vtx[i];
uint256 hash = tx.GetHash();
- // check that all outputs are available
- if (!view.HaveCoins(hash)) {
- fClean = fClean && error("DisconnectBlock() : outputs still spent? database corrupted");
- view.SetCoins(hash, CCoins());
- }
- CCoins &outs = view.GetCoins(hash);
+ // Check that all outputs are available and match the outputs in the block itself
+ // exactly. Note that transactions with only provably unspendable outputs won't
+ // have outputs available even in the block itself, so we handle that case
+ // specially with outsEmpty.
+ CCoins outsEmpty;
+ CCoins &outs = view.HaveCoins(hash) ? view.GetCoins(hash) : outsEmpty;
outs.ClearUnspendable();
CCoins outsBlock = CCoins(tx, pindex->nHeight);
@@ -1992,14 +1829,14 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C
// Watch for transactions paying to me
for (unsigned int i = 0; i < block.vtx.size(); i++)
- SyncWithWallets(block.GetTxHash(i), block.vtx[i], &block, true);
+ g_signals.SyncTransaction(block.GetTxHash(i), block.vtx[i], &block);
return true;
}
bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
{
- mempool.check(pcoinsTip);
+ mempool.check(&LookupFromTip);
// All modifications to the coin state will be done in this cache.
// Only when all have succeeded, we push it to pcoinsTip.
@@ -2112,7 +1949,7 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
BOOST_FOREACH(CTransaction& tx, vResurrect) {
// ignore validation errors in resurrected transactions
CValidationState stateDummy;
- if (!mempool.accept(stateDummy, tx, false, NULL))
+ if (!AcceptToMemoryPool(mempool,stateDummy, tx, false, NULL))
mempool.remove(tx, true);
}
@@ -2122,15 +1959,15 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
mempool.removeConflicts(tx);
}
- mempool.check(pcoinsTip);
+ mempool.check(&LookupFromTip);
// Update best block in wallet (so we can detect restored wallets)
if ((pindexNew->nHeight % 20160) == 0 || (!fIsInitialDownload && (pindexNew->nHeight % 144) == 0))
- ::SetBestChain(chainActive.GetLocator(pindexNew));
+ g_signals.SetBestChain(chainActive.GetLocator(pindexNew));
// New best block
nTimeBestReceived = GetTime();
- nTransactionsUpdated++;
+ mempool.AddTransactionsUpdated(1);
LogPrintf("SetBestChain: new best=%s height=%d log2_work=%.8g tx=%lu date=%s progress=%f\n",
chainActive.Tip()->GetBlockHash().ToString().c_str(), chainActive.Height(), log(chainActive.Tip()->nChainWork.getdouble())/log(2.0), (unsigned long)pindexNew->nChainTx,
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.Tip()->GetBlockTime()).c_str(),
@@ -2206,7 +2043,7 @@ bool AddToBlockIndex(CBlock& block, CValidationState& state, const CDiskBlockPos
CheckForkWarningConditions();
// Notify UI to display prev block's coinbase if it was ours
static uint256 hashPrevBestCoinBase;
- UpdatedTransaction(hashPrevBestCoinBase);
+ g_signals.UpdatedTransaction(hashPrevBestCoinBase);
hashPrevBestCoinBase = block.GetTxHash(0);
} else
CheckForkWarningConditionsOnNewFork(pindexNew);
@@ -2355,7 +2192,7 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
uniqueTx.insert(block.GetTxHash(i));
}
if (uniqueTx.size() != block.vtx.size())
- return state.DoS(100, error("CheckBlock() : duplicate transaction"));
+ return state.DoS(100, error("CheckBlock() : duplicate transaction"), true);
unsigned int nSigOps = 0;
BOOST_FOREACH(const CTransaction& tx, block.vtx)
@@ -2753,10 +2590,6 @@ bool CheckDiskSpace(uint64 nAdditionalBytes)
return true;
}
-CCriticalSection cs_LastBlockFile;
-CBlockFileInfo infoLastBlockFile;
-int nLastBlockFile = 0;
-
FILE* OpenDiskFile(const CDiskBlockPos &pos, const char *prefix, bool fReadOnly)
{
if (pos.IsNull())
@@ -2831,6 +2664,8 @@ bool static LoadBlockIndexDB()
pindex->nChainTx = (pindex->pprev ? pindex->pprev->nChainTx : 0) + pindex->nTx;
if ((pindex->nStatus & BLOCK_VALID_MASK) >= BLOCK_VALID_TRANSACTIONS && !(pindex->nStatus & BLOCK_FAILED_MASK))
setBlockIndexValid.insert(pindex);
+ if (pindex->nStatus & BLOCK_FAILED_MASK && (!pindexBestInvalid || pindex->nChainWork > pindexBestInvalid->nChainWork))
+ pindexBestInvalid = pindex;
}
// Load block file info
@@ -2839,11 +2674,6 @@ bool static LoadBlockIndexDB()
if (pblocktree->ReadBlockFileInfo(nLastBlockFile, infoLastBlockFile))
LogPrintf("LoadBlockIndexDB(): last block file info: %s\n", infoLastBlockFile.ToString().c_str());
- // Load nBestInvalidWork, OK if it doesn't exist
- CBigNum bnBestInvalidWork;
- pblocktree->ReadBestInvalidWork(bnBestInvalidWork);
- nBestInvalidWork = bnBestInvalidWork.getuint256();
-
// Check whether we need to continue reindexing
bool fReindexing = false;
pblocktree->ReadReindexing(fReindexing);
@@ -2853,12 +2683,10 @@ bool static LoadBlockIndexDB()
pblocktree->ReadFlag("txindex", fTxIndex);
LogPrintf("LoadBlockIndexDB(): transaction index %s\n", fTxIndex ? "enabled" : "disabled");
- // Load hashBestChain pointer to end of best chain
+ // Load pointer to end of best chain
chainActive.SetTip(pcoinsTip->GetBestBlock());
if (chainActive.Tip() == NULL)
return true;
-
- // register best chain
LogPrintf("LoadBlockIndexDB(): hashBestChain=%s height=%d date=%s\n",
chainActive.Tip()->GetBlockHash().ToString().c_str(), chainActive.Height(),
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.Tip()->GetBlockTime()).c_str());
@@ -2944,7 +2772,7 @@ void UnloadBlockIndex()
mapBlockIndex.clear();
setBlockIndexValid.clear();
chainActive.SetTip(NULL);
- nBestInvalidWork = 0;
+ pindexBestInvalid = NULL;
}
bool LoadBlockIndex()
@@ -3041,8 +2869,6 @@ void PrintBlockTree()
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", block.GetBlockTime()).c_str(),
block.vtx.size());
- PrintWallets(block);
-
// put the main time-chain first
vector<CBlockIndex*>& vNext = mapNext[pindex];
for (unsigned int i = 0; i < vNext.size(); i++)
@@ -3221,10 +3047,7 @@ bool static AlreadyHave(const CInv& inv)
case MSG_TX:
{
bool txInMap = false;
- {
- LOCK(mempool.cs);
- txInMap = mempool.exists(inv.hash);
- }
+ txInMap = mempool.exists(inv.hash);
return txInMap || mapOrphanTransactions.count(inv.hash) ||
pcoinsTip->HaveCoins(inv.hash);
}
@@ -3315,9 +3138,8 @@ void static ProcessGetData(CNode* pfrom)
}
}
if (!pushed && inv.type == MSG_TX) {
- LOCK(mempool.cs);
- if (mempool.exists(inv.hash)) {
- CTransaction tx = mempool.lookup(inv.hash);
+ CTransaction tx;
+ if (mempool.lookup(inv.hash, tx)) {
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss.reserve(1000);
ss << tx;
@@ -3331,7 +3153,10 @@ void static ProcessGetData(CNode* pfrom)
}
// Track requests for our stuff.
- Inventory(inv.hash);
+ g_signals.Inventory(inv.hash);
+
+ if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK)
+ break;
}
}
@@ -3459,8 +3284,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
LogPrintf("receive version message: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", pfrom->nVersion, pfrom->nStartingHeight, addrMe.ToString().c_str(), addrFrom.ToString().c_str(), pfrom->addr.ToString().c_str());
- LOCK(cs_main);
AddTimeData(pfrom->addr, nTime);
+
+ LOCK(cs_main);
cPeerBlockCounts.input(pfrom->nStartingHeight);
}
@@ -3592,7 +3418,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
}
// Track requests for our stuff
- Inventory(inv.hash);
+ g_signals.Inventory(inv.hash);
}
}
@@ -3607,10 +3433,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
return error("message getdata size() = %"PRIszu"", vInv.size());
}
- if (fDebugNet || (vInv.size() != 1))
+ if (fDebug || (vInv.size() != 1))
LogPrint("net", "received getdata (%"PRIszu" invsz)\n", vInv.size());
- if ((fDebugNet && vInv.size() > 0) || (vInv.size() == 1))
+ if ((fDebug && vInv.size() > 0) || (vInv.size() == 1))
LogPrint("net", "received getdata for: %s\n", vInv[0].ToString().c_str());
pfrom->vRecvGetData.insert(pfrom->vRecvGetData.end(), vInv.begin(), vInv.end());
@@ -3707,9 +3533,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
bool fMissingInputs = false;
CValidationState state;
- if (mempool.accept(state, tx, true, &fMissingInputs))
+ if (AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs))
{
- mempool.check(pcoinsTip);
+ mempool.check(&LookupFromTip);
RelayTransaction(tx, inv.hash);
mapAlreadyAskedFor.erase(inv);
vWorkQueue.push_back(inv.hash);
@@ -3731,7 +3557,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
// anyone relaying LegitTxX banned)
CValidationState stateDummy;
- if (mempool.accept(stateDummy, orphanTx, true, &fMissingInputs2))
+ if (AcceptToMemoryPool(mempool, stateDummy, orphanTx, true, &fMissingInputs2))
{
LogPrint("mempool", " accepted orphan tx %s\n", orphanHash.ToString().c_str());
RelayTransaction(orphanTx, orphanHash);
@@ -3745,7 +3571,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
vEraseQueue.push_back(orphanHash);
LogPrint("mempool", " removed orphan tx %s\n", orphanHash.ToString().c_str());
}
- mempool.check(pcoinsTip);
+ mempool.check(&LookupFromTip);
}
}
@@ -3782,7 +3608,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
LOCK(cs_main);
CValidationState state;
- if (ProcessBlock(state, pfrom, &block))
+ if (ProcessBlock(state, pfrom, &block) || state.CorruptionPossible())
mapAlreadyAskedFor.erase(inv);
int nDoS = 0;
if (state.IsInvalid(nDoS))
@@ -3802,19 +3628,23 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
else if (strCommand == "mempool")
{
- LOCK(cs_main);
+ LOCK2(cs_main, pfrom->cs_filter);
std::vector<uint256> vtxid;
- LOCK2(mempool.cs, pfrom->cs_filter);
mempool.queryHashes(vtxid);
vector<CInv> vInv;
BOOST_FOREACH(uint256& hash, vtxid) {
CInv inv(MSG_TX, hash);
- if ((pfrom->pfilter && pfrom->pfilter->IsRelevantAndUpdate(mempool.lookup(hash), hash)) ||
+ CTransaction tx;
+ bool fInMemPool = mempool.lookup(hash, tx);
+ if (!fInMemPool) continue; // another thread removed since queryHashes, maybe...
+ if ((pfrom->pfilter && pfrom->pfilter->IsRelevantAndUpdate(tx, hash)) ||
(!pfrom->pfilter))
vInv.push_back(inv);
- if (vInv.size() == MAX_INV_SZ)
- break;
+ if (vInv.size() == MAX_INV_SZ) {
+ pfrom->PushMessage("inv", vInv);
+ vInv.clear();
+ }
}
if (vInv.size() > 0)
pfrom->PushMessage("inv", vInv);
@@ -4012,7 +3842,10 @@ bool ProcessMessages(CNode* pfrom)
if (!pfrom->vRecvGetData.empty())
ProcessGetData(pfrom);
-
+
+ // this maintains the order of responses
+ if (!pfrom->vRecvGetData.empty()) return fOk;
+
std::deque<CNetMessage>::iterator it = pfrom->vRecvMsg.begin();
while (!pfrom->fDisconnect && it != pfrom->vRecvMsg.end()) {
// Don't bother if send buffer is too full to respond anyway
@@ -4100,6 +3933,8 @@ bool ProcessMessages(CNode* pfrom)
if (!fRet)
LogPrintf("ProcessMessage(%s, %u bytes) FAILED\n", strCommand.c_str(), nMessageSize);
+
+ break;
}
// In case the connection got shut down, its receive buffer was wiped
@@ -4212,7 +4047,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
// transactions become unconfirmed and spams other nodes.
if (!fReindex && !fImporting && !IsInitialBlockDownload())
{
- ResendWalletTransactions();
+ g_signals.Broadcast();
}
//
@@ -4240,15 +4075,6 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
hashRand = Hash(BEGIN(hashRand), END(hashRand));
bool fTrickleWait = ((hashRand & 3) != 0);
- // always trickle our own transactions
- if (!fTrickleWait)
- {
- CWalletTx wtx;
- if (GetTransaction(inv.hash, wtx))
- if (wtx.fFromMe)
- fTrickleWait = true;
- }
-
if (fTrickleWait)
{
vInvWait.push_back(inv);
@@ -4283,7 +4109,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
const CInv& inv = (*pto->mapAskFor.begin()).second;
if (!AlreadyHave(inv))
{
- if (fDebugNet)
+ if (fDebug)
LogPrint("net", "sending getdata: %s\n", inv.ToString().c_str());
vGetData.push_back(inv);
if (vGetData.size() >= 1000)
diff --git a/src/main.h b/src/main.h
index 76de47071e..80972330f3 100644
--- a/src/main.h
+++ b/src/main.h
@@ -12,22 +12,19 @@
#include "core.h"
#include "bignum.h"
#include "sync.h"
+#include "txmempool.h"
#include "net.h"
#include "script.h"
#include <list>
-class CWallet;
class CBlock;
class CBlockIndex;
-class CKeyItem;
-class CReserveKey;
-
-class CAddress;
class CInv;
+class CKeyItem;
class CNode;
-
-struct CBlockIndexWorkComparator;
+class CReserveKey;
+class CWallet;
/** The maximum allowed size for a serialized block, in bytes (network rule) */
static const unsigned int MAX_BLOCK_SIZE = 1000000;
@@ -73,16 +70,12 @@ extern CScript COINBASE_FLAGS;
extern CCriticalSection cs_main;
+extern CTxMemPool mempool;
extern std::map<uint256, CBlockIndex*> mapBlockIndex;
-extern std::set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexValid;
-extern uint256 nBestInvalidWork;
-extern unsigned int nTransactionsUpdated;
extern uint64 nLastBlockTx;
extern uint64 nLastBlockSize;
extern const std::string strMessageMagic;
extern int64 nTimeBestReceived;
-extern CCriticalSection cs_setpwalletRegistered;
-extern std::set<CWallet*> setpwalletRegistered;
extern bool fImporting;
extern bool fReindex;
extern bool fBenchmark;
@@ -108,17 +101,18 @@ class CCoinsView;
class CCoinsViewCache;
class CScriptCheck;
class CValidationState;
+class CWalletInterface;
struct CBlockTemplate;
/** Register a wallet to receive updates from core */
-void RegisterWallet(CWallet* pwalletIn);
+void RegisterWallet(CWalletInterface* pwalletIn);
/** Unregister a wallet from core */
-void UnregisterWallet(CWallet* pwalletIn);
+void UnregisterWallet(CWalletInterface* pwalletIn);
/** Unregister all wallets from core */
void UnregisterAllWallets();
/** Push an updated transaction to all registered wallets */
-void SyncWithWallets(const uint256 &hash, const CTransaction& tx, const CBlock* pblock = NULL, bool fUpdate = false);
+void SyncWithWallets(const uint256 &hash, const CTransaction& tx, const CBlock* pblock = NULL);
/** Register with a network node to receive its signals */
void RegisterNodeSignals(CNodeSignals& nodeSignals);
@@ -181,6 +175,9 @@ bool VerifySignature(const CCoins& txFrom, const CTransaction& txTo, unsigned in
/** Abort with a message */
bool AbortNode(const std::string &msg);
+/** (try to) add transaction to memory pool **/
+bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,
+ bool* pfMissingInputs, bool fRejectInsaneFee=false);
@@ -189,10 +186,6 @@ bool AbortNode(const std::string &msg);
-
-
-bool GetWalletFile(CWallet* pwallet, std::string &strWalletFileOut);
-
struct CDiskBlockPos
{
int nFile;
@@ -652,10 +645,6 @@ public:
}
};
-extern CCriticalSection cs_LastBlockFile;
-extern CBlockFileInfo infoLastBlockFile;
-extern int nLastBlockFile;
-
enum BlockStatus {
BLOCK_VALID_UNKNOWN = 0,
BLOCK_VALID_HEADER = 1, // parsed, version ok, hash satisfies claimed PoW, 1 <= vtx count <= max, timestamp not in future
@@ -855,19 +844,6 @@ public:
}
};
-struct CBlockIndexWorkComparator
-{
- bool operator()(CBlockIndex *pa, CBlockIndex *pb) {
- if (pa->nChainWork > pb->nChainWork) return false;
- if (pa->nChainWork < pb->nChainWork) return true;
-
- if (pa->GetBlockHash() < pb->GetBlockHash()) return false;
- if (pa->GetBlockHash() > pb->GetBlockHash()) return true;
-
- return false; // identical blocks
- }
-};
-
/** Used to marshal pointers into hashes for db storage. */
@@ -946,13 +922,15 @@ private:
MODE_ERROR, // run-time error
} mode;
int nDoS;
+ bool corruptionPossible;
public:
CValidationState() : mode(MODE_VALID), nDoS(0) {}
- bool DoS(int level, bool ret = false) {
+ bool DoS(int level, bool ret = false, bool corruptionIn = false) {
if (mode == MODE_ERROR)
return ret;
nDoS += level;
mode = MODE_INVALID;
+ corruptionPossible = corruptionIn;
return ret;
}
bool Invalid(bool ret = false) {
@@ -982,6 +960,9 @@ public:
}
return false;
}
+ bool CorruptionPossible() {
+ return corruptionPossible;
+ }
};
/** An in-memory indexed chain of blocks. */
@@ -1050,44 +1031,6 @@ extern CChain chainActive;
-
-
-class CTxMemPool
-{
-public:
- static bool fChecks;
- mutable CCriticalSection cs;
- std::map<uint256, CTransaction> mapTx;
- std::map<COutPoint, CInPoint> mapNextTx;
-
- bool accept(CValidationState &state, const CTransaction &tx, bool fLimitFree, bool* pfMissingInputs, bool fRejectInsaneFee = false);
- bool addUnchecked(const uint256& hash, const CTransaction &tx);
- bool remove(const CTransaction &tx, bool fRecursive = false);
- bool removeConflicts(const CTransaction &tx);
- void clear();
- void queryHashes(std::vector<uint256>& vtxid);
- void pruneSpent(const uint256& hash, CCoins &coins);
- void check(CCoinsViewCache *pcoins) const;
-
- unsigned long size()
- {
- LOCK(cs);
- return mapTx.size();
- }
-
- bool exists(uint256 hash)
- {
- return (mapTx.count(hash) != 0);
- }
-
- CTransaction& lookup(uint256 hash)
- {
- return mapTx[hash];
- }
-};
-
-extern CTxMemPool mempool;
-
struct CCoinsStats
{
int nHeight;
@@ -1256,4 +1199,18 @@ public:
)
};
+
+class CWalletInterface {
+protected:
+ virtual void SyncTransaction(const uint256 &hash, const CTransaction &tx, const CBlock *pblock) =0;
+ virtual void EraseFromWallet(const uint256 &hash) =0;
+ virtual void SetBestChain(const CBlockLocator &locator) =0;
+ virtual void UpdatedTransaction(const uint256 &hash) =0;
+ virtual void Inventory(const uint256 &hash) =0;
+ virtual void ResendWalletTransactions() =0;
+ friend void ::RegisterWallet(CWalletInterface*);
+ friend void ::UnregisterWallet(CWalletInterface*);
+ friend void ::UnregisterAllWallets();
+};
+
#endif
diff --git a/src/miner.cpp b/src/miner.cpp
index dca8609e17..b03f915dc9 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -521,7 +521,7 @@ void static BitcoinMiner(CWallet *pwallet)
//
// Create new block
//
- unsigned int nTransactionsUpdatedLast = nTransactionsUpdated;
+ unsigned int nTransactionsUpdatedLast = mempool.GetTransactionsUpdated();
CBlockIndex* pindexPrev = chainActive.Tip();
auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlockWithKey(reservekey));
@@ -623,7 +623,7 @@ void static BitcoinMiner(CWallet *pwallet)
break;
if (nBlockNonce >= 0xffff0000)
break;
- if (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60)
+ if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 60)
break;
if (pindexPrev != chainActive.Tip())
break;
diff --git a/src/net.cpp b/src/net.cpp
index d223b3999e..8c0ada8f92 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1540,6 +1540,9 @@ void ThreadMessageHandler()
CNode* pnodeTrickle = NULL;
if (!vNodesCopy.empty())
pnodeTrickle = vNodesCopy[GetRand(vNodesCopy.size())];
+
+ bool fSleep = true;
+
BOOST_FOREACH(CNode* pnode, vNodesCopy)
{
if (pnode->fDisconnect)
@@ -1549,8 +1552,18 @@ void ThreadMessageHandler()
{
TRY_LOCK(pnode->cs_vRecvMsg, lockRecv);
if (lockRecv)
+ {
if (!g_signals.ProcessMessages(pnode))
pnode->CloseSocketDisconnect();
+
+ if (pnode->nSendSize < SendBufferSize())
+ {
+ if (!pnode->vRecvGetData.empty() || (!pnode->vRecvMsg.empty() && pnode->vRecvMsg[0].complete()))
+ {
+ fSleep = false;
+ }
+ }
+ }
}
boost::this_thread::interruption_point();
@@ -1568,8 +1581,9 @@ void ThreadMessageHandler()
BOOST_FOREACH(CNode* pnode, vNodesCopy)
pnode->Release();
}
-
- MilliSleep(100);
+
+ if (fSleep)
+ MilliSleep(100);
}
}
@@ -1894,3 +1908,38 @@ uint64 CNode::GetTotalBytesSent()
LOCK(cs_totalBytesSent);
return nTotalBytesSent;
}
+
+void CNode::Fuzz(int nChance)
+{
+ if (!fSuccessfullyConnected) return; // Don't fuzz initial handshake
+ if (GetRand(nChance) != 0) return; // Fuzz 1 of every nChance messages
+
+ switch (GetRand(3))
+ {
+ case 0:
+ // xor a random byte with a random value:
+ if (!ssSend.empty()) {
+ CDataStream::size_type pos = GetRand(ssSend.size());
+ ssSend[pos] ^= (unsigned char)(GetRand(256));
+ }
+ break;
+ case 1:
+ // delete a random byte:
+ if (!ssSend.empty()) {
+ CDataStream::size_type pos = GetRand(ssSend.size());
+ ssSend.erase(ssSend.begin()+pos);
+ }
+ break;
+ case 2:
+ // insert a random byte at a random position
+ {
+ CDataStream::size_type pos = GetRand(ssSend.size());
+ char ch = (char)GetRand(256);
+ ssSend.insert(ssSend.begin()+pos, ch);
+ }
+ break;
+ }
+ // Chance of more than one change half the time:
+ // (more changes exponentially less likely):
+ Fuzz(2);
+}
diff --git a/src/net.h b/src/net.h
index ffa8681641..35ee7a06a6 100644
--- a/src/net.h
+++ b/src/net.h
@@ -218,6 +218,9 @@ protected:
static CCriticalSection cs_setBanned;
int nMisbehavior;
+ // Basic fuzz-testing
+ void Fuzz(int nChance); // modifies ssSend
+
public:
uint256 hashContinue;
CBlockIndex* pindexLastGetBlocksBegin;
@@ -434,12 +437,17 @@ public:
// TODO: Document the precondition of this function. Is cs_vSend locked?
void EndMessage() UNLOCK_FUNCTION(cs_vSend)
{
- if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
+ // The -*messagestest options are intentionally not documented in the help message,
+ // since they are only used during development to debug the networking code and are
+ // not intended for end-users.
+ if (mapArgs.count("-dropmessagestest") && GetRand(GetArg("-dropmessagestest", 2)) == 0)
{
LogPrint("net", "dropmessages DROPPING SEND MESSAGE\n");
AbortMessage();
return;
}
+ if (mapArgs.count("-fuzzmessagestest"))
+ Fuzz(GetArg("-fuzzmessagestest", 10));
if (ssSend.size() == 0)
return;
diff --git a/src/qt/aboutdialog.cpp b/src/qt/aboutdialog.cpp
index cea8e98425..e3ef92caea 100644
--- a/src/qt/aboutdialog.cpp
+++ b/src/qt/aboutdialog.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "aboutdialog.h"
#include "ui_aboutdialog.h"
diff --git a/src/qt/aboutdialog.h b/src/qt/aboutdialog.h
index 33b1437674..72545f9b21 100644
--- a/src/qt/aboutdialog.h
+++ b/src/qt/aboutdialog.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp
index ba5de4660a..cef307b86d 100644
--- a/src/qt/addressbookpage.cpp
+++ b/src/qt/addressbookpage.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#if defined(HAVE_CONFIG_H)
#include "bitcoin-config.h"
#endif
@@ -6,7 +10,6 @@
#include "ui_addressbookpage.h"
#include "addresstablemodel.h"
-#include "optionsmodel.h"
#include "bitcoingui.h"
#include "editaddressdialog.h"
#include "csvmodelwriter.h"
@@ -21,7 +24,6 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
QDialog(parent),
ui(new Ui::AddressBookPage),
model(0),
- optionsModel(0),
mode(mode),
tab(tab)
{
@@ -144,11 +146,6 @@ void AddressBookPage::setModel(AddressTableModel *model)
selectionChanged();
}
-void AddressBookPage::setOptionsModel(OptionsModel *optionsModel)
-{
- this->optionsModel = optionsModel;
-}
-
void AddressBookPage::on_copyAddress_clicked()
{
GUIUtil::copyEntryData(ui->tableView, AddressTableModel::Address);
diff --git a/src/qt/addressbookpage.h b/src/qt/addressbookpage.h
index 9255e58144..60b5d8c47f 100644
--- a/src/qt/addressbookpage.h
+++ b/src/qt/addressbookpage.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef ADDRESSBOOKPAGE_H
#define ADDRESSBOOKPAGE_H
@@ -7,7 +11,6 @@ namespace Ui {
class AddressBookPage;
}
class AddressTableModel;
-class OptionsModel;
QT_BEGIN_NAMESPACE
class QTableView;
@@ -38,7 +41,6 @@ public:
~AddressBookPage();
void setModel(AddressTableModel *model);
- void setOptionsModel(OptionsModel *optionsModel);
const QString &getReturnValue() const { return returnValue; }
public slots:
@@ -47,7 +49,6 @@ public slots:
private:
Ui::AddressBookPage *ui;
AddressTableModel *model;
- OptionsModel *optionsModel;
Mode mode;
Tabs tab;
QString returnValue;
diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp
index 921c4443a9..ab1900fbf3 100644
--- a/src/qt/addresstablemodel.cpp
+++ b/src/qt/addresstablemodel.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "addresstablemodel.h"
#include "guiutil.h"
diff --git a/src/qt/addresstablemodel.h b/src/qt/addresstablemodel.h
index 6f532087fe..1ddee1aeb5 100644
--- a/src/qt/addresstablemodel.h
+++ b/src/qt/addresstablemodel.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef ADDRESSTABLEMODEL_H
#define ADDRESSTABLEMODEL_H
@@ -79,9 +83,6 @@ private:
/** Notify listeners that data changed. */
void emitDataChanged(int index);
-signals:
- void defaultAddressChanged(const QString &address);
-
public slots:
/* Update address list from core.
*/
diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp
index 2b7671f209..521585644e 100644
--- a/src/qt/askpassphrasedialog.cpp
+++ b/src/qt/askpassphrasedialog.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "askpassphrasedialog.h"
#include "ui_askpassphrasedialog.h"
diff --git a/src/qt/askpassphrasedialog.h b/src/qt/askpassphrasedialog.h
index 9df002da2c..838ad21beb 100644
--- a/src/qt/askpassphrasedialog.h
+++ b/src/qt/askpassphrasedialog.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef ASKPASSPHRASEDIALOG_H
#define ASKPASSPHRASEDIALOG_H
@@ -37,6 +41,8 @@ private:
private slots:
void textChanged();
+
+protected:
bool event(QEvent *event);
bool eventFilter(QObject *object, QEvent *event);
};
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 09f2a53680..1e2f93f1e7 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -1,6 +1,6 @@
-/*
- * W.J. van der Laan 2011-2012
- */
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "bitcoingui.h"
#include "clientmodel.h"
@@ -173,8 +173,6 @@ int main(int argc, char *argv[])
bool fMissingDatadir = false;
bool fSelParFromCLFailed = false;
- fHaveGUI = true;
-
// Command-line options take precedence:
ParseParameters(argc, argv);
// ... then bitcoin.conf:
@@ -293,7 +291,7 @@ int main(int argc, char *argv[])
QObject::connect(pollShutdownTimer, SIGNAL(timeout()), guiref, SLOT(detectShutdown()));
pollShutdownTimer->start(200);
- if(AppInit2(threadGroup))
+ if(AppInit2(threadGroup, false))
{
{
// Put this in a block, so that the Model objects are cleaned up before
diff --git a/src/qt/bitcoinaddressvalidator.cpp b/src/qt/bitcoinaddressvalidator.cpp
index 5136ea0c40..604f24192b 100644
--- a/src/qt/bitcoinaddressvalidator.cpp
+++ b/src/qt/bitcoinaddressvalidator.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "bitcoinaddressvalidator.h"
/* Base58 characters are:
diff --git a/src/qt/bitcoinaddressvalidator.h b/src/qt/bitcoinaddressvalidator.h
index b7f4dfee96..91d248abd1 100644
--- a/src/qt/bitcoinaddressvalidator.h
+++ b/src/qt/bitcoinaddressvalidator.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef BITCOINADDRESSVALIDATOR_H
#define BITCOINADDRESSVALIDATOR_H
diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp
index 37b8743eff..f722a454f1 100644
--- a/src/qt/bitcoinamountfield.cpp
+++ b/src/qt/bitcoinamountfield.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "bitcoinamountfield.h"
#include "qvaluecombobox.h"
diff --git a/src/qt/bitcoinamountfield.h b/src/qt/bitcoinamountfield.h
index 9c8be5a26a..d54f536b1f 100644
--- a/src/qt/bitcoinamountfield.h
+++ b/src/qt/bitcoinamountfield.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef BITCOINAMOUNTFIELD_H
#define BITCOINAMOUNTFIELD_H
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index eadda586a0..0b6bd517e5 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -1,20 +1,15 @@
-/*
- * Qt4 bitcoin GUI.
- *
- * W.J. van der Laan 2011-2012
- * The Bitcoin Developers 2011-2012
- */
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "bitcoingui.h"
-#include "transactiontablemodel.h"
#include "optionsdialog.h"
#include "aboutdialog.h"
#include "clientmodel.h"
#include "walletmodel.h"
#include "walletframe.h"
#include "optionsmodel.h"
-#include "transactiondescdialog.h"
#include "bitcoinunits.h"
#include "guiconstants.h"
#include "notificator.h"
@@ -258,9 +253,9 @@ void BitcoinGUI::createActions(bool fIsTestnet)
openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console"));
usedSendingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("&Used sending addresses..."), this);
- usedSendingAddressesAction->setStatusTip(tr("Edit the list of used sending addresses and labels"));
+ usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels"));
usedReceivingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("Used &receiving addresses..."), this);
- usedReceivingAddressesAction->setStatusTip(tr("Edit the list of used receiving addresses and labels"));
+ usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels"));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index 0394e2f84e..6a2058e0b6 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef BITCOINGUI_H
#define BITCOINGUI_H
@@ -5,13 +9,11 @@
#include <QSystemTrayIcon>
#include <QMap>
-class TransactionTableModel;
class WalletFrame;
class WalletView;
class ClientModel;
class WalletModel;
class WalletStack;
-class TransactionView;
class OverviewPage;
class SendCoinsDialog;
class SendCoinsRecipient;
@@ -50,11 +52,11 @@ public:
The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic.
*/
void setClientModel(ClientModel *clientModel);
+
/** Set the wallet model.
The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
functionality.
*/
-
bool addWallet(const QString& name, WalletModel *walletModel);
bool setCurrentWallet(const QString& name);
@@ -98,7 +100,6 @@ private:
QSystemTrayIcon *trayIcon;
Notificator *notificator;
- TransactionView *transactionView;
RPCConsole *rpcConsole;
QMovie *syncIconMovie;
diff --git a/src/qt/bitcoinstrings.cpp b/src/qt/bitcoinstrings.cpp
index bfe9494b17..457090b1f5 100644
--- a/src/qt/bitcoinstrings.cpp
+++ b/src/qt/bitcoinstrings.cpp
@@ -19,8 +19,8 @@ QT_TRANSLATE_NOOP("bitcoin-core", ""
"It is also recommended to set alertnotify so you are notified of problems;\n"
"for example: alertnotify=echo %%s | mail -s \"Bitcoin Alert\" admin@foo.com\n"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
-"Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:"
-"@STRENGTH)"),
+"Acceptable ciphers (default: TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!"
+"3DES:@STRENGTH)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
"An error occurred while setting up the RPC port %u for listening on IPv4: %s"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
@@ -98,6 +98,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Add a node to connect to and attempt to keep
QT_TRANSLATE_NOOP("bitcoin-core", "Allow DNS lookups for -addnode, -seednode and -connect"),
QT_TRANSLATE_NOOP("bitcoin-core", "Allow JSON-RPC connections from specified IP address"),
QT_TRANSLATE_NOOP("bitcoin-core", "Attempt to recover private keys from a corrupt wallet.dat"),
+QT_TRANSLATE_NOOP("bitcoin-core", "Bitcoin RPC client version"),
QT_TRANSLATE_NOOP("bitcoin-core", "Bitcoin version"),
QT_TRANSLATE_NOOP("bitcoin-core", "Block creation options:"),
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot downgrade wallet"),
@@ -106,6 +107,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -externalip address: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot write default address"),
QT_TRANSLATE_NOOP("bitcoin-core", "Connect only to the specified node(s)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Connect through socks proxy"),
+QT_TRANSLATE_NOOP("bitcoin-core", "Connect to JSON-RPC on <port> (default: 8332 or testnet: 18332)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Connect to a node to retrieve peer addresses, and disconnect"),
QT_TRANSLATE_NOOP("bitcoin-core", "Corrupted block database detected"),
QT_TRANSLATE_NOOP("bitcoin-core", "Discover own IP address (default: 1 when listening and no -externalip)"),
@@ -143,8 +145,8 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Imports blocks from external blk000??.dat fil
QT_TRANSLATE_NOOP("bitcoin-core", "Incorrect or no genesis block found. Wrong datadir for network?"),
QT_TRANSLATE_NOOP("bitcoin-core", "Information"),
QT_TRANSLATE_NOOP("bitcoin-core", "Insufficient funds"),
+QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -onion address: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -proxy address: '%s'"),
-QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -tor address: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -minrelaytxfee=<amount>: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -mintxfee=<amount>: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -paytxfee=<amount>: '%s'"),
@@ -172,7 +174,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Rescanning..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Run in the background as a daemon and accept commands"),
QT_TRANSLATE_NOOP("bitcoin-core", "SSL options: (see the Bitcoin Wiki for SSL setup instructions)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Select the version of socks proxy to use (4-5, default: 5)"),
-QT_TRANSLATE_NOOP("bitcoin-core", "Send command to -server or bitcoind"),
+QT_TRANSLATE_NOOP("bitcoin-core", "Send command to Bitcoin server"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send commands to node running on <ip> (default: 127.0.0.1)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to console instead of debug.log file"),
QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to debugger"),
@@ -191,6 +193,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Specify data directory"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify pid file (default: bitcoind.pid)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify wallet file (within data directory)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specify your own public address"),
+QT_TRANSLATE_NOOP("bitcoin-core", "Start Bitcoin server"),
QT_TRANSLATE_NOOP("bitcoin-core", "System error: "),
QT_TRANSLATE_NOOP("bitcoin-core", "This help message"),
QT_TRANSLATE_NOOP("bitcoin-core", "Threshold for disconnecting misbehaving peers (default: 100)"),
@@ -202,6 +205,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Unable to bind to %s on this computer (bind r
QT_TRANSLATE_NOOP("bitcoin-core", "Unknown -socks proxy version requested: %i"),
QT_TRANSLATE_NOOP("bitcoin-core", "Unknown network specified in -onlynet: '%s'"),
QT_TRANSLATE_NOOP("bitcoin-core", "Upgrade wallet to latest format"),
+QT_TRANSLATE_NOOP("bitcoin-core", "Usage (deprecated, use bitcoin-cli):"),
QT_TRANSLATE_NOOP("bitcoin-core", "Usage:"),
QT_TRANSLATE_NOOP("bitcoin-core", "Use OpenSSL (https) for JSON-RPC connections"),
QT_TRANSLATE_NOOP("bitcoin-core", "Use UPnP to map the listening port (default: 0)"),
diff --git a/src/qt/bitcoinunits.cpp b/src/qt/bitcoinunits.cpp
index ae9791123d..2fed443cf2 100644
--- a/src/qt/bitcoinunits.cpp
+++ b/src/qt/bitcoinunits.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "bitcoinunits.h"
#include <QStringList>
diff --git a/src/qt/bitcoinunits.h b/src/qt/bitcoinunits.h
index f6fdf6c7be..3342eeec17 100644
--- a/src/qt/bitcoinunits.h
+++ b/src/qt/bitcoinunits.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef BITCOINUNITS_H
#define BITCOINUNITS_H
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 212fa6974a..872d714030 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "clientmodel.h"
#include "guiconstants.h"
diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h
index 925f20acd9..008320dcc3 100644
--- a/src/qt/clientmodel.h
+++ b/src/qt/clientmodel.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef CLIENTMODEL_H
#define CLIENTMODEL_H
diff --git a/src/qt/csvmodelwriter.cpp b/src/qt/csvmodelwriter.cpp
index ad8e0d618a..ac8c6b41d4 100644
--- a/src/qt/csvmodelwriter.cpp
+++ b/src/qt/csvmodelwriter.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "csvmodelwriter.h"
#include <QAbstractItemModel>
diff --git a/src/qt/csvmodelwriter.h b/src/qt/csvmodelwriter.h
index c4504ee91a..890deab092 100644
--- a/src/qt/csvmodelwriter.h
+++ b/src/qt/csvmodelwriter.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef CSVMODELWRITER_H
#define CSVMODELWRITER_H
diff --git a/src/qt/editaddressdialog.cpp b/src/qt/editaddressdialog.cpp
index 9abad7647c..618567218f 100644
--- a/src/qt/editaddressdialog.cpp
+++ b/src/qt/editaddressdialog.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "editaddressdialog.h"
#include "ui_editaddressdialog.h"
diff --git a/src/qt/editaddressdialog.h b/src/qt/editaddressdialog.h
index 44e5023d25..8746786162 100644
--- a/src/qt/editaddressdialog.h
+++ b/src/qt/editaddressdialog.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef EDITADDRESSDIALOG_H
#define EDITADDRESSDIALOG_H
diff --git a/src/qt/forms/receivecoinsdialog.ui b/src/qt/forms/receivecoinsdialog.ui
index e01a23b9c4..6d1a72ecd2 100644
--- a/src/qt/forms/receivecoinsdialog.ui
+++ b/src/qt/forms/receivecoinsdialog.ui
@@ -10,20 +10,17 @@
<height>343</height>
</rect>
</property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
- </property>
+ <layout class="QGridLayout" name="gridLayout">
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>&amp;Amount:</string>
</property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
<property name="buddy">
<cstring>reqAmount</cstring>
</property>
@@ -47,6 +44,9 @@
<property name="text">
<string>&amp;Label:</string>
</property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
<property name="buddy">
<cstring>reqLabel</cstring>
</property>
@@ -64,6 +64,9 @@
<property name="text">
<string>&amp;Message:</string>
</property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
<property name="buddy">
<cstring>reqMessage</cstring>
</property>
@@ -103,6 +106,19 @@
</layout>
</item>
<item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="clearButton">
@@ -113,7 +129,7 @@
</sizepolicy>
</property>
<property name="toolTip">
- <string>Remove all transaction fields</string>
+ <string>Clear all fields of the form.</string>
</property>
<property name="text">
<string>Clear</string>
diff --git a/src/qt/forms/receiverequestdialog.ui b/src/qt/forms/receiverequestdialog.ui
index d7724ef915..c9cb3de69f 100644
--- a/src/qt/forms/receiverequestdialog.ui
+++ b/src/qt/forms/receiverequestdialog.ui
@@ -10,9 +10,6 @@
<height>597</height>
</rect>
</property>
- <property name="windowTitle">
- <string>Request coins</string>
- </property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QRImageWidget" name="lblQRCode">
diff --git a/src/qt/forms/rpcconsole.ui b/src/qt/forms/rpcconsole.ui
index 54c41ffb67..c77c5a384c 100644
--- a/src/qt/forms/rpcconsole.ui
+++ b/src/qt/forms/rpcconsole.ui
@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
- <string>Bitcoin - Debug window</string>
+ <string>Debug window</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui
index 2a00fc5455..7547931ff1 100644
--- a/src/qt/forms/sendcoinsdialog.ui
+++ b/src/qt/forms/sendcoinsdialog.ui
@@ -29,7 +29,16 @@
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
- <property name="margin">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -84,7 +93,7 @@
</sizepolicy>
</property>
<property name="toolTip">
- <string>Remove all transaction fields</string>
+ <string>Clear all fields of the form.</string>
</property>
<property name="text">
<string>Clear &amp;All</string>
diff --git a/src/qt/forms/sendcoinsentry.ui b/src/qt/forms/sendcoinsentry.ui
index db742d633d..199a14598a 100644
--- a/src/qt/forms/sendcoinsentry.ui
+++ b/src/qt/forms/sendcoinsentry.ui
@@ -10,13 +10,19 @@
<height>150</height>
</rect>
</property>
+ <property name="focusPolicy">
+ <enum>Qt::TabFocus</enum>
+ </property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="currentIndex">
<number>0</number>
</property>
- <widget class="QFrame" name="SendCoinsInsecure">
+ <widget class="QFrame" name="SendCoins">
+ <property name="toolTip">
+ <string>This is a normal payment.</string>
+ </property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
@@ -143,7 +149,495 @@
</item>
</layout>
</widget>
- <widget class="QFrame" name="SendCoinsSecure">
+ <widget class="QFrame" name="SendCoins_InsecurePaymentRequest">
+ <property name="palette">
+ <palette>
+ <active>
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>191</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>127</red>
+ <green>127</green>
+ <blue>63</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>170</red>
+ <green>170</green>
+ <blue>84</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>191</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ToolTipBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>220</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ToolTipText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </active>
+ <inactive>
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>191</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>127</red>
+ <green>127</green>
+ <blue>63</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>170</red>
+ <green>170</green>
+ <blue>84</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>191</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ToolTipBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>220</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ToolTipText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </inactive>
+ <disabled>
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>127</red>
+ <green>127</green>
+ <blue>63</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>191</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>127</red>
+ <green>127</green>
+ <blue>63</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>170</red>
+ <green>170</green>
+ <blue>84</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>127</red>
+ <green>127</green>
+ <blue>63</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>127</red>
+ <green>127</green>
+ <blue>63</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>127</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ToolTipBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>220</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ToolTipText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </disabled>
+ </palette>
+ </property>
+ <property name="toolTip">
+ <string>This is an unverified payment request.</string>
+ </property>
+ <property name="autoFillBackground">
+ <bool>true</bool>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_is">
+ <property name="spacing">
+ <number>12</number>
+ </property>
+ <item row="4" column="0">
+ <widget class="QLabel" name="memoLabel_is">
+ <property name="text">
+ <string>Memo:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="amountLabel_is">
+ <property name="text">
+ <string>Amount:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="payToLabel_is">
+ <property name="text">
+ <string>Pay To:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="2">
+ <widget class="BitcoinAmountField" name="payAmount_is">
+ <property name="acceptDrops">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <layout class="QHBoxLayout" name="payToLayout_is">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="payTo_is"/>
+ </item>
+ </layout>
+ </item>
+ <item row="4" column="2">
+ <widget class="QLabel" name="memoTextLabel_is">
+ <property name="textFormat">
+ <enum>Qt::PlainText</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QFrame" name="SendCoins_SecurePaymentRequest">
<property name="palette">
<palette>
<active>
@@ -586,6 +1080,9 @@
</disabled>
</palette>
</property>
+ <property name="toolTip">
+ <string>This is a verified payment request.</string>
+ </property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
@@ -607,35 +1104,26 @@
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
- <property name="buddy">
- <cstring>addAsLabel</cstring>
- </property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="amountLabel_s">
<property name="text">
- <string>A&amp;mount:</string>
+ <string>Amount:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
- <property name="buddy">
- <cstring>payAmount_s</cstring>
- </property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="payToLabel_s">
<property name="text">
- <string>Pay &amp;To:</string>
+ <string>Pay To:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
- <property name="buddy">
- <cstring>payTo_s</cstring>
- </property>
</widget>
</item>
<item row="5" column="2">
diff --git a/src/qt/guiconstants.h b/src/qt/guiconstants.h
index 2c72c01021..6c9fa6a755 100644
--- a/src/qt/guiconstants.h
+++ b/src/qt/guiconstants.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef GUICONSTANTS_H
#define GUICONSTANTS_H
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index 9bb2fa7c99..eb50aa8edd 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "guiutil.h"
#include "bitcoinaddressvalidator.h"
@@ -223,10 +227,9 @@ void copyEntryData(QAbstractItemView *view, int column, int role)
}
}
-QString getSaveFileName(QWidget *parent, const QString &caption,
- const QString &dir,
- const QString &filter,
- QString *selectedSuffixOut)
+QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir,
+ const QString &filter,
+ QString *selectedSuffixOut)
{
QString selectedFilter;
QString myDir;
@@ -242,7 +245,8 @@ QString getSaveFileName(QWidget *parent, const QString &caption,
{
myDir = dir;
}
- QString result = QFileDialog::getSaveFileName(parent, caption, myDir, filter, &selectedFilter);
+ /* Directly convert path to native OS path separators */
+ QString result = QDir::toNativeSeparators(QFileDialog::getSaveFileName(parent, caption, myDir, filter, &selectedFilter));
/* Extract first suffix from filter pattern "Description (*.foo)" or "Description (*.foo *.bar ...) */
QRegExp filter_re(".* \\(\\*\\.(.*)[ \\)]");
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h
index 956f550989..3c9f137ded 100644
--- a/src/qt/guiutil.h
+++ b/src/qt/guiutil.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef GUIUTIL_H
#define GUIUTIL_H
diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp
index 4a02ff89e7..e7e7682258 100644
--- a/src/qt/intro.cpp
+++ b/src/qt/intro.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "intro.h"
#include "ui_intro.h"
#include "util.h"
@@ -177,8 +181,8 @@ void Intro::pickDataDirectory(bool fIsTestnet)
fs::create_directory(dataDir.toStdString());
break;
} catch(fs::filesystem_error &e) {
- QMessageBox::critical(0, QObject::tr("Bitcoin"),
- QObject::tr("Error: Specified data directory \"%1\" can not be created.").arg(dataDir));
+ QMessageBox::critical(0, tr("Bitcoin"),
+ tr("Error: Specified data directory \"%1\" can not be created.").arg(dataDir));
/* fall through, back to choosing screen */
}
}
diff --git a/src/qt/intro.h b/src/qt/intro.h
index 8b09847abd..b25d3f1152 100644
--- a/src/qt/intro.h
+++ b/src/qt/intro.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef INTRO_H
#define INTRO_H
diff --git a/src/qt/locale/bitcoin_en.ts b/src/qt/locale/bitcoin_en.ts
index 4d1a8574d0..0dc56ac5dc 100644
--- a/src/qt/locale/bitcoin_en.ts
+++ b/src/qt/locale/bitcoin_en.ts
@@ -42,12 +42,7 @@ This product includes software developed by the OpenSSL Project for use in the O
<context>
<name>AddressBookPage</name>
<message>
- <location filename="../forms/addressbookpage.ui" line="+14"/>
- <source>Address Book</source>
- <translation>Address Book</translation>
- </message>
- <message>
- <location line="+19"/>
+ <location filename="../forms/addressbookpage.ui" line="+30"/>
<source>Double-click to edit address or label</source>
<translation>Double-click to edit address or label</translation>
</message>
@@ -57,42 +52,32 @@ This product includes software developed by the OpenSSL Project for use in the O
<translation>Create a new address</translation>
</message>
<message>
- <location line="+14"/>
+ <location line="+3"/>
+ <source>&amp;New</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+11"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Copy the currently selected address to the system clipboard</translation>
</message>
<message>
- <location line="-11"/>
- <source>&amp;New Address</source>
- <translation>&amp;New Address</translation>
+ <location line="+3"/>
+ <source>&amp;Copy</source>
+ <translation type="unfinished"></translation>
</message>
<message>
- <location filename="../addressbookpage.cpp" line="+67"/>
- <source>These are your Bitcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
- <translation>These are your Bitcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</translation>
+ <location line="+52"/>
+ <source>C&amp;lose</source>
+ <translation type="unfinished"></translation>
</message>
<message>
- <location filename="../forms/addressbookpage.ui" line="+14"/>
+ <location filename="../addressbookpage.cpp" line="+72"/>
<source>&amp;Copy Address</source>
<translation>&amp;Copy Address</translation>
</message>
<message>
- <location line="+11"/>
- <source>Show &amp;QR Code</source>
- <translation>Show &amp;QR Code</translation>
- </message>
- <message>
- <location line="+11"/>
- <source>Sign a message to prove you own a Bitcoin address</source>
- <translation>Sign a message to prove you own a Bitcoin address</translation>
- </message>
- <message>
- <location line="+3"/>
- <source>Sign &amp;Message</source>
- <translation>Sign &amp;Message</translation>
- </message>
- <message>
- <location line="+25"/>
+ <location filename="../forms/addressbookpage.ui" line="-41"/>
<source>Delete the currently selected address from the list</source>
<translation>Delete the currently selected address from the list</translation>
</message>
@@ -107,27 +92,47 @@ This product includes software developed by the OpenSSL Project for use in the O
<translation>&amp;Export</translation>
</message>
<message>
- <location line="-44"/>
- <source>Verify a message to ensure it was signed with a specified Bitcoin address</source>
- <translation>Verify a message to ensure it was signed with a specified Bitcoin address</translation>
+ <location line="-27"/>
+ <source>&amp;Delete</source>
+ <translation>&amp;Delete</translation>
</message>
<message>
- <location line="+3"/>
- <source>&amp;Verify Message</source>
- <translation>&amp;Verify Message</translation>
+ <location filename="../addressbookpage.cpp" line="-30"/>
+ <source>Choose the address to send coins to</source>
+ <translation type="unfinished"></translation>
</message>
<message>
- <location line="+14"/>
- <source>&amp;Delete</source>
- <translation>&amp;Delete</translation>
+ <location line="+1"/>
+ <source>Choose the address to receive coins with</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+5"/>
+ <source>C&amp;hoose</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+6"/>
+ <source>Sending addresses</source>
+ <translation type="unfinished"></translation>
</message>
<message>
- <location filename="../addressbookpage.cpp" line="-5"/>
+ <location line="+1"/>
+ <source>Receiving addresses</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+7"/>
<source>These are your Bitcoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation>These are your Bitcoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</translation>
</message>
<message>
- <location line="+13"/>
+ <location line="+4"/>
+ <source>These are your Bitcoin addresses for receiving payments. It is recommended to use a new receiving address for each transaction.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+7"/>
<source>Copy &amp;Label</source>
<translation>Copy &amp;Label</translation>
</message>
@@ -137,14 +142,9 @@ This product includes software developed by the OpenSSL Project for use in the O
<translation>&amp;Edit</translation>
</message>
<message>
- <location line="+1"/>
- <source>Send &amp;Coins</source>
- <translation>Send &amp;Coins</translation>
- </message>
- <message>
- <location line="+265"/>
- <source>Export Address Book Data</source>
- <translation>Export Address Book Data</translation>
+ <location line="+197"/>
+ <source>Export Address List</source>
+ <translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
@@ -324,17 +324,17 @@ This product includes software developed by the OpenSSL Project for use in the O
<context>
<name>BitcoinGUI</name>
<message>
- <location filename="../bitcoingui.cpp" line="+255"/>
+ <location filename="../bitcoingui.cpp" line="+250"/>
<source>Sign &amp;message...</source>
<translation>Sign &amp;message...</translation>
</message>
<message>
- <location line="+246"/>
+ <location line="+254"/>
<source>Synchronizing with network...</source>
<translation>Synchronizing with network...</translation>
</message>
<message>
- <location line="-321"/>
+ <location line="-324"/>
<source>&amp;Overview</source>
<translation>&amp;Overview</translation>
</message>
@@ -354,17 +354,7 @@ This product includes software developed by the OpenSSL Project for use in the O
<translation>Browse transaction history</translation>
</message>
<message>
- <location line="+7"/>
- <source>Edit the list of stored addresses and labels</source>
- <translation>Edit the list of stored addresses and labels</translation>
- </message>
- <message>
- <location line="-14"/>
- <source>Show the list of addresses for receiving payments</source>
- <translation>Show the list of addresses for receiving payments</translation>
- </message>
- <message>
- <location line="+31"/>
+ <location line="+15"/>
<source>E&amp;xit</source>
<translation>E&amp;xit</translation>
</message>
@@ -379,12 +369,13 @@ This product includes software developed by the OpenSSL Project for use in the O
<translation>Show information about Bitcoin</translation>
</message>
<message>
+ <location line="+3"/>
<location line="+2"/>
<source>About &amp;Qt</source>
<translation>About &amp;Qt</translation>
</message>
<message>
- <location line="+1"/>
+ <location line="+2"/>
<source>Show information about Qt</source>
<translation>Show information about Qt</translation>
</message>
@@ -409,7 +400,7 @@ This product includes software developed by the OpenSSL Project for use in the O
<translation>&amp;Change Passphrase...</translation>
</message>
<message>
- <location line="+251"/>
+ <location line="+259"/>
<source>Importing blocks from disk...</source>
<translation>Importing blocks from disk...</translation>
</message>
@@ -419,12 +410,12 @@ This product includes software developed by the OpenSSL Project for use in the O
<translation>Reindexing blocks on disk...</translation>
</message>
<message>
- <location line="-319"/>
+ <location line="-322"/>
<source>Send coins to a Bitcoin address</source>
<translation>Send coins to a Bitcoin address</translation>
</message>
<message>
- <location line="+52"/>
+ <location line="+47"/>
<source>Modify configuration options for Bitcoin</source>
<translation>Modify configuration options for Bitcoin</translation>
</message>
@@ -454,20 +445,20 @@ This product includes software developed by the OpenSSL Project for use in the O
<translation>&amp;Verify message...</translation>
</message>
<message>
- <location line="-183"/>
+ <location line="-180"/>
<location line="+6"/>
- <location line="+508"/>
+ <location line="+513"/>
<source>Bitcoin</source>
<translation>Bitcoin</translation>
</message>
<message>
- <location line="-514"/>
+ <location line="-519"/>
<location line="+6"/>
<source>Wallet</source>
<translation>Wallet</translation>
</message>
<message>
- <location line="+107"/>
+ <location line="+109"/>
<source>&amp;Send</source>
<translation>&amp;Send</translation>
</message>
@@ -477,18 +468,13 @@ This product includes software developed by the OpenSSL Project for use in the O
<translation>&amp;Receive</translation>
</message>
<message>
- <location line="+14"/>
- <source>&amp;Addresses</source>
- <translation>&amp;Addresses</translation>
- </message>
- <message>
- <location line="+23"/>
+ <location line="+28"/>
<location line="+2"/>
<source>&amp;About Bitcoin</source>
<translation>&amp;About Bitcoin</translation>
</message>
<message>
- <location line="+10"/>
+ <location line="+14"/>
<location line="+2"/>
<source>&amp;Show / Hide</source>
<translation>&amp;Show / Hide</translation>
@@ -514,12 +500,12 @@ This product includes software developed by the OpenSSL Project for use in the O
<translation>Verify messages to ensure they were signed with specified Bitcoin addresses</translation>
</message>
<message>
- <location line="+28"/>
+ <location line="+35"/>
<source>&amp;File</source>
<translation>&amp;File</translation>
</message>
<message>
- <location line="+7"/>
+ <location line="+10"/>
<source>&amp;Settings</source>
<translation>&amp;Settings</translation>
</message>
@@ -534,19 +520,44 @@ This product includes software developed by the OpenSSL Project for use in the O
<translation>Tabs toolbar</translation>
</message>
<message>
- <location line="-228"/>
- <location line="+288"/>
+ <location line="-235"/>
+ <location line="+294"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
<message>
- <location line="-5"/>
+ <location line="-177"/>
+ <source>Request payments (generates QR codes and bitcoin: URIs)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+63"/>
+ <source>&amp;Used sending addresses...</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Show the list of used sending addresses and labels</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Used &amp;receiving addresses...</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Show the list of used receiving addresses and labels</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+106"/>
<location line="+5"/>
<source>Bitcoin client</source>
<translation>Bitcoin client</translation>
</message>
<message numerus="yes">
- <location line="+121"/>
+ <location line="+120"/>
<source>%n active connection(s) to Bitcoin network</source>
<translation>
<numerusform>%n active connection to Bitcoin network</numerusform>
@@ -608,7 +619,7 @@ This product includes software developed by the OpenSSL Project for use in the O
<translation>Transactions after this will not yet be visible.</translation>
</message>
<message>
- <location line="+22"/>
+ <location line="+27"/>
<source>Error</source>
<translation>Error</translation>
</message>
@@ -623,12 +634,12 @@ This product includes software developed by the OpenSSL Project for use in the O
<translation>Information</translation>
</message>
<message>
- <location line="+73"/>
+ <location line="+77"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</translation>
</message>
<message>
- <location line="-143"/>
+ <location line="-152"/>
<source>Up to date</source>
<translation>Up to date</translation>
</message>
@@ -638,7 +649,7 @@ This product includes software developed by the OpenSSL Project for use in the O
<translation>Catching up...</translation>
</message>
<message>
- <location line="+116"/>
+ <location line="+124"/>
<source>Confirm transaction fee</source>
<translation>Confirm transaction fee</translation>
</message>
@@ -676,13 +687,7 @@ Address: %4
<translation>URI can not be parsed! This can be caused by an invalid Bitcoin address or malformed URI parameters.</translation>
</message>
<message>
- <location line="+27"/>
- <location line="+2"/>
- <source>Payment acknowledged</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <location line="+17"/>
+ <location line="+45"/>
<source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source>
<translation>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</translation>
</message>
@@ -700,7 +705,7 @@ Address: %4
<context>
<name>ClientModel</name>
<message>
- <location filename="../clientmodel.cpp" line="+106"/>
+ <location filename="../clientmodel.cpp" line="+115"/>
<source>Network Alert</source>
<translation>Network Alert</translation>
</message>
@@ -719,18 +724,18 @@ Address: %4
</message>
<message>
<location line="+10"/>
- <source>The label associated with this address book entry</source>
- <translation>The label associated with this address book entry</translation>
+ <source>The label associated with this address list entry</source>
+ <translation type="unfinished"></translation>
</message>
<message>
- <location line="+7"/>
- <source>&amp;Address</source>
- <translation>&amp;Address</translation>
+ <location line="+17"/>
+ <source>The address associated with this address list entry. This can only be modified for sending addresses.</source>
+ <translation type="unfinished"></translation>
</message>
<message>
- <location line="+10"/>
- <source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
- <translation>The address associated with this address book entry. This can only be modified for sending addresses.</translation>
+ <location line="-10"/>
+ <source>&amp;Address</source>
+ <translation>&amp;Address</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
@@ -804,7 +809,7 @@ Address: %4
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
- <location filename="../guiutil.cpp" line="+525"/>
+ <location filename="../guiutil.cpp" line="+558"/>
<location line="+13"/>
<source>Bitcoin-Qt</source>
<translation>Bitcoin-Qt</translation>
@@ -1181,8 +1186,23 @@ Address: %4
<context>
<name>PaymentServer</name>
<message>
- <location filename="../paymentserver.cpp" line="+450"/>
- <location line="+41"/>
+ <location filename="../paymentserver.cpp" line="+392"/>
+ <source>URI handling</source>
+ <translation type="unfinished">URI handling</translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>URI can not be parsed! This can be caused by an invalid Bitcoin address or malformed URI parameters.</source>
+ <translation type="unfinished">URI can not be parsed! This can be caused by an invalid Bitcoin address or malformed URI parameters.</translation>
+ </message>
+ <message>
+ <location line="+69"/>
+ <source>Requested payment amount of %1 is too small (considered dust).</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+4"/>
+ <location line="+37"/>
<source>Payment request error</source>
<translation type="unfinished"></translation>
</message>
@@ -1193,12 +1213,27 @@ Address: %4
</message>
<message>
<location line="+38"/>
- <source>Refund from</source>
+ <source>Refund from %1</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+46"/>
- <location line="+28"/>
+ <location line="+42"/>
+ <source>Error communicating with %1: %2</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+31"/>
+ <source>Bad response from server %1</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+32"/>
+ <source>Payment acknowledged</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="-58"/>
+ <location line="+30"/>
<location line="+17"/>
<source>Network request error</source>
<translation type="unfinished"></translation>
@@ -1207,7 +1242,7 @@ Address: %4
<context>
<name>QObject</name>
<message>
- <location filename="../bitcoin.cpp" line="+111"/>
+ <location filename="../bitcoin.cpp" line="+114"/>
<location line="+5"/>
<location filename="../intro.cpp" line="-32"/>
<source>Bitcoin</source>
@@ -1228,78 +1263,28 @@ Address: %4
<source>Error: Specified data directory &quot;%1&quot; can not be created.</source>
<translation>Error: Specified data directory &quot;%1&quot; can not be created.</translation>
</message>
- <message>
- <location filename="../paymentserver.cpp" line="-175"/>
- <source>Requested payment amount (%1) too small</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <location line="+126"/>
- <source>Error communicating with %1: %2</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <location line="+29"/>
- <source>Bad response from server %1</source>
- <translation type="unfinished"></translation>
- </message>
</context>
<context>
- <name>QRCodeDialog</name>
- <message>
- <location filename="../forms/qrcodedialog.ui" line="+14"/>
- <source>QR Code Dialog</source>
- <translation>QR Code Dialog</translation>
- </message>
- <message>
- <location line="+59"/>
- <source>Request Payment</source>
- <translation>Request Payment</translation>
- </message>
- <message>
- <location line="+56"/>
- <source>Amount:</source>
- <translation>Amount:</translation>
- </message>
- <message>
- <location line="-44"/>
- <source>Label:</source>
- <translation>Label:</translation>
- </message>
+ <name>QRImageWidget</name>
<message>
- <location line="+19"/>
- <source>Message:</source>
- <translation>Message:</translation>
- </message>
- <message>
- <location line="+71"/>
- <source>&amp;Save As...</source>
- <translation>&amp;Save As...</translation>
- </message>
- <message>
- <location filename="../qrcodedialog.cpp" line="+64"/>
- <source>Error encoding URI into QR Code.</source>
- <translation>Error encoding URI into QR Code.</translation>
- </message>
- <message>
- <location line="+40"/>
- <source>The entered amount is invalid, please check.</source>
- <translation>The entered amount is invalid, please check.</translation>
+ <location filename="../receiverequestdialog.cpp" line="+32"/>
+ <source>&amp;Save Image...</source>
+ <translation type="unfinished"></translation>
</message>
<message>
- <location line="+23"/>
- <source>Resulting URI too long, try to reduce the text for label / message.</source>
- <translation>Resulting URI too long, try to reduce the text for label / message.</translation>
+ <location line="+3"/>
+ <source>&amp;Copy Image</source>
+ <translation type="unfinished"></translation>
</message>
<message>
- <location line="+25"/>
+ <location line="+28"/>
<source>Save QR Code</source>
- <translation>Save QR Code</translation>
+ <translation type="unfinished">Save QR Code</translation>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
- <translation>PNG Images (*.png)</translation>
+ <translation type="unfinished">PNG Images (*.png)</translation>
</message>
</context>
<context>
@@ -1319,7 +1304,7 @@ Address: %4
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
- <location filename="../rpcconsole.cpp" line="+345"/>
+ <location filename="../rpcconsole.cpp" line="+352"/>
<source>N/A</source>
<translation>N/A</translation>
</message>
@@ -1404,7 +1389,32 @@ Address: %4
<translation>&amp;Console</translation>
</message>
<message>
- <location line="-260"/>
+ <location line="+72"/>
+ <source>&amp;Network Traffic</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+52"/>
+ <source>&amp;Clear</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+13"/>
+ <source>Totals</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+64"/>
+ <source>In:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+80"/>
+ <source>Out:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="-541"/>
<source>Build date</source>
<translation>Build date</translation>
</message>
@@ -1448,20 +1458,184 @@ Address: %4
<source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source>
<translation>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</translation>
</message>
+ <message>
+ <location line="+128"/>
+ <source>%1 B</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+2"/>
+ <source>%1 KB</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+2"/>
+ <source>%1 MB</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+2"/>
+ <source>%1 GB</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+7"/>
+ <source>%1 m</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+5"/>
+ <source>%1 h</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+2"/>
+ <source>%1 h %2 m</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
- <name>SendCoinsDialog</name>
+ <name>ReceiveCoinsDialog</name>
+ <message>
+ <location filename="../forms/receivecoinsdialog.ui" line="+22"/>
+ <source>&amp;Amount:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+16"/>
+ <source>The amount to request</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+7"/>
+ <source>&amp;Label:</source>
+ <translation type="unfinished">&amp;Label:</translation>
+ </message>
+ <message>
+ <location line="+10"/>
+ <source>The label to associate with the receiving address</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+7"/>
+ <source>&amp;Message:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+10"/>
+ <source>The message to attach to payment request</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+14"/>
+ <source>Reuse one of the previously used receiving addresses. Reusing addresses has security and privacy issues. Do not use this unless re-generating a payment request made before.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>R&amp;euse an existing receiving address (not recommended)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+7"/>
+ <source>Use this form to request payments. All fields are optional.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+17"/>
+ <source>Clear all fields of the form.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+3"/>
+ <source>Clear</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+36"/>
+ <source>&amp;Request payment</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>ReceiveRequestDialog</name>
+ <message>
+ <location filename="../forms/receiverequestdialog.ui" line="+29"/>
+ <source>QR Code</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+46"/>
+ <source>Copy &amp;URI</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+7"/>
+ <source>Copy &amp;Address</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+7"/>
+ <source>&amp;Copy Image</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+7"/>
+ <source>&amp;Save Image...</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../receiverequestdialog.cpp" line="+58"/>
+ <source>Request payment to %1</source>
+ <translation type="unfinished"></translation>
+ </message>
<message>
- <location filename="../forms/sendcoinsdialog.ui" line="+14"/>
- <location filename="../sendcoinsdialog.cpp" line="+138"/>
- <location line="+5"/>
- <location line="+5"/>
- <location line="+5"/>
<location line="+6"/>
+ <source>Payment information</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>URI</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+2"/>
+ <source>Address</source>
+ <translation type="unfinished">Address</translation>
+ </message>
+ <message>
+ <location line="+2"/>
+ <source>Amount</source>
+ <translation type="unfinished">Amount</translation>
+ </message>
+ <message>
+ <location line="+2"/>
+ <source>Label</source>
+ <translation type="unfinished">Label</translation>
+ </message>
+ <message>
+ <location line="+2"/>
+ <source>Message</source>
+ <translation type="unfinished">Message</translation>
+ </message>
+ <message>
+ <location line="+10"/>
+ <source>Resulting URI too long, try to reduce the text for label / message.</source>
+ <translation type="unfinished">Resulting URI too long, try to reduce the text for label / message.</translation>
+ </message>
+ <message>
<location line="+5"/>
- <location line="+50"/>
- <location line="+145"/>
- <location line="+9"/>
+ <source>Error encoding URI into QR Code.</source>
+ <translation type="unfinished">Error encoding URI into QR Code.</translation>
+ </message>
+</context>
+<context>
+ <name>SendCoinsDialog</name>
+ <message>
+ <location filename="../forms/sendcoinsdialog.ui" line="+14"/>
+ <location filename="../sendcoinsdialog.cpp" line="+140"/>
+ <location line="+213"/>
<source>Send Coins</source>
<translation>Send Coins</translation>
</message>
@@ -1477,8 +1651,8 @@ Address: %4
</message>
<message>
<location line="+20"/>
- <source>Remove all transaction fields</source>
- <translation>Remove all transaction fields</translation>
+ <source>Clear all fields of the form.</source>
+ <translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
@@ -1506,47 +1680,44 @@ Address: %4
<translation>S&amp;end</translation>
</message>
<message>
- <location filename="../sendcoinsdialog.cpp" line="-170"/>
+ <location filename="../sendcoinsdialog.cpp" line="-154"/>
<source>Confirm send coins</source>
<translation>Confirm send coins</translation>
</message>
<message>
- <location line="-97"/>
- <source>to</source>
- <translation type="unfinished">to</translation>
- </message>
- <message>
- <location line="+15"/>
- <source>&lt;b&gt;%1&lt;/b&gt; to %2</source>
+ <location line="-90"/>
+ <location line="+5"/>
+ <location line="+5"/>
+ <source>%1 to %2</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+23"/>
+ <location line="+26"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>The recipient address is not valid, please recheck.</translation>
</message>
<message>
- <location line="+5"/>
+ <location line="+4"/>
<source>The amount to pay must be larger than 0.</source>
<translation>The amount to pay must be larger than 0.</translation>
</message>
<message>
- <location line="+5"/>
+ <location line="+4"/>
<source>The amount exceeds your balance.</source>
<translation>The amount exceeds your balance.</translation>
</message>
<message>
- <location line="+5"/>
+ <location line="+4"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>The total exceeds your balance when the %1 transaction fee is included.</translation>
</message>
<message>
- <location line="+6"/>
+ <location line="+5"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>Duplicate address found, can only send to each address once per send operation.</translation>
</message>
<message>
- <location line="+5"/>
+ <location line="+4"/>
<source>Error: Transaction creation failed!</source>
<translation>Error: Transaction creation failed!</translation>
</message>
@@ -1571,12 +1742,12 @@ Address: %4
<translation>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</translation>
</message>
<message>
- <location line="+145"/>
+ <location line="+144"/>
<source>Payment request expired</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+9"/>
+ <location line="+8"/>
<source>Invalid payment address %1</source>
<translation type="unfinished"></translation>
</message>
@@ -1584,49 +1755,38 @@ Address: %4
<context>
<name>SendCoinsEntry</name>
<message>
- <location filename="../forms/sendcoinsentry.ui" line="+24"/>
- <source>Form</source>
- <translation>Form</translation>
- </message>
- <message>
- <location line="+15"/>
- <location line="+588"/>
+ <location filename="../forms/sendcoinsentry.ui" line="+33"/>
+ <location line="+585"/>
<source>A&amp;mount:</source>
<translation>A&amp;mount:</translation>
</message>
<message>
- <location line="-575"/>
- <location line="+588"/>
+ <location line="-572"/>
+ <location line="+585"/>
<source>Pay &amp;To:</source>
<translation>Pay &amp;To:</translation>
</message>
<message>
- <location line="-554"/>
+ <location line="-551"/>
<source>The address to send the payment to (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source>
<translation>The address to send the payment to (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</translation>
</message>
<message>
- <location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+28"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>Enter a label for this address to add it to your address book</translation>
</message>
<message>
- <location line="-78"/>
+ <location filename="../forms/sendcoinsentry.ui" line="-18"/>
<source>&amp;Label:</source>
<translation>&amp;Label:</translation>
</message>
<message>
- <location line="-54"/>
- <source>StackedWidget</source>
+ <location line="+28"/>
+ <source>Choose previously used address</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+82"/>
- <source>Choose address from address book</source>
- <translation>Choose address from address book</translation>
- </message>
- <message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
@@ -1647,21 +1807,16 @@ Address: %4
<translation>Remove this recipient</translation>
</message>
<message>
- <location line="+466"/>
- <source>SecureSend</source>
+ <location line="+16"/>
+ <source>Enter a label for this address to add it to the list of used addresses</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+18"/>
+ <location line="+465"/>
<source>Memo:</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+63"/>
- <source>message from merchant</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source>
<translation>Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</translation>
@@ -1692,8 +1847,8 @@ Address: %4
<message>
<location line="+10"/>
<location line="+213"/>
- <source>Choose an address from the address book</source>
- <translation>Choose an address from the address book</translation>
+ <source>Choose previously used address</source>
+ <translation type="unfinished"></translation>
</message>
<message>
<location line="-203"/>
@@ -1874,6 +2029,14 @@ Address: %4
</message>
</context>
<context>
+ <name>TrafficGraphWidget</name>
+ <message>
+ <location filename="../trafficgraphwidget.cpp" line="+75"/>
+ <source>KB/s</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+22"/>
@@ -1952,12 +2115,12 @@ Address: %4
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
- <location line="+45"/>
+ <location line="+48"/>
<source>Credit</source>
<translation>Credit</translation>
</message>
<message numerus="yes">
- <location line="-117"/>
+ <location line="-120"/>
<source>matures in %n more block(s)</source>
<translation>
<numerusform>matures in %n more block</numerusform>
@@ -1973,12 +2136,12 @@ Address: %4
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
- <location line="+45"/>
+ <location line="+48"/>
<source>Debit</source>
<translation>Debit</translation>
</message>
<message>
- <location line="-54"/>
+ <location line="-57"/>
<source>Transaction fee</source>
<translation>Transaction fee</translation>
</message>
@@ -2008,12 +2171,12 @@ Address: %4
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+5"/>
- <source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to &quot;not accepted&quot; and it won&apos;t be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
- <translation>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to &quot;not accepted&quot; and it won&apos;t be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</translation>
+ <location line="+7"/>
+ <source>Generated coins must mature %1 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to &quot;not accepted&quot; and it won&apos;t be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
+ <translation type="unfinished"></translation>
</message>
<message>
- <location line="+7"/>
+ <location line="+8"/>
<source>Debug information</source>
<translation>Debug information</translation>
</message>
@@ -2043,7 +2206,7 @@ Address: %4
<translation>false</translation>
</message>
<message>
- <location line="-224"/>
+ <location line="-227"/>
<source>, has not been successfully broadcast yet</source>
<translation>, has not been successfully broadcast yet</translation>
</message>
@@ -2388,7 +2551,7 @@ Address: %4
<translation>Export the data in the current tab to a file</translation>
</message>
<message>
- <location line="+198"/>
+ <location line="+183"/>
<source>Backup Wallet</source>
<translation>Backup Wallet</translation>
</message>
@@ -2421,22 +2584,17 @@ Address: %4
<context>
<name>bitcoin-core</name>
<message>
- <location filename="../bitcoinstrings.cpp" line="+101"/>
+ <location filename="../bitcoinstrings.cpp" line="+102"/>
<source>Bitcoin version</source>
<translation>Bitcoin version</translation>
</message>
<message>
- <location line="+104"/>
+ <location line="+107"/>
<source>Usage:</source>
<translation>Usage:</translation>
</message>
<message>
- <location line="-30"/>
- <source>Send command to -server or bitcoind</source>
- <translation>Send command to -server or bitcoind</translation>
- </message>
- <message>
- <location line="-23"/>
+ <location line="-55"/>
<source>List commands</source>
<translation>List commands</translation>
</message>
@@ -2491,12 +2649,12 @@ Address: %4
<translation>Specify your own public address</translation>
</message>
<message>
- <location line="+3"/>
+ <location line="+4"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Threshold for disconnecting misbehaving peers (default: 100)</translation>
</message>
<message>
- <location line="-139"/>
+ <location line="-142"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</translation>
</message>
@@ -2516,17 +2674,17 @@ Address: %4
<translation>Accept command line and JSON-RPC commands</translation>
</message>
<message>
- <location line="+77"/>
+ <location line="+79"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Run in the background as a daemon and accept commands</translation>
</message>
<message>
- <location line="+38"/>
+ <location line="+40"/>
<source>Use the test network</source>
<translation>Use the test network</translation>
</message>
<message>
- <location line="-114"/>
+ <location line="-118"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>Accept connections from outside (default: 1 if no -proxy or -connect)</translation>
</message>
@@ -2556,7 +2714,12 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
</translation>
</message>
<message>
- <location line="+17"/>
+ <location line="+12"/>
+ <source>Acceptable ciphers (default: TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+5"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</translation>
</message>
@@ -2636,6 +2799,11 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Attempt to recover private keys from a corrupt wallet.dat</translation>
</message>
<message>
+ <location line="+1"/>
+ <source>Bitcoin RPC client version</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
<location line="+2"/>
<source>Block creation options:</source>
<translation>Block creation options:</translation>
@@ -2646,7 +2814,12 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Connect only to the specified node(s)</translation>
</message>
<message>
- <location line="+3"/>
+ <location line="+2"/>
+ <source>Connect to JSON-RPC on &lt;port&gt; (default: 8332 or testnet: 18332)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+2"/>
<source>Corrupted block database detected</source>
<translation>Corrupted block database detected</translation>
</message>
@@ -2776,7 +2949,12 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Incorrect or no genesis block found. Wrong datadir for network?</translation>
</message>
<message>
- <location line="+18"/>
+ <location line="+3"/>
+ <source>Invalid -onion address: &apos;%s&apos;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+15"/>
<source>Not enough file descriptors available.</source>
<translation>Not enough file descriptors available.</translation>
</message>
@@ -2786,7 +2964,12 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Rebuild block chain index from current blk000??.dat files</translation>
</message>
<message>
- <location line="+16"/>
+ <location line="+6"/>
+ <source>Send command to Bitcoin server</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+10"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation>Set the number of threads to service RPC calls (default: 4)</translation>
</message>
@@ -2796,7 +2979,17 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Specify wallet file (within data directory)</translation>
</message>
<message>
- <location line="+20"/>
+ <location line="+2"/>
+ <source>Start Bitcoin server</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+12"/>
+ <source>Usage (deprecated, use bitcoin-cli):</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+8"/>
<source>Verifying blocks...</source>
<translation>Verifying blocks...</translation>
</message>
@@ -2816,12 +3009,12 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>You need to rebuild the database using -reindex to change -txindex</translation>
</message>
<message>
- <location line="-76"/>
+ <location line="-78"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation>Imports blocks from external blk000??.dat file</translation>
</message>
<message>
- <location line="-96"/>
+ <location line="-98"/>
<source>Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)</source>
<translation>Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)</translation>
</message>
@@ -2831,17 +3024,12 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Set the number of script verification threads (up to 16, 0 = auto, &lt;0 = leave that many cores free, default: 0)</translation>
</message>
<message>
- <location line="+81"/>
+ <location line="+83"/>
<source>Information</source>
<translation>Information</translation>
</message>
<message>
- <location line="+3"/>
- <source>Invalid -tor address: &apos;%s&apos;</source>
- <translation>Invalid -tor address: &apos;%s&apos;</translation>
- </message>
- <message>
- <location line="+1"/>
+ <location line="+4"/>
<source>Invalid amount for -minrelaytxfee=&lt;amount&gt;: &apos;%s&apos;</source>
<translation>Invalid amount for -minrelaytxfee=&lt;amount&gt;: &apos;%s&apos;</translation>
</message>
@@ -2936,7 +3124,7 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Specify connection timeout in milliseconds (default: 5000)</translation>
</message>
<message>
- <location line="+5"/>
+ <location line="+6"/>
<source>System error: </source>
<translation>System error: </translation>
</message>
@@ -2956,7 +3144,7 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Transaction too large</translation>
</message>
<message>
- <location line="+7"/>
+ <location line="+8"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>Use UPnP to map the listening port (default: 0)</translation>
</message>
@@ -2991,32 +3179,32 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>wallet.dat corrupt, salvage failed</translation>
</message>
<message>
- <location line="-52"/>
+ <location line="-54"/>
<source>Password for JSON-RPC connections</source>
<translation>Password for JSON-RPC connections</translation>
</message>
<message>
- <location line="-68"/>
+ <location line="-70"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>Allow JSON-RPC connections from specified IP address</translation>
</message>
<message>
- <location line="+77"/>
+ <location line="+79"/>
<source>Send commands to node running on &lt;ip&gt; (default: 127.0.0.1)</source>
<translation>Send commands to node running on &lt;ip&gt; (default: 127.0.0.1)</translation>
</message>
<message>
- <location line="-124"/>
+ <location line="-126"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>Execute command when the best block changes (%s in cmd is replaced by block hash)</translation>
</message>
<message>
- <location line="+152"/>
+ <location line="+155"/>
<source>Upgrade wallet to latest format</source>
<translation>Upgrade wallet to latest format</translation>
</message>
<message>
- <location line="-22"/>
+ <location line="-23"/>
<source>Set key pool size to &lt;n&gt; (default: 100)</source>
<translation>Set key pool size to &lt;n&gt; (default: 100)</translation>
</message>
@@ -3026,12 +3214,12 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Rescan the block chain for missing wallet transactions</translation>
</message>
<message>
- <location line="+36"/>
+ <location line="+38"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>Use OpenSSL (https) for JSON-RPC connections</translation>
</message>
<message>
- <location line="-27"/>
+ <location line="-29"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Server certificate file (default: server.cert)</translation>
</message>
@@ -3041,12 +3229,7 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Server private key (default: server.pem)</translation>
</message>
<message>
- <location line="-159"/>
- <source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
- <translation>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation>
- </message>
- <message>
- <location line="+174"/>
+ <location line="+16"/>
<source>This help message</source>
<translation>This help message</translation>
</message>
@@ -3056,17 +3239,17 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Unable to bind to %s on this computer (bind returned error %d, %s)</translation>
</message>
<message>
- <location line="-93"/>
+ <location line="-95"/>
<source>Connect through socks proxy</source>
<translation>Connect through socks proxy</translation>
</message>
<message>
- <location line="-10"/>
+ <location line="-11"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Allow DNS lookups for -addnode, -seednode and -connect</translation>
</message>
<message>
- <location line="+56"/>
+ <location line="+58"/>
<source>Loading addresses...</source>
<translation>Loading addresses...</translation>
</message>
@@ -3081,17 +3264,17 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Error loading wallet.dat: Wallet requires newer version of Bitcoin</translation>
</message>
<message>
- <location line="+96"/>
+ <location line="+98"/>
<source>Wallet needed to be rewritten: restart Bitcoin to complete</source>
<translation>Wallet needed to be rewritten: restart Bitcoin to complete</translation>
</message>
<message>
- <location line="-98"/>
+ <location line="-100"/>
<source>Error loading wallet.dat</source>
<translation>Error loading wallet.dat</translation>
</message>
<message>
- <location line="+29"/>
+ <location line="+30"/>
<source>Invalid -proxy address: &apos;%s&apos;</source>
<translation>Invalid -proxy address: &apos;%s&apos;</translation>
</message>
@@ -3106,7 +3289,7 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Unknown -socks proxy version requested: %i</translation>
</message>
<message>
- <location line="-98"/>
+ <location line="-100"/>
<source>Cannot resolve -bind address: &apos;%s&apos;</source>
<translation>Cannot resolve -bind address: &apos;%s&apos;</translation>
</message>
@@ -3116,7 +3299,7 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Cannot resolve -externalip address: &apos;%s&apos;</translation>
</message>
<message>
- <location line="+45"/>
+ <location line="+46"/>
<source>Invalid amount for -paytxfee=&lt;amount&gt;: &apos;%s&apos;</source>
<translation>Invalid amount for -paytxfee=&lt;amount&gt;: &apos;%s&apos;</translation>
</message>
@@ -3136,7 +3319,7 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Loading block index...</translation>
</message>
<message>
- <location line="-58"/>
+ <location line="-60"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Add a node to connect to and attempt to keep the connection open</translation>
</message>
@@ -3146,7 +3329,7 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Unable to bind to %s on this computer. Bitcoin is probably already running.</translation>
</message>
<message>
- <location line="+67"/>
+ <location line="+69"/>
<source>Fee per KB to add to transactions you send</source>
<translation>Fee per KB to add to transactions you send</translation>
</message>
@@ -3156,7 +3339,7 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Loading wallet...</translation>
</message>
<message>
- <location line="-53"/>
+ <location line="-54"/>
<source>Cannot downgrade wallet</source>
<translation>Cannot downgrade wallet</translation>
</message>
@@ -3166,7 +3349,7 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Cannot write default address</translation>
</message>
<message>
- <location line="+65"/>
+ <location line="+66"/>
<source>Rescanning...</source>
<translation>Rescanning...</translation>
</message>
@@ -3176,17 +3359,17 @@ for example: alertnotify=echo %%s | mail -s &quot;Bitcoin Alert&quot; admin@foo.
<translation>Done loading</translation>
</message>
<message>
- <location line="+84"/>
+ <location line="+85"/>
<source>To use the %s option</source>
<translation>To use the %s option</translation>
</message>
<message>
- <location line="-76"/>
+ <location line="-77"/>
<source>Error</source>
<translation>Error</translation>
</message>
<message>
- <location line="-31"/>
+ <location line="-33"/>
<source>You must set rpcpassword=&lt;password&gt; in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
diff --git a/src/qt/macdockiconhandler.h b/src/qt/macdockiconhandler.h
index 765b004750..fba7305a60 100644
--- a/src/qt/macdockiconhandler.h
+++ b/src/qt/macdockiconhandler.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef MACDOCKICONHANDLER_H
#define MACDOCKICONHANDLER_H
diff --git a/src/qt/macnotificationhandler.h b/src/qt/macnotificationhandler.h
index cd8064c61c..257adde229 100644
--- a/src/qt/macnotificationhandler.h
+++ b/src/qt/macnotificationhandler.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef MACNOTIFICATIONHANDLER_H
#define MACNOTIFICATIONHANDLER_H
#include <QObject>
diff --git a/src/qt/monitoreddatamapper.cpp b/src/qt/monitoreddatamapper.cpp
index 4c201834cb..7abecbb12d 100644
--- a/src/qt/monitoreddatamapper.cpp
+++ b/src/qt/monitoreddatamapper.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "monitoreddatamapper.h"
#include <QWidget>
diff --git a/src/qt/monitoreddatamapper.h b/src/qt/monitoreddatamapper.h
index de55c86fcd..b3237d3e09 100644
--- a/src/qt/monitoreddatamapper.h
+++ b/src/qt/monitoreddatamapper.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef MONITOREDDATAMAPPER_H
#define MONITOREDDATAMAPPER_H
diff --git a/src/qt/notificator.cpp b/src/qt/notificator.cpp
index 903c54b39d..fcde23f7e4 100644
--- a/src/qt/notificator.cpp
+++ b/src/qt/notificator.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "notificator.h"
#include <QApplication>
diff --git a/src/qt/notificator.h b/src/qt/notificator.h
index 6c9a46bcf7..e00d08b9cb 100644
--- a/src/qt/notificator.h
+++ b/src/qt/notificator.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef NOTIFICATOR_H
#define NOTIFICATOR_H
diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp
index 7ccda6cdd4..85d49e6a20 100644
--- a/src/qt/optionsdialog.cpp
+++ b/src/qt/optionsdialog.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#if defined(HAVE_CONFIG_H)
#include "bitcoin-config.h"
#endif
diff --git a/src/qt/optionsdialog.h b/src/qt/optionsdialog.h
index d64ed0b57f..fea5c6d2fb 100644
--- a/src/qt/optionsdialog.h
+++ b/src/qt/optionsdialog.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef OPTIONSDIALOG_H
#define OPTIONSDIALOG_H
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp
index 95efc58320..48bf357abb 100644
--- a/src/qt/optionsmodel.cpp
+++ b/src/qt/optionsmodel.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#if defined(HAVE_CONFIG_H)
#include "bitcoin-config.h"
#endif
@@ -6,6 +10,9 @@
#include "bitcoinunits.h"
#include "init.h"
+#include "core.h"
+#include "wallet.h"
+#include "netbase.h"
#include "walletdb.h"
#include "guiutil.h"
diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h
index 173db0fe0a..2d41cf889d 100644
--- a/src/qt/optionsmodel.h
+++ b/src/qt/optionsmodel.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef OPTIONSMODEL_H
#define OPTIONSMODEL_H
diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp
index ddd8891335..d60ff194c1 100644
--- a/src/qt/overviewpage.cpp
+++ b/src/qt/overviewpage.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "overviewpage.h"
#include "ui_overviewpage.h"
diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h
index 59ba3c66bb..f662242836 100644
--- a/src/qt/overviewpage.h
+++ b/src/qt/overviewpage.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef OVERVIEWPAGE_H
#define OVERVIEWPAGE_H
diff --git a/src/qt/paymentrequestplus.cpp b/src/qt/paymentrequestplus.cpp
index f6a898ff7c..c1476a4d5f 100644
--- a/src/qt/paymentrequestplus.cpp
+++ b/src/qt/paymentrequestplus.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
//
// Wraps dumb protocol buffer paymentRequest
// with some extra methods
@@ -75,8 +79,7 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c
digestAlgorithm = EVP_sha1();
}
else if (paymentRequest.pki_type() == "none") {
- if (fDebug)
- qDebug() << "PaymentRequestPlus::getMerchant : Payment request: pki_type == none";
+ qDebug() << "PaymentRequestPlus::getMerchant : Payment request: pki_type == none";
return false;
}
else {
diff --git a/src/qt/paymentrequestplus.h b/src/qt/paymentrequestplus.h
index 846d256aca..04848ec4ba 100644
--- a/src/qt/paymentrequestplus.h
+++ b/src/qt/paymentrequestplus.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef PAYMENTREQUESTPLUS_H
#define PAYMENTREQUESTPLUS_H
diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp
index 43c4bdd191..87db4bbf34 100644
--- a/src/qt/paymentserver.cpp
+++ b/src/qt/paymentserver.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2009-2013 The Bitcoin developers
+// Copyright (c) 2011-2013 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -87,9 +87,7 @@ static QList<QString> savedPaymentRequests;
static void ReportInvalidCertificate(const QSslCertificate& cert)
{
- if (fDebug) {
- qDebug() << "ReportInvalidCertificate : Payment server found an invalid certificate: " << cert.subjectInfo(QSslCertificate::CommonName);
- }
+ qDebug() << "ReportInvalidCertificate : Payment server found an invalid certificate: " << cert.subjectInfo(QSslCertificate::CommonName);
}
//
@@ -160,8 +158,7 @@ void PaymentServer::LoadRootCAs(X509_STORE* _store)
continue;
}
}
- if (fDebug)
- qDebug() << "PaymentServer::LoadRootCAs : Loaded " << nRootCerts << " root certificates";
+ qDebug() << "PaymentServer::LoadRootCAs : Loaded " << nRootCerts << " root certificates";
// Project for another day:
// Fetch certificate revocation lists, and add them to certStore.
@@ -283,9 +280,6 @@ PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) :
connect(this, SIGNAL(receivedPaymentACK(QString)), this, SLOT(handlePaymentACK(QString)));
}
}
-
- // netManager is null until uiReady() is called
- netManager = NULL;
}
PaymentServer::~PaymentServer()
@@ -375,13 +369,13 @@ void PaymentServer::handleURIOrFile(const QString& s)
QString decoded = QUrl::fromPercentEncoding(temp);
QUrl fetchUrl(decoded, QUrl::StrictMode);
- if (fDebug)
- qDebug() << "PaymentServer::handleURIOrFile : fetchRequest(" << fetchUrl << ")";
+ qDebug() << "PaymentServer::handleURIOrFile : fetchRequest(" << fetchUrl << ")";
if (fetchUrl.isValid())
fetchRequest(fetchUrl);
else
qDebug() << "PaymentServer::handleURIOrFile : Invalid URL: " << fetchUrl;
+
return;
}
@@ -392,18 +386,17 @@ void PaymentServer::handleURIOrFile(const QString& s)
emit message(tr("URI handling"),
tr("URI can not be parsed! This can be caused by an invalid Bitcoin address or malformed URI parameters."),
CClientUIInterface::ICON_WARNING);
+
return;
}
if (QFile::exists(s))
{
PaymentRequestPlus request;
- QList<SendCoinsRecipient> recipients;
- if (readPaymentRequest(s, request) && processPaymentRequest(request, recipients)) {
- foreach (const SendCoinsRecipient& recipient, recipients){
- emit receivedPaymentRequest(recipient);
- }
- }
+ SendCoinsRecipient recipient;
+ if (readPaymentRequest(s, request) && processPaymentRequest(request, recipient))
+ emit receivedPaymentRequest(recipient);
+
return;
}
}
@@ -449,14 +442,37 @@ bool PaymentServer::readPaymentRequest(const QString& filename, PaymentRequestPl
return request.parse(data);
}
-bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, QList<SendCoinsRecipient>& recipients)
+bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, SendCoinsRecipient& recipient)
{
if (!optionsModel)
return false;
- QList<std::pair<CScript,qint64> > sendingTos = request.getPayTo();
- qint64 totalAmount = 0;
+ recipient.paymentRequest = request;
+ recipient.message = GUIUtil::HtmlEscape(request.getDetails().memo());
+
+ request.getMerchant(PaymentServer::certStore, recipient.authenticatedMerchant);
+
+ QList<std::pair<CScript, qint64> > sendingTos = request.getPayTo();
+ QStringList addresses;
+
foreach(const PAIRTYPE(CScript, qint64)& sendingTo, sendingTos) {
+ // Extract and check destination addresses
+ CTxDestination dest;
+ if (ExtractDestination(sendingTo.first, dest)) {
+ // Append destination address
+ addresses.append(QString::fromStdString(CBitcoinAddress(dest).ToString()));
+ }
+ else if (!recipient.authenticatedMerchant.isEmpty()){
+ // Insecure payments to custom bitcoin addresses are not supported
+ // (there is no good way to tell the user where they are paying in a way
+ // they'd have a chance of understanding).
+ emit message(tr("Payment request error"),
+ tr("Unverified payment requests to custom payment scripts are unsupported."),
+ CClientUIInterface::MSG_ERROR);
+ return false;
+ }
+
+ // Extract and check amounts
CTxOut txOut(sendingTo.second, sendingTo.first);
if (txOut.IsDust(CTransaction::nMinRelayTxFee)) {
QString msg = tr("Requested payment amount of %1 is too small (considered dust).")
@@ -467,45 +483,16 @@ bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, QList<Sen
return false;
}
- totalAmount += sendingTo.second;
+ recipient.amount += sendingTo.second;
}
+ // Store addresses and format them to fit nicely into the GUI
+ recipient.address = addresses.join("<br />");
- recipients.append(SendCoinsRecipient());
-
- if (request.getMerchant(PaymentServer::certStore, recipients[0].authenticatedMerchant)) {
- recipients[0].paymentRequest = request;
- recipients[0].amount = totalAmount;
- if (fDebug)
- qDebug() << "PaymentServer::processPaymentRequest : Payment request from " << recipients[0].authenticatedMerchant;
+ if (!recipient.authenticatedMerchant.isEmpty()) {
+ qDebug() << "PaymentServer::processPaymentRequest : Secure payment request from " << recipient.authenticatedMerchant;
}
else {
- recipients.clear();
- // Insecure payment requests may turn into more than one recipient if
- // the merchant is requesting payment to more than one address.
- for (int i = 0; i < sendingTos.size(); i++) {
- std::pair<CScript, qint64>& sendingTo = sendingTos[i];
- recipients.append(SendCoinsRecipient());
- recipients[i].amount = sendingTo.second;
- QString memo = QString::fromStdString(request.getDetails().memo());
- recipients[i].label = GUIUtil::HtmlEscape(memo);
- CTxDestination dest;
- if (ExtractDestination(sendingTo.first, dest)) {
- if (i == 0) // Tie request to first pay-to, we don't want multiple ACKs
- recipients[i].paymentRequest = request;
- recipients[i].address = QString::fromStdString(CBitcoinAddress(dest).ToString());
- if (fDebug)
- qDebug() << "PaymentServer::processPaymentRequest : Payment request, insecure " << recipients[i].address;
- }
- else {
- // Insecure payments to custom bitcoin addresses are not supported
- // (there is no good way to tell the user where they are paying in a way
- // they'd have a chance of understanding).
- emit message(tr("Payment request error"),
- tr("Insecure requests to custom payment scripts unsupported"),
- CClientUIInterface::MSG_ERROR);
- return false;
- }
- }
+ qDebug() << "PaymentServer::processPaymentRequest : Insecure payment request to " << addresses.join(", ");
}
return true;
@@ -596,12 +583,9 @@ void PaymentServer::netRequestFinished(QNetworkReply* reply)
if (requestType == "PaymentRequest")
{
PaymentRequestPlus request;
- QList<SendCoinsRecipient> recipients;
- if (request.parse(data) && processPaymentRequest(request, recipients)) {
- foreach (const SendCoinsRecipient& recipient, recipients) {
- emit receivedPaymentRequest(recipient);
- }
- }
+ SendCoinsRecipient recipient;
+ if (request.parse(data) && processPaymentRequest(request, recipient))
+ emit receivedPaymentRequest(recipient);
else
qDebug() << "PaymentServer::netRequestFinished : Error processing payment request";
diff --git a/src/qt/paymentserver.h b/src/qt/paymentserver.h
index 9f43571edc..76cdb819d7 100644
--- a/src/qt/paymentserver.h
+++ b/src/qt/paymentserver.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef PAYMENTSERVER_H
#define PAYMENTSERVER_H
@@ -109,7 +113,7 @@ private slots:
private:
static bool readPaymentRequest(const QString& filename, PaymentRequestPlus& request);
- bool processPaymentRequest(PaymentRequestPlus& request, QList<SendCoinsRecipient>& recipients);
+ bool processPaymentRequest(PaymentRequestPlus& request, SendCoinsRecipient& recipient);
void handleURIOrFile(const QString& s);
void fetchRequest(const QUrl& url);
diff --git a/src/qt/qvalidatedlineedit.cpp b/src/qt/qvalidatedlineedit.cpp
index 8ca230c9d7..1e7596c9c1 100644
--- a/src/qt/qvalidatedlineedit.cpp
+++ b/src/qt/qvalidatedlineedit.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "qvalidatedlineedit.h"
#include "guiconstants.h"
diff --git a/src/qt/qvalidatedlineedit.h b/src/qt/qvalidatedlineedit.h
index ec74633c02..53ef04e4a0 100644
--- a/src/qt/qvalidatedlineedit.h
+++ b/src/qt/qvalidatedlineedit.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef QVALIDATEDLINEEDIT_H
#define QVALIDATEDLINEEDIT_H
diff --git a/src/qt/qvaluecombobox.cpp b/src/qt/qvaluecombobox.cpp
index d7ce3d0130..ad083f6357 100644
--- a/src/qt/qvaluecombobox.cpp
+++ b/src/qt/qvaluecombobox.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "qvaluecombobox.h"
QValueComboBox::QValueComboBox(QWidget *parent) :
diff --git a/src/qt/qvaluecombobox.h b/src/qt/qvaluecombobox.h
index 64a7da9df5..5f2182913c 100644
--- a/src/qt/qvaluecombobox.h
+++ b/src/qt/qvaluecombobox.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef QVALUECOMBOBOX_H
#define QVALUECOMBOBOX_H
diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp
index f3ab343fea..45b2325299 100644
--- a/src/qt/receivecoinsdialog.cpp
+++ b/src/qt/receivecoinsdialog.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "receivecoinsdialog.h"
#include "ui_receivecoinsdialog.h"
diff --git a/src/qt/receivecoinsdialog.h b/src/qt/receivecoinsdialog.h
index 8d12e55afe..9980edd1f5 100644
--- a/src/qt/receivecoinsdialog.h
+++ b/src/qt/receivecoinsdialog.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef RECEIVECOINSDIALOG_H
#define RECEIVECOINSDIALOG_H
diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp
index 896acfd233..ad3abb1845 100644
--- a/src/qt/receiverequestdialog.cpp
+++ b/src/qt/receiverequestdialog.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "receiverequestdialog.h"
#include "ui_receiverequestdialog.h"
diff --git a/src/qt/receiverequestdialog.h b/src/qt/receiverequestdialog.h
index 1beb873dfd..295a73031d 100644
--- a/src/qt/receiverequestdialog.h
+++ b/src/qt/receiverequestdialog.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef QRCODEDIALOG_H
#define QRCODEDIALOG_H
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index e7dcdf62a1..05bc460ab0 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "rpcconsole.h"
#include "ui_rpcconsole.h"
@@ -201,6 +205,7 @@ RPCConsole::RPCConsole(QWidget *parent) :
ui->messagesWidget->installEventFilter(this);
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
+ connect(ui->btnClearTrafficGraph, SIGNAL(clicked()), ui->trafficGraph, SLOT(clear()));
// set OpenSSL version label
ui->openSSLVersion->setText(SSLeay_version(SSLEAY_VERSION));
@@ -313,7 +318,7 @@ void RPCConsole::clear()
ui->messagesWidget->document()->setDefaultStyleSheet(
"table { }"
"td.time { color: #808080; padding-top: 3px; } "
- "td.message { font-family: Monospace; font-size: 12px; } "
+ "td.message { font-family: monospace; font-size: 12px; } " // Todo: Remove fixed font-size
"td.cmd-request { color: #006060; } "
"td.cmd-error { color: red; } "
"b { color: #006060; } "
@@ -479,8 +484,3 @@ void RPCConsole::updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut)
ui->lblBytesIn->setText(FormatBytes(totalBytesIn));
ui->lblBytesOut->setText(FormatBytes(totalBytesOut));
}
-
-void RPCConsole::on_btnClearTrafficGraph_clicked()
-{
- ui->trafficGraph->clear();
-}
diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h
index af92b55770..076575fa3d 100644
--- a/src/qt/rpcconsole.h
+++ b/src/qt/rpcconsole.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef RPCCONSOLE_H
#define RPCCONSOLE_H
@@ -41,8 +45,6 @@ private slots:
void on_sldGraphRange_valueChanged(int value);
/** update traffic statistics */
void updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut);
- /** clear traffic graph */
- void on_btnClearTrafficGraph_clicked();
public slots:
void clear();
@@ -55,6 +57,7 @@ public slots:
void browseHistory(int offset);
/** Scroll console view to end */
void scrollToEnd();
+
signals:
// For RPC command executor
void stopExecutor();
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp
index 3fd4a26e76..2490c64835 100644
--- a/src/qt/sendcoinsdialog.cpp
+++ b/src/qt/sendcoinsdialog.cpp
@@ -1,14 +1,17 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "sendcoinsdialog.h"
#include "ui_sendcoinsdialog.h"
-#include "walletmodel.h"
#include "bitcoinunits.h"
-#include "addressbookpage.h"
#include "optionsmodel.h"
#include "sendcoinsentry.h"
#include "guiutil.h"
#include "askpassphrasedialog.h"
#include "base58.h"
+#include "ui_interface.h"
#include <QMessageBox>
#include <QTextDocument>
@@ -103,7 +106,7 @@ void SendCoinsDialog::on_sendButton_clicked()
QString recipientElement;
- if (rcp.authenticatedMerchant.isEmpty())
+ if (!rcp.paymentRequest.IsInitialized()) // normal payment
{
if(rcp.label.length() > 0) // label with address
{
@@ -115,10 +118,14 @@ void SendCoinsDialog::on_sendButton_clicked()
recipientElement = tr("%1 to %2").arg(amount, address);
}
}
- else // just merchant
+ else if(!rcp.authenticatedMerchant.isEmpty()) // secure payment request
{
recipientElement = tr("%1 to %2").arg(amount, GUIUtil::HtmlEscape(rcp.authenticatedMerchant));
}
+ else // insecure payment request
+ {
+ recipientElement = tr("%1 to %2").arg(amount, address);
+ }
formatted.append(recipientElement);
}
@@ -137,41 +144,9 @@ void SendCoinsDialog::on_sendButton_clicked()
// prepare transaction for getting txFee earlier
WalletModelTransaction currentTransaction(recipients);
WalletModel::SendCoinsReturn prepareStatus = model->prepareTransaction(currentTransaction);
-
- QString strSendCoins = tr("Send Coins");
- switch(prepareStatus.status)
- {
- case WalletModel::InvalidAddress:
- QMessageBox::warning(this, strSendCoins,
- tr("The recipient address is not valid, please recheck."));
- break;
- case WalletModel::InvalidAmount:
- QMessageBox::warning(this, strSendCoins,
- tr("The amount to pay must be larger than 0."));
- break;
- case WalletModel::AmountExceedsBalance:
- QMessageBox::warning(this, strSendCoins,
- tr("The amount exceeds your balance."));
- break;
- case WalletModel::AmountWithFeeExceedsBalance:
- QMessageBox::warning(this, strSendCoins,
- tr("The total exceeds your balance when the %1 transaction fee is included.").
- arg(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), currentTransaction.getTransactionFee())));
- break;
- case WalletModel::DuplicateAddress:
- QMessageBox::warning(this, strSendCoins,
- tr("Duplicate address found, can only send to each address once per send operation."));
- break;
- case WalletModel::TransactionCreationFailed:
- QMessageBox::warning(this, strSendCoins,
- tr("Error: Transaction creation failed!"));
- break;
- case WalletModel::TransactionCommitFailed:
- case WalletModel::OK:
- case WalletModel::Aborted: // User aborted, nothing to do
- default:
- break;
- }
+ // process prepareStatus and on error generate message shown to user
+ processSendCoinsReturn(prepareStatus,
+ BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), currentTransaction.getTransactionFee()));
if(prepareStatus.status != WalletModel::OK) {
fNewRecipientAllowed = true;
@@ -209,19 +184,13 @@ void SendCoinsDialog::on_sendButton_clicked()
}
// now send the prepared transaction
- WalletModel::SendCoinsReturn sendstatus = model->sendCoins(currentTransaction);
- switch(sendstatus.status)
+ WalletModel::SendCoinsReturn sendStatus = model->sendCoins(currentTransaction);
+ // process sendStatus and on error generate message shown to user
+ processSendCoinsReturn(sendStatus);
+
+ if (sendStatus.status == WalletModel::OK)
{
- case WalletModel::TransactionCommitFailed:
- QMessageBox::warning(this, strSendCoins,
- tr("Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."));
- break;
- case WalletModel::OK:
accept();
- break;
- case WalletModel::Aborted: // User aborted, nothing to do
- default:
- break;
}
fNewRecipientAllowed = true;
}
@@ -352,21 +321,21 @@ void SendCoinsDialog::pasteEntry(const SendCoinsRecipient &rv)
bool SendCoinsDialog::handlePaymentRequest(const SendCoinsRecipient &rv)
{
QString strSendCoins = tr("Send Coins");
- if (!rv.authenticatedMerchant.isEmpty()) {
+ if (rv.paymentRequest.IsInitialized()) {
// Expired payment request?
const payments::PaymentDetails& details = rv.paymentRequest.getDetails();
if (details.has_expires() && (int64)details.expires() < GetTime())
{
- QMessageBox::warning(this, strSendCoins,
- tr("Payment request expired"));
+ emit message(strSendCoins, tr("Payment request expired"),
+ CClientUIInterface::MSG_WARNING);
return false;
}
}
else {
CBitcoinAddress address(rv.address.toStdString());
if (!address.IsValid()) {
- QMessageBox::warning(this, strSendCoins,
- tr("Invalid payment address %1").arg(rv.address));
+ emit message(strSendCoins, tr("Invalid payment address %1").arg(rv.address),
+ CClientUIInterface::MSG_WARNING);
return false;
}
}
@@ -390,3 +359,47 @@ void SendCoinsDialog::updateDisplayUnit()
{
setBalance(model->getBalance(), 0, 0);
}
+
+void SendCoinsDialog::processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg)
+{
+ QPair<QString, CClientUIInterface::MessageBoxFlags> msgParams;
+ // Default to a warning message, override if error message is needed
+ msgParams.second = CClientUIInterface::MSG_WARNING;
+
+ // This comment is specific to SendCoinsDialog usage of WalletModel::SendCoinsReturn.
+ // WalletModel::TransactionCommitFailed is used only in WalletModel::sendCoins()
+ // all others are used only in WalletModel::prepareTransaction()
+ switch(sendCoinsReturn.status)
+ {
+ case WalletModel::InvalidAddress:
+ msgParams.first = tr("The recipient address is not valid, please recheck.");
+ break;
+ case WalletModel::InvalidAmount:
+ msgParams.first = tr("The amount to pay must be larger than 0.");
+ break;
+ case WalletModel::AmountExceedsBalance:
+ msgParams.first = tr("The amount exceeds your balance.");
+ break;
+ case WalletModel::AmountWithFeeExceedsBalance:
+ msgParams.first = tr("The total exceeds your balance when the %1 transaction fee is included.").arg(msgArg);
+ break;
+ case WalletModel::DuplicateAddress:
+ msgParams.first = tr("Duplicate address found, can only send to each address once per send operation.");
+ break;
+ case WalletModel::TransactionCreationFailed:
+ msgParams.first = tr("Transaction creation failed!");
+ msgParams.second = CClientUIInterface::MSG_ERROR;
+ break;
+ case WalletModel::TransactionCommitFailed:
+ msgParams.first = tr("The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.");
+ msgParams.second = CClientUIInterface::MSG_ERROR;
+ break;
+ // OK and Aborted are included to prevent a compiler warning.
+ case WalletModel::OK:
+ case WalletModel::Aborted:
+ default:
+ return;
+ }
+
+ emit message(tr("Send Coins"), msgParams.first, msgParams.second);
+}
diff --git a/src/qt/sendcoinsdialog.h b/src/qt/sendcoinsdialog.h
index b295b7d837..dcb1f2972f 100644
--- a/src/qt/sendcoinsdialog.h
+++ b/src/qt/sendcoinsdialog.h
@@ -1,16 +1,21 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef SENDCOINSDIALOG_H
#define SENDCOINSDIALOG_H
+#include "walletmodel.h"
+
#include <QDialog>
#include <QVariant>
+#include <QPair>
namespace Ui {
class SendCoinsDialog;
}
-class WalletModel;
class SendCoinsEntry;
class SendCoinsRecipient;
-class OptionsModel;
QT_BEGIN_NAMESPACE
class QUrl;
@@ -48,6 +53,11 @@ private:
WalletModel *model;
bool fNewRecipientAllowed;
+ // Process WalletModel::SendCoinsReturn and generate a pair consisting
+ // of a message and message flags for use in emit message().
+ // Additional parameter msgArg can be used via .arg(msgArg).
+ void processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg = QString());
+
private slots:
void on_sendButton_clicked();
void removeEntry(SendCoinsEntry* entry);
diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp
index 2d42ecb568..490b9caf5e 100644
--- a/src/qt/sendcoinsentry.cpp
+++ b/src/qt/sendcoinsentry.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "sendcoinsentry.h"
#include "ui_sendcoinsentry.h"
@@ -18,7 +22,7 @@ SendCoinsEntry::SendCoinsEntry(QWidget *parent) :
{
ui->setupUi(this);
- setCurrentWidget(ui->SendCoinsInsecure);
+ setCurrentWidget(ui->SendCoins);
#ifdef Q_OS_MAC
ui->payToLayout->setSpacing(4);
@@ -28,10 +32,12 @@ SendCoinsEntry::SendCoinsEntry(QWidget *parent) :
ui->addAsLabel->setPlaceholderText(tr("Enter a label for this address to add it to your address book"));
ui->payTo->setPlaceholderText(tr("Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)"));
#endif
- setFocusPolicy(Qt::TabFocus);
setFocusProxy(ui->payTo);
+ // normal bitcoin address field
GUIUtil::setupAddressWidget(ui->payTo, this);
+ // just a label for displaying bitcoin address(es)
+ ui->payTo_is->setFont(GUIUtil::bitcoinAddressFont());
}
SendCoinsEntry::~SendCoinsEntry()
@@ -67,7 +73,7 @@ void SendCoinsEntry::setModel(WalletModel *model)
{
this->model = model;
- if(model && model->getOptionsModel())
+ if (model && model->getOptionsModel())
connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
clear();
@@ -80,11 +86,15 @@ void SendCoinsEntry::setRemoveEnabled(bool enabled)
void SendCoinsEntry::clear()
{
- // clear UI elements for insecure payments
+ // clear UI elements for normal payment
ui->payTo->clear();
ui->addAsLabel->clear();
ui->payAmount->clear();
- // and the ones for secure payments just to be sure
+ // clear UI elements for insecure payment request
+ ui->payTo_is->clear();
+ ui->memoTextLabel_is->clear();
+ ui->payAmount_is->clear();
+ // clear UI elements for secure payment request
ui->payTo_s->clear();
ui->memoTextLabel_s->clear();
ui->payAmount_s->clear();
@@ -102,20 +112,23 @@ void SendCoinsEntry::on_deleteButton_clicked()
bool SendCoinsEntry::validate()
{
+ if (!model)
+ return false;
+
// Check input validity
bool retval = true;
- if (!recipient.authenticatedMerchant.isEmpty())
+ // Skip checks for payment request
+ if (recipient.paymentRequest.IsInitialized())
return retval;
- if (!ui->payTo->hasAcceptableInput() ||
- (model && !model->validateAddress(ui->payTo->text())))
+ if (!ui->payTo->hasAcceptableInput() || !model->validateAddress(ui->payTo->text()))
{
ui->payTo->setValid(false);
retval = false;
}
- if(!ui->payAmount->validate())
+ if (!ui->payAmount->validate())
{
retval = false;
}
@@ -131,10 +144,11 @@ bool SendCoinsEntry::validate()
SendCoinsRecipient SendCoinsEntry::getValue()
{
- if (!recipient.authenticatedMerchant.isEmpty())
+ // Payment request
+ if (recipient.paymentRequest.IsInitialized())
return recipient;
- // User-entered or non-authenticated:
+ // Normal payment
recipient.address = ui->payTo->text();
recipient.label = ui->addAsLabel->text();
recipient.amount = ui->payAmount->value();
@@ -156,22 +170,31 @@ void SendCoinsEntry::setValue(const SendCoinsRecipient &value)
{
recipient = value;
- if (recipient.authenticatedMerchant.isEmpty())
+ if (recipient.paymentRequest.IsInitialized()) // payment request
+ {
+ if (recipient.authenticatedMerchant.isEmpty()) // insecure
+ {
+ ui->payTo_is->setText(recipient.address);
+ ui->memoTextLabel_is->setText(recipient.message);
+ ui->payAmount_is->setValue(recipient.amount);
+ ui->payAmount_is->setReadOnly(true);
+ setCurrentWidget(ui->SendCoins_InsecurePaymentRequest);
+ }
+ else // secure
+ {
+ ui->payTo_s->setText(recipient.authenticatedMerchant);
+ ui->memoTextLabel_s->setText(recipient.message);
+ ui->payAmount_s->setValue(recipient.amount);
+ ui->payAmount_s->setReadOnly(true);
+ setCurrentWidget(ui->SendCoins_SecurePaymentRequest);
+ }
+ }
+ else // normal payment
{
ui->payTo->setText(recipient.address);
ui->addAsLabel->setText(recipient.label);
ui->payAmount->setValue(recipient.amount);
}
- else
- {
- const payments::PaymentDetails& details = recipient.paymentRequest.getDetails();
-
- ui->payTo_s->setText(recipient.authenticatedMerchant);
- ui->memoTextLabel_s->setText(QString::fromStdString(details.memo()));
- ui->payAmount_s->setValue(recipient.amount);
- ui->payAmount_s->setReadOnly(true);
- setCurrentWidget(ui->SendCoinsSecure);
- }
}
void SendCoinsEntry::setAddress(const QString &address)
@@ -182,7 +205,7 @@ void SendCoinsEntry::setAddress(const QString &address)
bool SendCoinsEntry::isClear()
{
- return ui->payTo->text().isEmpty() && ui->payTo_s->text().isEmpty();
+ return ui->payTo->text().isEmpty() && ui->payTo_is->text().isEmpty() && ui->payTo_s->text().isEmpty();
}
void SendCoinsEntry::setFocus()
@@ -196,6 +219,7 @@ void SendCoinsEntry::updateDisplayUnit()
{
// Update payAmount with the current unit
ui->payAmount->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
+ ui->payAmount_is->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
ui->payAmount_s->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
}
}
diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h
index 66d9752909..b658f6205a 100644
--- a/src/qt/sendcoinsentry.h
+++ b/src/qt/sendcoinsentry.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef SENDCOINSENTRY_H
#define SENDCOINSENTRY_H
diff --git a/src/qt/signverifymessagedialog.cpp b/src/qt/signverifymessagedialog.cpp
index ff3d00b326..567d46ad3a 100644
--- a/src/qt/signverifymessagedialog.cpp
+++ b/src/qt/signverifymessagedialog.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "signverifymessagedialog.h"
#include "ui_signverifymessagedialog.h"
diff --git a/src/qt/signverifymessagedialog.h b/src/qt/signverifymessagedialog.h
index 558f24e232..a91a30308c 100644
--- a/src/qt/signverifymessagedialog.h
+++ b/src/qt/signverifymessagedialog.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef SIGNVERIFYMESSAGEDIALOG_H
#define SIGNVERIFYMESSAGEDIALOG_H
diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp
index 07b71a3c9a..13d99a589b 100644
--- a/src/qt/splashscreen.cpp
+++ b/src/qt/splashscreen.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "splashscreen.h"
#include "clientversion.h"
#include "util.h"
diff --git a/src/qt/splashscreen.h b/src/qt/splashscreen.h
index 6a6249d80c..ddf040593d 100644
--- a/src/qt/splashscreen.h
+++ b/src/qt/splashscreen.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef SPLASHSCREEN_H
#define SPLASHSCREEN_H
diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp
index d49bc31f3e..74565bb6d0 100644
--- a/src/qt/trafficgraphwidget.cpp
+++ b/src/qt/trafficgraphwidget.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "trafficgraphwidget.h"
#include "clientmodel.h"
diff --git a/src/qt/trafficgraphwidget.h b/src/qt/trafficgraphwidget.h
index b31d1d5b0a..efab6e7fc5 100644
--- a/src/qt/trafficgraphwidget.h
+++ b/src/qt/trafficgraphwidget.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef TRAFFICGRAPHWIDGET_H
#define TRAFFICGRAPHWIDGET_H
diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp
index 63a72c4553..3a9daf0665 100644
--- a/src/qt/transactiondesc.cpp
+++ b/src/qt/transactiondesc.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "transactiondesc.h"
#include "guiutil.h"
diff --git a/src/qt/transactiondesc.h b/src/qt/transactiondesc.h
index 8b3684e961..62f89b7285 100644
--- a/src/qt/transactiondesc.h
+++ b/src/qt/transactiondesc.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef TRANSACTIONDESC_H
#define TRANSACTIONDESC_H
diff --git a/src/qt/transactiondescdialog.cpp b/src/qt/transactiondescdialog.cpp
index 3bd4808cb6..5ca575fdd4 100644
--- a/src/qt/transactiondescdialog.cpp
+++ b/src/qt/transactiondescdialog.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "transactiondescdialog.h"
#include "ui_transactiondescdialog.h"
diff --git a/src/qt/transactiondescdialog.h b/src/qt/transactiondescdialog.h
index f7ceacb63d..d4719975b2 100644
--- a/src/qt/transactiondescdialog.h
+++ b/src/qt/transactiondescdialog.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef TRANSACTIONDESCDIALOG_H
#define TRANSACTIONDESCDIALOG_H
diff --git a/src/qt/transactionfilterproxy.cpp b/src/qt/transactionfilterproxy.cpp
index 068e5550d2..cccb6176a6 100644
--- a/src/qt/transactionfilterproxy.cpp
+++ b/src/qt/transactionfilterproxy.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "transactionfilterproxy.h"
#include "transactiontablemodel.h"
diff --git a/src/qt/transactionfilterproxy.h b/src/qt/transactionfilterproxy.h
index 1aea85a005..1a7612348b 100644
--- a/src/qt/transactionfilterproxy.h
+++ b/src/qt/transactionfilterproxy.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef TRANSACTIONFILTERPROXY_H
#define TRANSACTIONFILTERPROXY_H
diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp
index 162908a9a4..c488e2d21c 100644
--- a/src/qt/transactionrecord.cpp
+++ b/src/qt/transactionrecord.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "transactionrecord.h"
#include "wallet.h"
diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h
index 480e7a7f2c..6f68f93fa5 100644
--- a/src/qt/transactionrecord.h
+++ b/src/qt/transactionrecord.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef TRANSACTIONRECORD_H
#define TRANSACTIONRECORD_H
diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp
index 6f7a5933ab..a33f2b5a71 100644
--- a/src/qt/transactiontablemodel.cpp
+++ b/src/qt/transactiontablemodel.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "transactiontablemodel.h"
#include "guiutil.h"
diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h
index 6b2961c285..d1b4f706d8 100644
--- a/src/qt/transactiontablemodel.h
+++ b/src/qt/transactiontablemodel.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef TRANSACTIONTABLEMODEL_H
#define TRANSACTIONTABLEMODEL_H
diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp
index a43e29c476..46245f00ad 100644
--- a/src/qt/transactionview.cpp
+++ b/src/qt/transactionview.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "transactionview.h"
#include "transactionfilterproxy.h"
@@ -11,6 +15,7 @@
#include "editaddressdialog.h"
#include "optionsmodel.h"
#include "guiutil.h"
+#include "ui_interface.h"
#include <QScrollBar>
#include <QComboBox>
@@ -20,7 +25,6 @@
#include <QLineEdit>
#include <QTableView>
#include <QHeaderView>
-#include <QMessageBox>
#include <QPoint>
#include <QMenu>
#include <QLabel>
@@ -266,12 +270,12 @@ void TransactionView::changedAmount(const QString &amount)
void TransactionView::exportClicked()
{
// CSV is currently the only supported format
- QString filename = GUIUtil::getSaveFileName(
- this,
- tr("Export Transaction Data"), QString(),
- tr("Comma separated file (*.csv)"));
+ QString filename = GUIUtil::getSaveFileName(this,
+ tr("Export Transaction History"), QString(),
+ tr("Comma separated file (*.csv)"));
- if (filename.isNull()) return;
+ if (filename.isNull())
+ return;
CSVModelWriter writer(filename);
@@ -285,10 +289,13 @@ void TransactionView::exportClicked()
writer.addColumn(tr("Amount"), 0, TransactionTableModel::FormattedAmountRole);
writer.addColumn(tr("ID"), 0, TransactionTableModel::TxIDRole);
- if(!writer.write())
- {
- QMessageBox::critical(this, tr("Error exporting"), tr("Could not write to file %1.").arg(filename),
- QMessageBox::Abort, QMessageBox::Abort);
+ if(!writer.write()) {
+ emit message(tr("Exporting Failed"), tr("There was an error trying to save the transaction history to %1.").arg(filename),
+ CClientUIInterface::MSG_ERROR);
+ }
+ else {
+ emit message(tr("Exporting Successful"), tr("The transaction history was successfully saved to %1.").arg(filename),
+ CClientUIInterface::MSG_INFORMATION);
}
}
diff --git a/src/qt/transactionview.h b/src/qt/transactionview.h
index bb41a83e32..2690cbb8ad 100644
--- a/src/qt/transactionview.h
+++ b/src/qt/transactionview.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef TRANSACTIONVIEW_H
#define TRANSACTIONVIEW_H
@@ -71,6 +75,9 @@ private slots:
signals:
void doubleClicked(const QModelIndex&);
+ /** Fired when a message should be reported to the user */
+ void message(const QString &title, const QString &message, unsigned int style);
+
public slots:
void chooseDate(int idx);
void chooseType(int idx);
diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp
index dd1d69ec3a..bacc70070b 100644
--- a/src/qt/walletframe.cpp
+++ b/src/qt/walletframe.cpp
@@ -1,9 +1,7 @@
-/*
- * Qt4 bitcoin GUI.
- *
- * W.J. van der Laan 2011-2012
- * The Bitcoin Developers 2011-2013
- */
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "walletframe.h"
#include "walletview.h"
#include "bitcoingui.h"
@@ -62,7 +60,7 @@ bool WalletFrame::setCurrentWallet(const QString& name)
WalletView *walletView = mapWalletViews.value(name);
walletStack->setCurrentWidget(walletView);
- walletView->setEncryptionStatus();
+ walletView->updateEncryptionStatus();
return true;
}
@@ -171,13 +169,6 @@ void WalletFrame::unlockWallet()
walletView->unlockWallet();
}
-void WalletFrame::setEncryptionStatus()
-{
- WalletView *walletView = (WalletView*)walletStack->currentWidget();
- if (walletView)
- walletView->setEncryptionStatus();
-}
-
void WalletFrame::usedSendingAddresses()
{
WalletView *walletView = (WalletView*)walletStack->currentWidget();
diff --git a/src/qt/walletframe.h b/src/qt/walletframe.h
index 89983b4aec..8cfaa0e1d4 100644
--- a/src/qt/walletframe.h
+++ b/src/qt/walletframe.h
@@ -1,9 +1,7 @@
-/*
- * Qt4 bitcoin GUI.
- *
- * W.J. van der Laan 2011-2012
- * The Bitcoin Developers 2011-2013
- */
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef WALLETFRAME_H
#define WALLETFRAME_H
@@ -75,12 +73,6 @@ public slots:
void usedSendingAddresses();
/** Show used receiving addresses */
void usedReceivingAddresses();
-
- /** Set the encryption status as shown in the UI.
- @param[in] status current encryption status
- @see WalletModel::EncryptionStatus
- */
- void setEncryptionStatus();
};
#endif // WALLETFRAME_H
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp
index 417bac9928..1c24ffb20b 100644
--- a/src/qt/walletmodel.cpp
+++ b/src/qt/walletmodel.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "walletmodel.h"
#include "guiconstants.h"
#include "optionsmodel.h"
@@ -258,8 +262,8 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran
// and emit coinsSent signal for each recipient
foreach(const SendCoinsRecipient &rcp, transaction.getRecipients())
{
- // Don't touch the address book when we have a secure payment-request
- if (rcp.authenticatedMerchant.isEmpty())
+ // Don't touch the address book when we have a payment request
+ if (!rcp.paymentRequest.IsInitialized())
{
std::string strAddress = rcp.address.toStdString();
CTxDestination dest = CBitcoinAddress(strAddress).Get();
diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h
index 2e99eaddcb..efa6ccc668 100644
--- a/src/qt/walletmodel.h
+++ b/src/qt/walletmodel.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef WALLETMODEL_H
#define WALLETMODEL_H
@@ -25,14 +29,21 @@ public:
explicit SendCoinsRecipient(const QString &addr, const QString &label, quint64 amount, const QString &message):
address(addr), label(label), amount(amount), message(message) {}
+ // If from an insecure payment request, this is used for storing
+ // the addresses, e.g. address-A<br />address-B<br />address-C.
+ // Info: As we don't need to process addresses in here when using
+ // payment requests, we can abuse it for displaying an address list.
+ // Todo: This is a hack, should be replaced with a cleaner solution!
QString address;
QString label;
qint64 amount;
+ // If from a payment request, this is used for storing the memo
QString message;
// If from a payment request, paymentRequest.IsInitialized() will be true
PaymentRequestPlus paymentRequest;
- QString authenticatedMerchant; // Empty if no authentication or invalid signature/cert/etc.
+ // Empty if no authentication or invalid signature/cert/etc.
+ QString authenticatedMerchant;
};
/** Interface to Bitcoin wallet from Qt view code. */
@@ -160,7 +171,7 @@ signals:
// this means that the unlocking failed or was cancelled.
void requireUnlock();
- // Asynchronous message notification
+ // Fired when a message should be reported to the user
void message(const QString &title, const QString &message, unsigned int style);
// Coins sent: from wallet, to recipient, in (serialized) transaction:
diff --git a/src/qt/walletmodeltransaction.cpp b/src/qt/walletmodeltransaction.cpp
index 706ed60b77..96c2794dff 100644
--- a/src/qt/walletmodeltransaction.cpp
+++ b/src/qt/walletmodeltransaction.cpp
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "walletmodeltransaction.h"
WalletModelTransaction::WalletModelTransaction(const QList<SendCoinsRecipient> &recipients) :
diff --git a/src/qt/walletmodeltransaction.h b/src/qt/walletmodeltransaction.h
index c4848fb12d..efc4814430 100644
--- a/src/qt/walletmodeltransaction.h
+++ b/src/qt/walletmodeltransaction.h
@@ -1,3 +1,7 @@
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef WALLETMODELTRANSACTION_H
#define WALLETMODELTRANSACTION_H
diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp
index 57e64b0826..b026ca5446 100644
--- a/src/qt/walletview.cpp
+++ b/src/qt/walletview.cpp
@@ -1,9 +1,7 @@
-/*
- * Qt4 bitcoin GUI.
- *
- * W.J. van der Laan 2011-2012
- * The Bitcoin Developers 2011-2013
- */
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#include "walletview.h"
#include "bitcoingui.h"
#include "transactiontablemodel.h"
@@ -18,21 +16,15 @@
#include "overviewpage.h"
#include "askpassphrasedialog.h"
#include "ui_interface.h"
+#include "guiutil.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QAction>
-#if QT_VERSION < 0x050000
-#include <QDesktopServices>
-#else
-#include <QStandardPaths>
-#endif
-#include <QFileDialog>
#include <QPushButton>
WalletView::WalletView(QWidget *parent):
QStackedWidget(parent),
- gui(0),
clientModel(0),
walletModel(0)
{
@@ -62,7 +54,7 @@ WalletView::WalletView(QWidget *parent):
addWidget(receiveCoinsPage);
addWidget(sendCoinsPage);
- // Clicking on a transaction on the overview page simply sends you to transaction history page
+ // Clicking on a transaction on the overview pre-selects the transaction on the transaction history page
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));
// Double-clicking on a transaction on the transaction history page shows details
@@ -70,6 +62,11 @@ WalletView::WalletView(QWidget *parent):
// Clicking on "Export" allows to export the transaction list
connect(exportButton, SIGNAL(clicked()), transactionView, SLOT(exportClicked()));
+
+ // Pass through messages from sendCoinsPage
+ connect(sendCoinsPage, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));
+ // Pass through messages from transactionView
+ connect(transactionView, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));
}
WalletView::~WalletView()
@@ -78,55 +75,58 @@ WalletView::~WalletView()
void WalletView::setBitcoinGUI(BitcoinGUI *gui)
{
- this->gui = gui;
-
if (gui)
{
- // Clicking on a transaction on the overview page sends you to the transactions tab
+ // Clicking on a transaction on the overview page simply sends you to transaction history page
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), gui, SLOT(gotoHistoryPage()));
// Receive and report messages
connect(this, SIGNAL(message(QString,QString,unsigned int)), gui, SLOT(message(QString,QString,unsigned int)));
- connect(sendCoinsPage, SIGNAL(message(QString,QString,unsigned int)), gui, SLOT(message(QString,QString,unsigned int)));
+
+ // Pass through encryption status changed signals
+ connect(this, SIGNAL(encryptionStatusChanged(int)), gui, SLOT(setEncryptionStatus(int)));
+
+ // Pass through transaction notifications
+ connect(this, SIGNAL(incomingTransaction(QString,int,qint64,QString,QString)), gui, SLOT(incomingTransaction(QString,int,qint64,QString,QString)));
}
}
void WalletView::setClientModel(ClientModel *clientModel)
{
this->clientModel = clientModel;
- if (clientModel)
- {
- overviewPage->setClientModel(clientModel);
- }
+
+ overviewPage->setClientModel(clientModel);
}
void WalletView::setWalletModel(WalletModel *walletModel)
{
this->walletModel = walletModel;
- if (walletModel && gui)
- {
- // Receive and report messages from wallet thread
- connect(walletModel, SIGNAL(message(QString,QString,unsigned int)), gui, SLOT(message(QString,QString,unsigned int)));
- // Put transaction list in tabs
- transactionView->setModel(walletModel);
- overviewPage->setWalletModel(walletModel);
- receiveCoinsPage->setModel(walletModel);
- sendCoinsPage->setModel(walletModel);
+ // Put transaction list in tabs
+ transactionView->setModel(walletModel);
+ overviewPage->setWalletModel(walletModel);
+ receiveCoinsPage->setModel(walletModel);
+ sendCoinsPage->setModel(walletModel);
+
+ if (walletModel)
+ {
+ // Receive and pass through messages from wallet model
+ connect(walletModel, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));
- setEncryptionStatus();
- connect(walletModel, SIGNAL(encryptionStatusChanged(int)), gui, SLOT(setEncryptionStatus(int)));
+ // Handle changes in encryption status
+ connect(walletModel, SIGNAL(encryptionStatusChanged(int)), this, SIGNAL(encryptionStatusChanged(int)));
+ updateEncryptionStatus();
// Balloon pop-up for new transaction
connect(walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
- this, SLOT(incomingTransaction(QModelIndex,int,int)));
+ this, SLOT(processNewTransaction(QModelIndex,int,int)));
// Ask for passphrase if needed
connect(walletModel, SIGNAL(requireUnlock()), this, SLOT(unlockWallet()));
}
}
-void WalletView::incomingTransaction(const QModelIndex& parent, int start, int /*end*/)
+void WalletView::processNewTransaction(const QModelIndex& parent, int start, int /*end*/)
{
// Prevent balloon-spam when initial block download is in progress
if (!walletModel || !clientModel || clientModel->inInitialBlockDownload())
@@ -139,7 +139,7 @@ void WalletView::incomingTransaction(const QModelIndex& parent, int start, int /
QString type = ttm->index(start, TransactionTableModel::Type, parent).data().toString();
QString address = ttm->index(start, TransactionTableModel::ToAddress, parent).data().toString();
- gui->incomingTransaction(date, walletModel->getOptionsModel()->getDisplayUnit(), amount, type, address);
+ emit incomingTransaction(date, walletModel->getOptionsModel()->getDisplayUnit(), amount, type, address);
}
void WalletView::gotoOverviewPage()
@@ -199,9 +199,9 @@ void WalletView::showOutOfSyncWarning(bool fShow)
overviewPage->showOutOfSyncWarning(fShow);
}
-void WalletView::setEncryptionStatus()
+void WalletView::updateEncryptionStatus()
{
- gui->setEncryptionStatus(walletModel->getEncryptionStatus());
+ emit encryptionStatusChanged(walletModel->getEncryptionStatus());
}
void WalletView::encryptWallet(bool status)
@@ -212,25 +212,25 @@ void WalletView::encryptWallet(bool status)
dlg.setModel(walletModel);
dlg.exec();
- setEncryptionStatus();
+ updateEncryptionStatus();
}
void WalletView::backupWallet()
{
-#if QT_VERSION < 0x050000
- QString saveDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
-#else
- QString saveDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
-#endif
- QString filename = QFileDialog::getSaveFileName(this, tr("Backup Wallet"), saveDir, tr("Wallet Data (*.dat)"));
- if (!filename.isEmpty()) {
- if (!walletModel->backupWallet(filename)) {
- emit message(tr("Backup Failed"), tr("There was an error trying to save the wallet data to the new location."),
- CClientUIInterface::MSG_ERROR);
+ QString filename = GUIUtil::getSaveFileName(this,
+ tr("Backup Wallet"), QString(),
+ tr("Wallet Data (*.dat)"));
+
+ if (filename.isEmpty())
+ return;
+
+ if (!walletModel->backupWallet(filename)) {
+ emit message(tr("Backup Failed"), tr("There was an error trying to save the wallet data to %1.").arg(filename),
+ CClientUIInterface::MSG_ERROR);
}
- else
- emit message(tr("Backup Successful"), tr("The wallet data was successfully saved to the new location."),
- CClientUIInterface::MSG_INFORMATION);
+ else {
+ emit message(tr("Backup Successful"), tr("The wallet data was successfully saved to %1.").arg(filename),
+ CClientUIInterface::MSG_INFORMATION);
}
}
diff --git a/src/qt/walletview.h b/src/qt/walletview.h
index 60544cbf88..19be8f4d87 100644
--- a/src/qt/walletview.h
+++ b/src/qt/walletview.h
@@ -1,9 +1,7 @@
-/*
- * Qt4 bitcoin GUI.
- *
- * W.J. van der Laan 2011-2012
- * The Bitcoin Developers 2011-2013
- */
+// Copyright (c) 2011-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
#ifndef WALLETVIEW_H
#define WALLETVIEW_H
@@ -55,7 +53,6 @@ public:
void showOutOfSyncWarning(bool fShow);
private:
- BitcoinGUI *gui;
ClientModel *clientModel;
WalletModel *walletModel;
@@ -85,7 +82,7 @@ public slots:
The new items are those between start and end inclusive, under the given parent item.
*/
- void incomingTransaction(const QModelIndex& parent, int start, int /*end*/);
+ void processNewTransaction(const QModelIndex& parent, int start, int /*end*/);
/** Encrypt the wallet */
void encryptWallet(bool status);
/** Backup the wallet */
@@ -100,14 +97,17 @@ public slots:
/** Show used receiving addresses */
void usedReceivingAddresses();
- void setEncryptionStatus();
-
+ /** Re-emit encryption status signal */
+ void updateEncryptionStatus();
signals:
/** Signal that we want to show the main window */
void showNormalIfMinimized();
-
/** Fired when a message should be reported to the user */
void message(const QString &title, const QString &message, unsigned int style);
+ /** Encryption status of wallet changed */
+ void encryptionStatusChanged(int status);
+ /** Notify that a new transaction appeared */
+ void incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address);
};
#endif // WALLETVIEW_H
diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp
index 3589b45900..f24e6b8a9c 100644
--- a/src/rpcdump.cpp
+++ b/src/rpcdump.cpp
@@ -6,6 +6,7 @@
#include <fstream>
#include "init.h" // for pwalletMain
+#include "wallet.h"
#include "bitcoinrpc.h"
#include "ui_interface.h"
#include "base58.h"
@@ -25,7 +26,7 @@ std::string static EncodeDumpTime(int64 nTime) {
}
int64 static DecodeDumpTime(const std::string &str) {
- static const boost::posix_time::time_input_facet facet("%Y-%m-%dT%H:%M:%SZ");
+ static boost::posix_time::time_input_facet facet("%Y-%m-%dT%H:%M:%SZ");
static const boost::posix_time::ptime epoch = boost::posix_time::from_time_t(0);
const std::locale loc(std::locale::classic(), &facet);
std::istringstream iss(str);
diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp
index 77dc13815d..d91f26e20a 100644
--- a/src/rpcmining.cpp
+++ b/src/rpcmining.cpp
@@ -190,7 +190,7 @@ Value getwork(const Array& params, bool fHelp)
static int64 nStart;
static CBlockTemplate* pblocktemplate;
if (pindexPrev != chainActive.Tip() ||
- (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60))
+ (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 60))
{
if (pindexPrev != chainActive.Tip())
{
@@ -205,7 +205,7 @@ Value getwork(const Array& params, bool fHelp)
pindexPrev = NULL;
// Store the pindexBest used before CreateNewBlock, to avoid races
- nTransactionsUpdatedLast = nTransactionsUpdated;
+ nTransactionsUpdatedLast = mempool.GetTransactionsUpdated();
CBlockIndex* pindexPrevNew = chainActive.Tip();
nStart = GetTime();
@@ -326,13 +326,13 @@ Value getblocktemplate(const Array& params, bool fHelp)
static int64 nStart;
static CBlockTemplate* pblocktemplate;
if (pindexPrev != chainActive.Tip() ||
- (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 5))
+ (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 5))
{
// Clear pindexPrev so future calls make a new block, despite any failures from here on
pindexPrev = NULL;
// Store the pindexBest used before CreateNewBlock, to avoid races
- nTransactionsUpdatedLast = nTransactionsUpdated;
+ nTransactionsUpdatedLast = mempool.GetTransactionsUpdated();
CBlockIndex* pindexPrevNew = chainActive.Tip();
nStart = GetTime();
diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp
index d5bd39cb4d..4771094e1f 100644
--- a/src/rpcrawtransaction.cpp
+++ b/src/rpcrawtransaction.cpp
@@ -29,7 +29,7 @@ void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeH
if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired))
{
- out.push_back(Pair("type", GetTxnOutputType(TX_NONSTANDARD)));
+ out.push_back(Pair("type", GetTxnOutputType(type)));
return;
}
@@ -550,7 +550,7 @@ Value sendrawtransaction(const Array& params, bool fHelp)
if (!fHave) {
// push to local node
CValidationState state;
- if (!mempool.accept(state, tx, false, NULL, !fOverrideFees))
+ if (!AcceptToMemoryPool(mempool, state, tx, false, NULL, !fOverrideFees))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX rejected"); // TODO: report validation state
}
}
@@ -560,7 +560,7 @@ Value sendrawtransaction(const Array& params, bool fHelp)
// Not in block, but already in the memory pool; will drop
// through to re-relay it.
} else {
- SyncWithWallets(hashTx, tx, NULL, true);
+ SyncWithWallets(hashTx, tx, NULL);
}
RelayTransaction(tx, hashTx);
diff --git a/src/script.cpp b/src/script.cpp
index 63f632795a..ec9e9d61de 100644
--- a/src/script.cpp
+++ b/src/script.cpp
@@ -1195,7 +1195,7 @@ bool CheckSig(vector<unsigned char> vchSig, const vector<unsigned char> &vchPubK
bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsigned char> >& vSolutionsRet)
{
// Templates
- static map<txnouttype, CScript> mTemplates;
+ static multimap<txnouttype, CScript> mTemplates;
if (mTemplates.empty())
{
// Standard tx, sender provides pubkey, receiver adds signature
@@ -1209,6 +1209,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
// Empty, provably prunable, data-carrying output
mTemplates.insert(make_pair(TX_NULL_DATA, CScript() << OP_RETURN << OP_SMALLDATA));
+ mTemplates.insert(make_pair(TX_NULL_DATA, CScript() << OP_RETURN));
}
// Shortcut for pay-to-script-hash, which are more constrained than the other types:
@@ -1392,9 +1393,8 @@ int ScriptSigArgsExpected(txnouttype t, const std::vector<std::vector<unsigned c
switch (t)
{
case TX_NONSTANDARD:
- return -1;
case TX_NULL_DATA:
- return 1;
+ return -1;
case TX_PUBKEY:
return 1;
case TX_PUBKEYHASH:
@@ -1532,8 +1532,10 @@ bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, vecto
vector<valtype> vSolutions;
if (!Solver(scriptPubKey, typeRet, vSolutions))
return false;
- if (typeRet == TX_NULL_DATA)
- return true;
+ if (typeRet == TX_NULL_DATA){
+ // This is data, not addresses
+ return false;
+ }
if (typeRet == TX_MULTISIG)
{
diff --git a/src/serialize.h b/src/serialize.h
index 4d9aec3426..115ea1d447 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -901,19 +901,6 @@ public:
iterator insert(iterator it, const char& x=char()) { return vch.insert(it, x); }
void insert(iterator it, size_type n, const char& x) { vch.insert(it, n, x); }
- void insert(iterator it, const_iterator first, const_iterator last)
- {
- assert(last - first >= 0);
- if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
- {
- // special case for inserting at the front when there's room
- nReadPos -= (last - first);
- memcpy(&vch[nReadPos], &first[0], last - first);
- }
- else
- vch.insert(it, first, last);
- }
-
void insert(iterator it, std::vector<char>::const_iterator first, std::vector<char>::const_iterator last)
{
assert(last - first >= 0);
@@ -1104,8 +1091,8 @@ public:
}
void GetAndClear(CSerializeData &data) {
- vch.swap(data);
- CSerializeData().swap(vch);
+ data.insert(data.end(), begin(), end());
+ clear();
}
};
diff --git a/src/test/bignum_tests.cpp b/src/test/bignum_tests.cpp
index 196b7274f4..f16c26fd18 100644
--- a/src/test/bignum_tests.cpp
+++ b/src/test/bignum_tests.cpp
@@ -175,4 +175,12 @@ BOOST_AUTO_TEST_CASE(bignum_SetCompact)
BOOST_CHECK_EQUAL(num.GetCompact(), 0xff123456U);
}
+BOOST_AUTO_TEST_CASE(bignum_SetHex)
+{
+ std::string hexStr = "deecf97fd890808b9cc0f1b6a3e7a60b400f52710e6ad075b1340755bfa58cc9";
+ CBigNum num;
+ num.SetHex(hexStr);
+ BOOST_CHECK_EQUAL(num.GetHex(), hexStr);
+}
+
BOOST_AUTO_TEST_SUITE_END()
diff --git a/src/test/serialize_tests.cpp b/src/test/serialize_tests.cpp
index 50139df09e..7e193c88ce 100644
--- a/src/test/serialize_tests.cpp
+++ b/src/test/serialize_tests.cpp
@@ -102,4 +102,52 @@ BOOST_AUTO_TEST_CASE(noncanonical)
BOOST_CHECK_EXCEPTION(ReadCompactSize(ss), std::ios_base::failure, isCanonicalException);
}
+BOOST_AUTO_TEST_CASE(insert_delete)
+{
+ // Test inserting/deleting bytes.
+ CDataStream ss(SER_DISK, 0);
+ BOOST_CHECK_EQUAL(ss.size(), 0);
+
+ ss.write("\x00\x01\x02\xff", 4);
+ BOOST_CHECK_EQUAL(ss.size(), 4);
+
+ char c = (char)11;
+
+ // Inserting at beginning/end/middle:
+ ss.insert(ss.begin(), c);
+ BOOST_CHECK_EQUAL(ss.size(), 5);
+ BOOST_CHECK_EQUAL(ss[0], c);
+ BOOST_CHECK_EQUAL(ss[1], 0);
+
+ ss.insert(ss.end(), c);
+ BOOST_CHECK_EQUAL(ss.size(), 6);
+ BOOST_CHECK_EQUAL(ss[4], (char)0xff);
+ BOOST_CHECK_EQUAL(ss[5], c);
+
+ ss.insert(ss.begin()+2, c);
+ BOOST_CHECK_EQUAL(ss.size(), 7);
+ BOOST_CHECK_EQUAL(ss[2], c);
+
+ // Delete at beginning/end/middle
+ ss.erase(ss.begin());
+ BOOST_CHECK_EQUAL(ss.size(), 6);
+ BOOST_CHECK_EQUAL(ss[0], 0);
+
+ ss.erase(ss.begin()+ss.size()-1);
+ BOOST_CHECK_EQUAL(ss.size(), 5);
+ BOOST_CHECK_EQUAL(ss[4], (char)0xff);
+
+ ss.erase(ss.begin()+1);
+ BOOST_CHECK_EQUAL(ss.size(), 4);
+ BOOST_CHECK_EQUAL(ss[0], 0);
+ BOOST_CHECK_EQUAL(ss[1], 1);
+ BOOST_CHECK_EQUAL(ss[2], 2);
+ BOOST_CHECK_EQUAL(ss[3], (char)0xff);
+
+ // Make sure GetAndClear does the right thing:
+ CSerializeData d;
+ ss.GetAndClear(d);
+ BOOST_CHECK_EQUAL(ss.size(), 0);
+}
+
BOOST_AUTO_TEST_SUITE_END()
diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp
index 5dfb67cbe4..bd999caa14 100644
--- a/src/test/transaction_tests.cpp
+++ b/src/test/transaction_tests.cpp
@@ -282,11 +282,24 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
t.vout[0].scriptPubKey = CScript() << OP_RETURN << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3804678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3800");
BOOST_CHECK(!IsStandardTx(t, reason));
- // Only one TX_NULL_DATA permitted
+ // TX_NULL_DATA w/o PUSHDATA
+ t.vout.resize(1);
+ t.vout[0].scriptPubKey = CScript() << OP_RETURN;
+ BOOST_CHECK(IsStandardTx(t, reason));
+
+ // Only one TX_NULL_DATA permitted in all cases
t.vout.resize(2);
t.vout[0].scriptPubKey = CScript() << OP_RETURN << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3804678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38");
t.vout[1].scriptPubKey = CScript() << OP_RETURN << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3804678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38");
BOOST_CHECK(!IsStandardTx(t, reason));
+
+ t.vout[0].scriptPubKey = CScript() << OP_RETURN << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef3804678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38");
+ t.vout[1].scriptPubKey = CScript() << OP_RETURN;
+ BOOST_CHECK(!IsStandardTx(t, reason));
+
+ t.vout[0].scriptPubKey = CScript() << OP_RETURN;
+ t.vout[1].scriptPubKey = CScript() << OP_RETURN;
+ BOOST_CHECK(!IsStandardTx(t, reason));
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/src/test/uint256_tests.cpp b/src/test/uint256_tests.cpp
index efdc8a6aeb..e34efcc47e 100644
--- a/src/test/uint256_tests.cpp
+++ b/src/test/uint256_tests.cpp
@@ -1,6 +1,7 @@
#include <boost/test/unit_test.hpp>
#include "uint256.h"
+#include <string>
BOOST_AUTO_TEST_SUITE(uint256_tests)
@@ -15,4 +16,12 @@ BOOST_AUTO_TEST_CASE(uint256_equality)
BOOST_CHECK(num1+num2 == num3+num2);
}
+BOOST_AUTO_TEST_CASE(uint256_hex)
+{
+ std::string hexStr = "d35583ed493a5eee756931353144f558e6a9ab3ad6024a63ced7f10daf7faad9";
+ uint256 num1;
+ num1.SetHex(hexStr);
+ BOOST_CHECK(num1.GetHex() == hexStr);
+}
+
BOOST_AUTO_TEST_SUITE_END()
diff --git a/src/txdb.cpp b/src/txdb.cpp
index 5e7b78296c..27d6caf4d9 100644
--- a/src/txdb.cpp
+++ b/src/txdb.cpp
@@ -74,13 +74,9 @@ bool CBlockTreeDB::WriteBlockIndex(const CDiskBlockIndex& blockindex)
return Write(make_pair('b', blockindex.GetBlockHash()), blockindex);
}
-bool CBlockTreeDB::ReadBestInvalidWork(CBigNum& bnBestInvalidWork)
-{
- return Read('I', bnBestInvalidWork);
-}
-
bool CBlockTreeDB::WriteBestInvalidWork(const CBigNum& bnBestInvalidWork)
{
+ // Obsolete; only written for backward compatibility.
return Write('I', bnBestInvalidWork);
}
diff --git a/src/txdb.h b/src/txdb.h
index e3560a9c5c..b555be3de7 100644
--- a/src/txdb.h
+++ b/src/txdb.h
@@ -35,7 +35,6 @@ private:
void operator=(const CBlockTreeDB&);
public:
bool WriteBlockIndex(const CDiskBlockIndex& blockindex);
- bool ReadBestInvalidWork(CBigNum& bnBestInvalidWork);
bool WriteBestInvalidWork(const CBigNum& bnBestInvalidWork);
bool ReadBlockFileInfo(int nFile, CBlockFileInfo &fileinfo);
bool WriteBlockFileInfo(int nFile, const CBlockFileInfo &fileinfo);
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
new file mode 100644
index 0000000000..975955a458
--- /dev/null
+++ b/src/txmempool.cpp
@@ -0,0 +1,162 @@
+// Copyright (c) 2009-2010 Satoshi Nakamoto
+// Copyright (c) 2009-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#include "core.h"
+#include "txmempool.h"
+
+using namespace std;
+
+CTxMemPool::CTxMemPool()
+{
+ // Sanity checks off by default for performance, because otherwise
+ // accepting transactions becomes O(N^2) where N is the number
+ // of transactions in the pool
+ fSanityCheck = false;
+}
+
+void CTxMemPool::pruneSpent(const uint256 &hashTx, CCoins &coins)
+{
+ LOCK(cs);
+
+ std::map<COutPoint, CInPoint>::iterator it = mapNextTx.lower_bound(COutPoint(hashTx, 0));
+
+ // iterate over all COutPoints in mapNextTx whose hash equals the provided hashTx
+ while (it != mapNextTx.end() && it->first.hash == hashTx) {
+ coins.Spend(it->first.n); // and remove those outputs from coins
+ it++;
+ }
+}
+
+unsigned int CTxMemPool::GetTransactionsUpdated() const
+{
+ LOCK(cs);
+ return nTransactionsUpdated;
+}
+
+void CTxMemPool::AddTransactionsUpdated(unsigned int n)
+{
+ LOCK(cs);
+ nTransactionsUpdated += n;
+}
+
+
+bool CTxMemPool::addUnchecked(const uint256& hash, const CTransaction &tx)
+{
+ // Add to memory pool without checking anything.
+ // Used by main.cpp AcceptToMemoryPool(), which DOES do
+ // all the appropriate checks.
+ LOCK(cs);
+ {
+ mapTx[hash] = tx;
+ for (unsigned int i = 0; i < tx.vin.size(); i++)
+ mapNextTx[tx.vin[i].prevout] = CInPoint(&mapTx[hash], i);
+ nTransactionsUpdated++;
+ }
+ return true;
+}
+
+
+bool CTxMemPool::remove(const CTransaction &tx, bool fRecursive)
+{
+ // Remove transaction from memory pool
+ {
+ LOCK(cs);
+ uint256 hash = tx.GetHash();
+ if (fRecursive) {
+ for (unsigned int i = 0; i < tx.vout.size(); i++) {
+ std::map<COutPoint, CInPoint>::iterator it = mapNextTx.find(COutPoint(hash, i));
+ if (it != mapNextTx.end())
+ remove(*it->second.ptx, true);
+ }
+ }
+ if (mapTx.count(hash))
+ {
+ BOOST_FOREACH(const CTxIn& txin, tx.vin)
+ mapNextTx.erase(txin.prevout);
+ mapTx.erase(hash);
+ nTransactionsUpdated++;
+ }
+ }
+ return true;
+}
+
+bool CTxMemPool::removeConflicts(const CTransaction &tx)
+{
+ // Remove transactions which depend on inputs of tx, recursively
+ LOCK(cs);
+ BOOST_FOREACH(const CTxIn &txin, tx.vin) {
+ std::map<COutPoint, CInPoint>::iterator it = mapNextTx.find(txin.prevout);
+ if (it != mapNextTx.end()) {
+ const CTransaction &txConflict = *it->second.ptx;
+ if (txConflict != tx)
+ remove(txConflict, true);
+ }
+ }
+ return true;
+}
+
+void CTxMemPool::clear()
+{
+ LOCK(cs);
+ mapTx.clear();
+ mapNextTx.clear();
+ ++nTransactionsUpdated;
+}
+
+void CTxMemPool::check(CTxMemPool::CoinLookupFunc fnLookup) const
+{
+ if (!fSanityCheck)
+ return;
+
+ LogPrint("mempool", "Checking mempool with %u transactions and %u inputs\n", (unsigned int)mapTx.size(), (unsigned int)mapNextTx.size());
+
+ LOCK(cs);
+ for (std::map<uint256, CTransaction>::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) {
+ unsigned int i = 0;
+ BOOST_FOREACH(const CTxIn &txin, it->second.vin) {
+ // Check that every mempool transaction's inputs refer to available coins, or other mempool tx's.
+ std::map<uint256, CTransaction>::const_iterator it2 = mapTx.find(txin.prevout.hash);
+ if (it2 != mapTx.end()) {
+ assert(it2->second.vout.size() > txin.prevout.n && !it2->second.vout[txin.prevout.n].IsNull());
+ } else {
+ CCoins &coins = (*fnLookup)(txin.prevout.hash);
+ assert(coins.IsAvailable(txin.prevout.n));
+ }
+ // Check whether its inputs are marked in mapNextTx.
+ std::map<COutPoint, CInPoint>::const_iterator it3 = mapNextTx.find(txin.prevout);
+ assert(it3 != mapNextTx.end());
+ assert(it3->second.ptx == &it->second);
+ assert(it3->second.n == i);
+ i++;
+ }
+ }
+ for (std::map<COutPoint, CInPoint>::const_iterator it = mapNextTx.begin(); it != mapNextTx.end(); it++) {
+ uint256 hash = it->second.ptx->GetHash();
+ std::map<uint256, CTransaction>::const_iterator it2 = mapTx.find(hash);
+ assert(it2 != mapTx.end());
+ assert(&it2->second == it->second.ptx);
+ assert(it2->second.vin.size() > it->second.n);
+ assert(it->first == it->second.ptx->vin[it->second.n].prevout);
+ }
+}
+
+void CTxMemPool::queryHashes(std::vector<uint256>& vtxid)
+{
+ vtxid.clear();
+
+ LOCK(cs);
+ vtxid.reserve(mapTx.size());
+ for (map<uint256, CTransaction>::iterator mi = mapTx.begin(); mi != mapTx.end(); ++mi)
+ vtxid.push_back((*mi).first);
+}
+
+bool CTxMemPool::lookup(uint256 hash, CTransaction& result) const
+{
+ LOCK(cs);
+ std::map<uint256, CTransaction>::const_iterator i = mapTx.find(hash);
+ if (i == mapTx.end()) return false;
+ result = i->second;
+ return true;
+}
diff --git a/src/txmempool.h b/src/txmempool.h
new file mode 100644
index 0000000000..1b555d99f4
--- /dev/null
+++ b/src/txmempool.h
@@ -0,0 +1,67 @@
+// Copyright (c) 2009-2010 Satoshi Nakamoto
+// Copyright (c) 2009-2013 The Bitcoin developers
+// Distributed under the MIT/X11 software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#ifndef BITCOIN_TXMEMPOOL_H
+#define BITCOIN_TXMEMPOOL_H
+
+#include "core.h"
+
+/*
+ * CTxMemPool stores valid-according-to-the-current-best-chain
+ * transactions that may be included in the next block.
+ *
+ * Transactions are added when they are seen on the network
+ * (or created by the local node), but not all transactions seen
+ * are added to the pool: if a new transaction double-spends
+ * an input of a transaction in the pool, it is dropped,
+ * as are non-standard transactions.
+ */
+class CTxMemPool
+{
+private:
+ bool fSanityCheck; // Normally false, true if -checkmempool or -regtest
+ unsigned int nTransactionsUpdated;
+
+public:
+ mutable CCriticalSection cs;
+ std::map<uint256, CTransaction> mapTx;
+ std::map<COutPoint, CInPoint> mapNextTx;
+
+ CTxMemPool();
+
+ /*
+ * If sanity-checking is turned on, check makes sure the pool is
+ * consistent (does not contain two transactions that spend the same inputs,
+ * all inputs are in the mapNextTx array). If sanity-checking is turned off,
+ * check does nothing.
+ */
+ typedef CCoins& (*CoinLookupFunc)(const uint256&);
+ void check(CoinLookupFunc fnLookup) const;
+ void setSanityCheck(bool _fSanityCheck) { fSanityCheck = _fSanityCheck; }
+
+ bool addUnchecked(const uint256& hash, const CTransaction &tx);
+ bool remove(const CTransaction &tx, bool fRecursive = false);
+ bool removeConflicts(const CTransaction &tx);
+ void clear();
+ void queryHashes(std::vector<uint256>& vtxid);
+ void pruneSpent(const uint256& hash, CCoins &coins);
+ unsigned int GetTransactionsUpdated() const;
+ void AddTransactionsUpdated(unsigned int n);
+
+ unsigned long size()
+ {
+ LOCK(cs);
+ return mapTx.size();
+ }
+
+ bool exists(uint256 hash)
+ {
+ LOCK(cs);
+ return (mapTx.count(hash) != 0);
+ }
+
+ bool lookup(uint256 hash, CTransaction& result) const;
+};
+
+#endif /* BITCOIN_TXMEMPOOL_H */
diff --git a/src/uint256.h b/src/uint256.h
index 79404f1b16..b5a4950eaa 100644
--- a/src/uint256.h
+++ b/src/uint256.h
@@ -14,7 +14,12 @@
typedef long long int64;
typedef unsigned long long uint64;
+extern const signed char p_util_hexdigit[256]; // defined in util.cpp
+inline signed char HexDigit(char c)
+{
+ return p_util_hexdigit[(unsigned char)c];
+}
inline int Testuint256AdHoc(std::vector<std::string> vArg);
@@ -305,8 +310,7 @@ public:
void SetHex(const char* psz)
{
- for (int i = 0; i < WIDTH; i++)
- pn[i] = 0;
+ memset(pn,0,sizeof(pn));
// skip leading spaces
while (isspace(*psz))
@@ -317,19 +321,18 @@ public:
psz += 2;
// hex string to uint
- static const unsigned char phexdigit[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0 };
const char* pbegin = psz;
- while (phexdigit[(unsigned char)*psz] || *psz == '0')
+ while (::HexDigit(*psz) != -1)
psz++;
psz--;
unsigned char* p1 = (unsigned char*)pn;
unsigned char* pend = p1 + WIDTH * 4;
while (psz >= pbegin && p1 < pend)
{
- *p1 = phexdigit[(unsigned char)*psz--];
+ *p1 = ::HexDigit(*psz--);
if (psz >= pbegin)
{
- *p1 |= (phexdigit[(unsigned char)*psz--] << 4);
+ *p1 |= ((unsigned char)::HexDigit(*psz--) << 4);
p1++;
}
}
diff --git a/src/util.cpp b/src/util.cpp
index 71994587cf..539e759ddd 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -73,7 +73,6 @@ using namespace std;
map<string, string> mapArgs;
map<string, vector<string> > mapMultiArgs;
bool fDebug = false;
-bool fDebugNet = false;
bool fPrintToConsole = false;
bool fPrintToDebugger = false;
bool fDaemon = false;
@@ -81,7 +80,6 @@ bool fServer = false;
string strMiscWarning;
bool fNoListen = false;
bool fLogTimestamps = false;
-CMedianFilter<int64> vTimeOffsets(200,0);
volatile bool fReopenDebugLog = false;
// Init OpenSSL library multithreading support
@@ -226,10 +224,20 @@ int LogPrint(const char* category, const char* pszFormat, ...)
{
if (category != NULL)
{
- if (!fDebug) return 0;
- const vector<string>& categories = mapMultiArgs["-debug"];
- if (find(categories.begin(), categories.end(), string(category)) == categories.end())
+ if (!fDebug)
return 0;
+
+ const vector<string>& categories = mapMultiArgs["-debug"];
+ bool allCategories = count(categories.begin(), categories.end(), string(""));
+
+ // Only look for categories, if not -debug/-debug=1 was passed,
+ // as that implies every category should be logged.
+ if (!allCategories)
+ {
+ // Category was not found (not supplied via -debug=<category>)
+ if (find(categories.begin(), categories.end(), string(category)) == categories.end())
+ return 0;
+ }
}
int ret = 0; // Returns total number of characters written
@@ -452,7 +460,7 @@ bool ParseMoney(const char* pszIn, int64& nRet)
}
-static const signed char phexdigit[256] =
+const signed char p_util_hexdigit[256] =
{ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
@@ -472,9 +480,9 @@ static const signed char phexdigit[256] =
bool IsHex(const string& str)
{
- BOOST_FOREACH(unsigned char c, str)
+ BOOST_FOREACH(char c, str)
{
- if (phexdigit[c] < 0)
+ if (HexDigit(c) < 0)
return false;
}
return (str.size() > 0) && (str.size()%2 == 0);
@@ -488,11 +496,11 @@ vector<unsigned char> ParseHex(const char* psz)
{
while (isspace(*psz))
psz++;
- signed char c = phexdigit[(unsigned char)*psz++];
+ signed char c = HexDigit(*psz++);
if (c == (signed char)-1)
break;
unsigned char n = (c << 4);
- c = phexdigit[(unsigned char)*psz++];
+ c = HexDigit(*psz++);
if (c == (signed char)-1)
break;
n |= c;
@@ -1296,10 +1304,12 @@ void SetMockTime(int64 nMockTimeIn)
nMockTime = nMockTimeIn;
}
+static CCriticalSection cs_nTimeOffset;
static int64 nTimeOffset = 0;
int64 GetTimeOffset()
{
+ LOCK(cs_nTimeOffset);
return nTimeOffset;
}
@@ -1312,12 +1322,14 @@ void AddTimeData(const CNetAddr& ip, int64 nTime)
{
int64 nOffsetSample = nTime - GetTime();
+ LOCK(cs_nTimeOffset);
// Ignore duplicates
static set<CNetAddr> setKnown;
if (!setKnown.insert(ip).second)
return;
// Add data
+ static CMedianFilter<int64> vTimeOffsets(200,0);
vTimeOffsets.input(nOffsetSample);
LogPrintf("Added time data, samples %d, offset %+"PRI64d" (%+"PRI64d" minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60);
if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1)
diff --git a/src/util.h b/src/util.h
index 258910e2fb..2573694046 100644
--- a/src/util.h
+++ b/src/util.h
@@ -140,7 +140,6 @@ inline void MilliSleep(int64 n)
extern std::map<std::string, std::string> mapArgs;
extern std::map<std::string, std::vector<std::string> > mapMultiArgs;
extern bool fDebug;
-extern bool fDebugNet;
extern bool fPrintToConsole;
extern bool fPrintToDebugger;
extern bool fDaemon;
diff --git a/src/wallet.cpp b/src/wallet.cpp
index a7a2992bb9..ea1e01e6e9 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -505,7 +505,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn)
// Add a transaction to the wallet, or update it.
// pblock is optional, but should be provided if the transaction is known to be in a block.
// If fUpdate is true, existing transactions will be updated.
-bool CWallet::AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate, bool fFindBlock)
+bool CWallet::AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate)
{
{
LOCK(cs_wallet);
@@ -525,16 +525,20 @@ bool CWallet::AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction&
return false;
}
-bool CWallet::EraseFromWallet(uint256 hash)
+void CWallet::SyncTransaction(const uint256 &hash, const CTransaction& tx, const CBlock* pblock) {
+ AddToWalletIfInvolvingMe(hash, tx, pblock, true);
+}
+
+void CWallet::EraseFromWallet(const uint256 &hash)
{
if (!fFileBacked)
- return false;
+ return;
{
LOCK(cs_wallet);
if (mapWallet.erase(hash))
CWalletDB(strWalletFile).EraseTx(hash);
}
- return true;
+ return;
}
@@ -773,6 +777,25 @@ void CWalletTx::AddSupportingTransactions()
reverse(vtxPrev.begin(), vtxPrev.end());
}
+bool CWalletTx::AcceptWalletTransaction()
+{
+ {
+ LOCK(mempool.cs);
+ // Add previous supporting transactions first
+ BOOST_FOREACH(CMerkleTx& tx, vtxPrev)
+ {
+ if (!tx.IsCoinBase())
+ {
+ uint256 hash = tx.GetHash();
+ if (!mempool.exists(hash) && pcoinsTip->HaveCoins(hash))
+ tx.AcceptToMemoryPool(false);
+ }
+ }
+ return AcceptToMemoryPool(false);
+ }
+ return false;
+}
+
bool CWalletTx::WriteToDisk()
{
return CWalletDB(pwallet->strWalletFile).WriteTx(GetHash(), *this);
@@ -1485,33 +1508,6 @@ bool CWallet::DelAddressBook(const CTxDestination& address)
return CWalletDB(strWalletFile).EraseName(CBitcoinAddress(address).ToString());
}
-void CWallet::PrintWallet(const CBlock& block)
-{
- {
- LOCK(cs_wallet);
- if (mapWallet.count(block.vtx[0].GetHash()))
- {
- CWalletTx& wtx = mapWallet[block.vtx[0].GetHash()];
- LogPrintf(" mine: %d %d %"PRI64d"", wtx.GetDepthInMainChain(), wtx.GetBlocksToMaturity(), wtx.GetCredit());
- }
- }
- LogPrintf("\n");
-}
-
-bool CWallet::GetTransaction(const uint256 &hashTx, CWalletTx& wtx)
-{
- {
- LOCK(cs_wallet);
- map<uint256, CWalletTx>::iterator mi = mapWallet.find(hashTx);
- if (mi != mapWallet.end())
- {
- wtx = (*mi).second;
- return true;
- }
- }
- return false;
-}
-
bool CWallet::SetDefaultKey(const CPubKey &vchPubKey)
{
if (fFileBacked)
@@ -1523,14 +1519,6 @@ bool CWallet::SetDefaultKey(const CPubKey &vchPubKey)
return true;
}
-bool GetWalletFile(CWallet* pwallet, string &strWalletFileOut)
-{
- if (!pwallet->fFileBacked)
- return false;
- strWalletFileOut = pwallet->strWalletFile;
- return true;
-}
-
//
// Mark old keypool keys as used,
// and generate all new keys
diff --git a/src/wallet.h b/src/wallet.h
index f87e9b08c4..21510f8c39 100644
--- a/src/wallet.h
+++ b/src/wallet.h
@@ -80,7 +80,7 @@ public:
/** A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,
* and provides the ability to create new transactions.
*/
-class CWallet : public CCryptoKeyStore
+class CWallet : public CCryptoKeyStore, public CWalletInterface
{
private:
bool SelectCoins(int64 nTargetValue, std::set<std::pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64& nValueRet) const;
@@ -197,8 +197,9 @@ public:
void MarkDirty();
bool AddToWallet(const CWalletTx& wtxIn);
- bool AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate = false, bool fFindBlock = false);
- bool EraseFromWallet(uint256 hash);
+ void SyncTransaction(const uint256 &hash, const CTransaction& tx, const CBlock* pblock);
+ bool AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate);
+ void EraseFromWallet(const uint256 &hash);
void WalletUpdateSpent(const CTransaction& prevout);
int ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate = false);
void ReacceptWalletTransactions();
@@ -302,8 +303,6 @@ public:
void UpdatedTransaction(const uint256 &hashTx);
- void PrintWallet(const CBlock& block);
-
void Inventory(const uint256 &hash)
{
{
@@ -319,8 +318,6 @@ public:
return setKeyPool.size();
}
- bool GetTransaction(const uint256 &hashTx, CWalletTx& wtx);
-
bool SetDefaultKey(const CPubKey &vchPubKey);
// signify that a particular wallet feature is now used. this may change nWalletVersion and nWalletMaxVersion if those are lower
@@ -891,6 +888,4 @@ private:
std::vector<char> _ssExtra;
};
-bool GetWalletFile(CWallet* pwallet, std::string &strWalletFileOut);
-
#endif