diff --git a/configure.ac b/configure.ac index 4e3e0ea8b..919e8d370 100644 --- a/configure.ac +++ b/configure.ac @@ -2,9 +2,9 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 1) define(_CLIENT_VERSION_MINOR, 7) -define(_CLIENT_VERSION_REVISION, 0) +define(_CLIENT_VERSION_REVISION, 2) define(_CLIENT_VERSION_BUILD, 0) -define(_CLIENT_VERSION_IS_RELEASE, true) +define(_CLIENT_VERSION_IS_RELEASE, false) define(_COPYRIGHT_YEAR, 2014) AC_INIT([Dogecoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@dogecoin.com],[dogecoin]) AC_CONFIG_AUX_DIR([src/build-aux]) diff --git a/doc/README.md b/doc/README.md index 38f9b8501..9415a44ab 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,5 +1,5 @@ -Dogecoin 1.7 -===================== +Dogecoin 1.7.2 ALPHA +==================== * Copyright (c) 2009-2014 Bitcoin Developers * Copyright (c) 2011-2013 Litecoin Developers diff --git a/qa/pull-tester/build-tests.sh.in b/qa/pull-tester/build-tests.sh.in index 86d4d9d0e..e7db72111 100755 --- a/qa/pull-tester/build-tests.sh.in +++ b/qa/pull-tester/build-tests.sh.in @@ -1,4 +1,8 @@ #!/bin/bash +# Copyright (c) 2013 The Bitcoin Core developers +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. +# # Param1: The prefix to mingw staging # Param2: Path to java comparison tool # Param3: Number of make jobs. Defaults to 1. diff --git a/qa/pull-tester/pull-tester.py b/qa/pull-tester/pull-tester.py index b05ac2c52..61ce813d8 100755 --- a/qa/pull-tester/pull-tester.py +++ b/qa/pull-tester/pull-tester.py @@ -1,4 +1,8 @@ #!/usr/bin/python +# Copyright (c) 2013 The Bitcoin Core developers +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. +# import json from urllib import urlopen import requests diff --git a/qa/pull-tester/pull-tester.sh b/qa/pull-tester/pull-tester.sh index 13c800c16..bbee92967 100755 --- a/qa/pull-tester/pull-tester.sh +++ b/qa/pull-tester/pull-tester.sh @@ -1,4 +1,8 @@ #!/bin/sh +# Copyright (c) 2013 The Bitcoin Core developers +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. +# # Helper script for pull-tester. #Param 1: path to bitcoin srcroot #Param ...: arguments for build-test.sh diff --git a/qa/pull-tester/run-bitcoind-for-test.sh.in b/qa/pull-tester/run-bitcoind-for-test.sh.in index 25faf9c42..391046ab8 100755 --- a/qa/pull-tester/run-bitcoind-for-test.sh.in +++ b/qa/pull-tester/run-bitcoind-for-test.sh.in @@ -1,4 +1,8 @@ #!/bin/bash +# Copyright (c) 2013 The Bitcoin Core developers +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. +# DATADIR="@abs_top_builddir@/.bitcoin" rm -rf "$DATADIR" mkdir -p "$DATADIR"/regtest diff --git a/qa/rpc-tests/conflictedbalance.sh b/qa/rpc-tests/conflictedbalance.sh index 9d854d2d8..849ad31fb 100755 --- a/qa/rpc-tests/conflictedbalance.sh +++ b/qa/rpc-tests/conflictedbalance.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright (c) 2014 The Bitcoin Core developers +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. # Test marking of spent outputs diff --git a/qa/rpc-tests/listtransactions.py b/qa/rpc-tests/listtransactions.py index fec3acfbb..6ffee6bbe 100755 --- a/qa/rpc-tests/listtransactions.py +++ b/qa/rpc-tests/listtransactions.py @@ -1,4 +1,7 @@ #!/usr/bin/env python +# Copyright (c) 2014 The Bitcoin Core developers +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. # Exercise the listtransactions API diff --git a/qa/rpc-tests/send.sh b/qa/rpc-tests/send.sh index 2c0d5375c..bfbf791d0 100755 --- a/qa/rpc-tests/send.sh +++ b/qa/rpc-tests/send.sh @@ -1,4 +1,7 @@ #!/bin/bash +# Copyright (c) 2014 The Bitcoin Core developers +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. TIMEOUT=10 SIGNAL=HUP PIDFILE=.send.pid diff --git a/qa/rpc-tests/skeleton.py b/qa/rpc-tests/skeleton.py index 0bace6f4e..5d4b62e55 100755 --- a/qa/rpc-tests/skeleton.py +++ b/qa/rpc-tests/skeleton.py @@ -1,4 +1,7 @@ #!/usr/bin/env python +# Copyright (c) 2014 The Bitcoin Core developers +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. # Skeleton for python-based regression tests using # JSON-RPC diff --git a/qa/rpc-tests/txnmall.sh b/qa/rpc-tests/txnmall.sh index 11e027649..bd36967a6 100755 --- a/qa/rpc-tests/txnmall.sh +++ b/qa/rpc-tests/txnmall.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright (c) 2014 The Bitcoin Core developers +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. # Test proper accounting with malleable transactions diff --git a/qa/rpc-tests/util.py b/qa/rpc-tests/util.py index fbb27ae2d..6184c1fba 100644 --- a/qa/rpc-tests/util.py +++ b/qa/rpc-tests/util.py @@ -1,3 +1,6 @@ +# Copyright (c) 2014 The Bitcoin Core developers +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Helpful routines for regression testing # diff --git a/qa/rpc-tests/util.sh b/qa/rpc-tests/util.sh index 9001c42fb..1e7bd6a7e 100644 --- a/qa/rpc-tests/util.sh +++ b/qa/rpc-tests/util.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright (c) 2014 The Bitcoin Core developers +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. # Functions used by more than one test diff --git a/qa/rpc-tests/wallet.sh b/qa/rpc-tests/wallet.sh index 2940566af..98532fa85 100755 --- a/qa/rpc-tests/wallet.sh +++ b/qa/rpc-tests/wallet.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright (c) 2013-2014 The Bitcoin Core developers +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. # Test block generation and basic wallet sending diff --git a/qa/rpc-tests/walletbackup.sh b/qa/rpc-tests/walletbackup.sh index 9207243b6..744467098 100755 --- a/qa/rpc-tests/walletbackup.sh +++ b/qa/rpc-tests/walletbackup.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright (c) 2014 The Bitcoin Core developers +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. # Test wallet backup / dump / restore functionality diff --git a/src/alert.cpp b/src/alert.cpp index 46e861be9..99164d63e 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -10,6 +10,7 @@ #include "ui_interface.h" #include "util.h" +#include #include #include diff --git a/src/clientversion.h b/src/clientversion.h index 3bdfe202f..cfd4df4fa 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -11,11 +11,11 @@ // These need to be macros, as version.cpp's and dogecoin-qt.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 1 #define CLIENT_VERSION_MINOR 7 -#define CLIENT_VERSION_REVISION 0 +#define CLIENT_VERSION_REVISION 2 #define CLIENT_VERSION_BUILD 0 // Set to true for release, false for prerelease or test build -#define CLIENT_VERSION_IS_RELEASE true +#define CLIENT_VERSION_IS_RELEASE false // Copyright year (2009-this) // Todo: update this when changing our copyright comments in the source diff --git a/src/init.cpp b/src/init.cpp index c8d243dd8..a8756945d 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -594,7 +594,7 @@ bool AppInit2(boost::thread_group& threadGroup) if (file) fclose(file); static boost::interprocess::file_lock lock(pathLockFile.string().c_str()); if (!lock.try_lock()) - return InitError(strprintf(_("Cannot obtain a lock on data directory %s. Dogecoin is probably already running."), strDataDir)); + return InitError(strprintf(_("Cannot obtain a lock on data directory %s. Dogecoin Core is probably already running."), strDataDir)); if (GetBoolArg("-shrinkdebugfile", !fDebug)) ShrinkDebugFile(); diff --git a/src/main.cpp b/src/main.cpp index 5b83a6d44..fa6ed2678 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1849,7 +1849,7 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%d vs limit=%d)", block.vtx[0].GetValueOut(), GetBlockValue(pindex->nHeight, nFees, prevHash)), - REJECT_INVALID, "bad-cb-amount"); + REJECT_INVALID, "bad-cb-amount"); if (!control.Wait()) return state.DoS(100, false); @@ -3277,14 +3277,14 @@ void static ProcessGetData(CNode* pfrom) int nHeight = mi->second->nHeight; CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(mapBlockIndex); if (pcheckpoint && nHeight < pcheckpoint->nHeight) { - if (!chainActive.Contains(mi->second)) - { - LogPrintf("ProcessGetData(): ignoring request for old block that isn't in the main chain\n"); - } else { - send = true; - } + if (!chainActive.Contains(mi->second)) + { + LogPrintf("ProcessGetData(): ignoring request for old block that isn't in the main chain\n"); + } else { + send = true; + } } else { - send = true; + send = true; } } if (send) @@ -3804,7 +3804,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) } int nDoS = 0; if (state.IsInvalid(nDoS)) - { + { LogPrint("mempool", "%s from %s %s was not accepted into the memory pool: %s\n", tx.GetHash().ToString(), pfrom->addr.ToString(), pfrom->cleanSubVer, state.GetRejectReason()); diff --git a/src/main.h b/src/main.h index 542252051..a49526f39 100644 --- a/src/main.h +++ b/src/main.h @@ -438,6 +438,7 @@ class CMerkleTx : public CTransaction { private: int GetDepthInMainChainINTERNAL(CBlockIndex* &pindexRet) const; + public: uint256 hashBlock; std::vector vMerkleBranch; diff --git a/src/qt/Makefile.am b/src/qt/Makefile.am index 02f910635..bc2536284 100644 --- a/src/qt/Makefile.am +++ b/src/qt/Makefile.am @@ -7,8 +7,8 @@ AM_CPPFLAGS += -I$(top_srcdir)/src \ $(QR_CFLAGS) bin_PROGRAMS = dogecoin-qt noinst_LIBRARIES = libbitcoinqt.a -SUBDIRS = $(BUILD_TEST_QT) -DIST_SUBDIRS = test +SUBDIRS = . $(BUILD_TEST_QT) +DIST_SUBDIRS = . test # dogecoin qt core # QT_TS = \ diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index 495152941..ff55f6937 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -114,7 +114,7 @@ public: case CT_NEW: if(inModel) { - qDebug() << "AddressTablePriv::updateEntry : Warning: Got CT_NOW, but entry is already in model"; + qDebug() << "AddressTablePriv::updateEntry : Warning: Got CT_NEW, but entry is already in model"; break; } parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex); diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index d4e7102b4..49655939e 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -386,6 +385,18 @@ void CoinControlDialog::viewItemChanged(QTreeWidgetItem* item, int column) if (ui->treeWidget->isEnabled()) // do not update on every click for (un)select all CoinControlDialog::updateLabels(model, this); } + + // todo: this is a temporary qt5 fix: when clicking a parent node in tree mode, the parent node + // including all childs are partially selected. But the parent node should be fully selected + // as well as the childs. Childs should never be partially selected in the first place. + // Please remove this ugly fix, once the bug is solved upstream. +#if QT_VERSION >= 0x050000 + else if (column == COLUMN_CHECKBOX && item->childCount() > 0) + { + if (item->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked && item->child(0)->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked) + item->setCheckState(COLUMN_CHECKBOX, Qt::Checked); + } +#endif } // return human readable label for priority number @@ -662,9 +673,6 @@ void CoinControlDialog::updateView() itemWalletAddress->setFlags(flgTristate); itemWalletAddress->setCheckState(COLUMN_CHECKBOX,Qt::Unchecked); - for (int i = 0; i < ui->treeWidget->columnCount(); i++) - itemWalletAddress->setBackground(i, QColor(248, 247, 246)); - // label itemWalletAddress->setText(COLUMN_LABEL, sWalletLabel); diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index f3b63dbdf..352db166d 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -30,6 +30,11 @@ OptionsModel::OptionsModel(QObject *parent) : Init(); } +void OptionsModel::addOverriddenOption(const std::string &option) +{ + strOverriddenByCommandLine += QString::fromStdString(option) + "=" + QString::fromStdString(mapArgs[option]) + " "; +} + // Writes all missing QSettings with their default values void OptionsModel::Init() { @@ -78,23 +83,23 @@ void OptionsModel::Init() settings.setValue("nTransactionFee", 0); nTransactionFee = settings.value("nTransactionFee").toLongLong(); // if -paytxfee is set, this will be overridden later in init.cpp if (mapArgs.count("-paytxfee")) - strOverriddenByCommandLine += "-paytxfee "; + addOverriddenOption("-paytxfee"); if (!settings.contains("bSpendZeroConfChange")) settings.setValue("bSpendZeroConfChange", true); if (!SoftSetBoolArg("-spendzeroconfchange", settings.value("bSpendZeroConfChange").toBool())) - strOverriddenByCommandLine += "-spendzeroconfchange "; + addOverriddenOption("-spendzeroconfchange"); #endif if (!settings.contains("nDatabaseCache")) settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache); if (!SoftSetArg("-dbcache", settings.value("nDatabaseCache").toString().toStdString())) - strOverriddenByCommandLine += "-dbcache "; + addOverriddenOption("-dbcache"); if (!settings.contains("nThreadsScriptVerif")) settings.setValue("nThreadsScriptVerif", 0); if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString())) - strOverriddenByCommandLine += "-par "; + addOverriddenOption("-par"); // Network if (!settings.contains("fUseUPnP")) @@ -102,9 +107,9 @@ void OptionsModel::Init() settings.setValue("fUseUPnP", true); #else settings.setValue("fUseUPnP", false); -#endif +#endif if (!SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool())) - strOverriddenByCommandLine += "-upnp "; + addOverriddenOption("-upnp"); if (!settings.contains("fUseProxy")) settings.setValue("fUseProxy", false); @@ -112,18 +117,18 @@ void OptionsModel::Init() settings.setValue("addrProxy", "127.0.0.1:9050"); // Only try to set -proxy, if user has enabled fUseProxy if (settings.value("fUseProxy").toBool() && !SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString())) - strOverriddenByCommandLine += "-proxy "; + addOverriddenOption("-proxy"); if (!settings.contains("nSocksVersion")) settings.setValue("nSocksVersion", 5); // Only try to set -socks, if user has enabled fUseProxy if (settings.value("fUseProxy").toBool() && !SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString())) - strOverriddenByCommandLine += "-socks "; + addOverriddenOption("-socks"); // Display if (!settings.contains("language")) settings.setValue("language", ""); if (!SoftSetArg("-lang", settings.value("language").toString().toStdString())) - strOverriddenByCommandLine += "-lang"; + addOverriddenOption("-lang"); language = settings.value("language").toString(); } diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index a3487ddd2..ece5ef78a 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -75,6 +75,9 @@ private: /* settings that were overriden by command-line */ QString strOverriddenByCommandLine; + /// Add option to list of GUI options overridden through command line/config file + void addOverriddenOption(const std::string &option); + signals: void displayUnitChanged(int unit); void transactionFeeChanged(qint64); diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index 0cb17c510..30a09772a 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -195,8 +195,10 @@ void SendCoinsEntry::setValue(const SendCoinsRecipient &value) ui->messageTextLabel->setVisible(!recipient.message.isEmpty()); ui->messageLabel->setVisible(!recipient.message.isEmpty()); - ui->payTo->setText(recipient.address); - ui->addAsLabel->setText(recipient.label); + ui->addAsLabel->clear(); + ui->payTo->setText(recipient.address); // this may set a label from addressbook + if (!recipient.label.isEmpty()) // if a label had been set from the addressbook, dont overwrite with an empty label + ui->addAsLabel->setText(recipient.label); ui->payAmount->setValue(recipient.amount); } } diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp index c1dccb87a..c8326fe82 100644 --- a/src/rpcdump.cpp +++ b/src/rpcdump.cpp @@ -213,6 +213,9 @@ Value importwallet(const Array& params, bool fHelp) while (pindex && pindex->pprev && pindex->nTime > nTimeBegin - 7200) pindex = pindex->pprev; + if (!pwalletMain->nTimeFirstKey || nTimeBegin < pwalletMain->nTimeFirstKey) + pwalletMain->nTimeFirstKey = nTimeBegin; + LogPrintf("Rescanning last %i blocks\n", chainActive.Height() - pindex->nHeight + 1); pwalletMain->ScanForWalletTransactions(pindex); pwalletMain->MarkDirty(); diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 0a70937d5..ffe5decd6 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -46,8 +46,9 @@ Value getinfo(const Array& params, bool fHelp) " \"testnet\": true|false, (boolean) if the server is using testnet or not\n" " \"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since GMT epoch) of the oldest pre-generated key in the key pool\n" " \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated\n" - " \"paytxfee\": x.xxxx, (numeric) the transaction fee set in doge\n" " \"unlocked_until\": ttt, (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked\n" + " \"paytxfee\": x.xxxx, (numeric) the transaction fee set in doge/kb\n" + " \"relayfee\": x.xxxx, (numeric) minimum relay fee for non-free transactions in doge/kb\n" " \"errors\": \"...\" (string) any error messages\n" "}\n" "\nExamples:\n" @@ -78,10 +79,11 @@ Value getinfo(const Array& params, bool fHelp) obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime())); obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize())); } - obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee))); if (pwalletMain && pwalletMain->IsCrypted()) obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime)); + obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee))); #endif + obj.push_back(Pair("relayfee", ValueFromAmount(CTransaction::nMinRelayTxFee))); obj.push_back(Pair("errors", GetWarnings("statusbar"))); return obj; } diff --git a/src/test/Checkpoints_tests.cpp b/src/test/Checkpoints_tests.cpp index 980bfce48..a0515a8a9 100644 --- a/src/test/Checkpoints_tests.cpp +++ b/src/test/Checkpoints_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2011-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + // // Unit tests for block-chain checkpoints // diff --git a/src/test/DoS_tests.cpp b/src/test/DoS_tests.cpp index c92a18500..e62fcbc5a 100644 --- a/src/test/DoS_tests.cpp +++ b/src/test/DoS_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2011-2014 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + // // Unit tests for denial-of-service detection/prevention code // diff --git a/src/test/accounting_tests.cpp b/src/test/accounting_tests.cpp index bfdb95927..e2a75da34 100644 --- a/src/test/accounting_tests.cpp +++ b/src/test/accounting_tests.cpp @@ -1,4 +1,6 @@ - +// Copyright (c) 2012-2014 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "wallet.h" #include "walletdb.h" diff --git a/src/test/alert_tests.cpp b/src/test/alert_tests.cpp index a4ee6cac5..fc3a17184 100644 --- a/src/test/alert_tests.cpp +++ b/src/test/alert_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + // // Unit tests for alert system // diff --git a/src/test/allocator_tests.cpp b/src/test/allocator_tests.cpp index 490dff87e..2752a0b21 100644 --- a/src/test/allocator_tests.cpp +++ b/src/test/allocator_tests.cpp @@ -1,4 +1,6 @@ - +// Copyright (c) 2012-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "util.h" diff --git a/src/test/base32_tests.cpp b/src/test/base32_tests.cpp index 580e87f65..87473585e 100644 --- a/src/test/base32_tests.cpp +++ b/src/test/base32_tests.cpp @@ -1,4 +1,6 @@ - +// Copyright (c) 2012-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "util.h" diff --git a/src/test/base58_tests.cpp b/src/test/base58_tests.cpp index 94e84049b..5689e6999 100644 --- a/src/test/base58_tests.cpp +++ b/src/test/base58_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2011-2014 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "base58.h" #include "data/base58_encode_decode.json.h" diff --git a/src/test/base64_tests.cpp b/src/test/base64_tests.cpp index c59c29066..d4a23d9aa 100644 --- a/src/test/base64_tests.cpp +++ b/src/test/base64_tests.cpp @@ -1,4 +1,6 @@ - +// Copyright (c) 2011-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "util.h" diff --git a/src/test/bignum_tests.cpp b/src/test/bignum_tests.cpp index 205b15adc..6587389a0 100644 --- a/src/test/bignum_tests.cpp +++ b/src/test/bignum_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2012-2014 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "bignum.h" #include diff --git a/src/test/bip32_tests.cpp b/src/test/bip32_tests.cpp index 2bcca2433..9cf07fc38 100644 --- a/src/test/bip32_tests.cpp +++ b/src/test/bip32_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include #include "base58.h" diff --git a/src/test/bloom_tests.cpp b/src/test/bloom_tests.cpp index e4e16e44a..84da11367 100644 --- a/src/test/bloom_tests.cpp +++ b/src/test/bloom_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2012-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "bloom.h" #include "base58.h" diff --git a/src/test/canonical_tests.cpp b/src/test/canonical_tests.cpp index c521f2cf9..a26ad335a 100644 --- a/src/test/canonical_tests.cpp +++ b/src/test/canonical_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2012-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + // // Unit tests for canonical signatures // diff --git a/src/test/checkblock_tests.cpp b/src/test/checkblock_tests.cpp index d47a33fd4..10352240f 100644 --- a/src/test/checkblock_tests.cpp +++ b/src/test/checkblock_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2013-2014 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + // // Unit tests for block.CheckBlock() // @@ -15,8 +19,7 @@ BOOST_AUTO_TEST_SUITE(CheckBlock_tests) -bool -read_block(const std::string& filename, CBlock& block) +bool read_block(const std::string& filename, CBlock& block) { namespace fs = boost::filesystem; fs::path testFile = fs::current_path() / "data" / filename; diff --git a/src/test/compress_tests.cpp b/src/test/compress_tests.cpp index 4d1691477..719955ba8 100644 --- a/src/test/compress_tests.cpp +++ b/src/test/compress_tests.cpp @@ -1,4 +1,6 @@ - +// Copyright (c) 2012-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "main.h" #include "util.h" diff --git a/src/test/data/README.md b/src/test/data/README.md new file mode 100644 index 000000000..f69a021ca --- /dev/null +++ b/src/test/data/README.md @@ -0,0 +1,14 @@ +Description +------------ + +This directory contains data-driven tests for various aspects of Bitcoin. + +License +-------- + +The data files in this directory are + + Copyright (c) 2012-2014 The Bitcoin Core developers + Distributed under the MIT/X11 software license, see the accompanying + file COPYING or http://www.opensource.org/licenses/mit-license.php. + diff --git a/src/test/getarg_tests.cpp b/src/test/getarg_tests.cpp index d76124885..8cadcdd71 100644 --- a/src/test/getarg_tests.cpp +++ b/src/test/getarg_tests.cpp @@ -1,4 +1,6 @@ - +// Copyright (c) 2012-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "util.h" diff --git a/src/test/hash_tests.cpp b/src/test/hash_tests.cpp index 28410f0fe..4568c8769 100644 --- a/src/test/hash_tests.cpp +++ b/src/test/hash_tests.cpp @@ -1,4 +1,6 @@ - +// Copyright (c) 2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "hash.h" #include "util.h" diff --git a/src/test/hmac_tests.cpp b/src/test/hmac_tests.cpp index 68868866a..780ce480c 100644 --- a/src/test/hmac_tests.cpp +++ b/src/test/hmac_tests.cpp @@ -1,4 +1,6 @@ - +// Copyright (c) 2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "hash.h" #include "util.h" diff --git a/src/test/key_tests.cpp b/src/test/key_tests.cpp index e4caab8f0..c378ce6c5 100644 --- a/src/test/key_tests.cpp +++ b/src/test/key_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2012-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "key.h" #include "base58.h" diff --git a/src/test/main_tests.cpp b/src/test/main_tests.cpp index 794ff5290..8f22ed723 100644 --- a/src/test/main_tests.cpp +++ b/src/test/main_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2014 The Bitcoin Core 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 "main.h" #include "uint256.h" diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp index b0ed3b09a..b16b9758e 100644 --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -1,4 +1,6 @@ - +// Copyright (c) 2011-2014 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "main.h" #include "miner.h" diff --git a/src/test/mruset_tests.cpp b/src/test/mruset_tests.cpp index 638c88fab..60f11c147 100644 --- a/src/test/mruset_tests.cpp +++ b/src/test/mruset_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2012-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "mruset.h" #include "util.h" diff --git a/src/test/multisig_tests.cpp b/src/test/multisig_tests.cpp index 772217b88..3775abd63 100644 --- a/src/test/multisig_tests.cpp +++ b/src/test/multisig_tests.cpp @@ -1,4 +1,6 @@ - +// Copyright (c) 2011-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "key.h" #include "keystore.h" diff --git a/src/test/netbase_tests.cpp b/src/test/netbase_tests.cpp index 412ba0491..7d3870073 100644 --- a/src/test/netbase_tests.cpp +++ b/src/test/netbase_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2012-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "netbase.h" #include diff --git a/src/test/pmt_tests.cpp b/src/test/pmt_tests.cpp index dea5e1b82..7d7e6681d 100644 --- a/src/test/pmt_tests.cpp +++ b/src/test/pmt_tests.cpp @@ -1,4 +1,6 @@ - +// Copyright (c) 2012-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "main.h" #include "serialize.h" diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp index 21e476cee..236cab5a7 100644 --- a/src/test/rpc_tests.cpp +++ b/src/test/rpc_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2012-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "rpcserver.h" #include "rpcclient.h" diff --git a/src/test/rpc_wallet_tests.cpp b/src/test/rpc_wallet_tests.cpp index 628ba9506..af34e496e 100644 --- a/src/test/rpc_wallet_tests.cpp +++ b/src/test/rpc_wallet_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2013-2014 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "rpcserver.h" #include "rpcclient.h" diff --git a/src/test/script_P2SH_tests.cpp b/src/test/script_P2SH_tests.cpp index e57dc9bbb..03dbdde57 100644 --- a/src/test/script_P2SH_tests.cpp +++ b/src/test/script_P2SH_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2012-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "script.h" #include "key.h" diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp index dd1b61304..7bc2bfb6d 100644 --- a/src/test/script_tests.cpp +++ b/src/test/script_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2011-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "script.h" #include "data/script_invalid.json.h" diff --git a/src/test/serialize_tests.cpp b/src/test/serialize_tests.cpp index 415f95781..867a7df88 100644 --- a/src/test/serialize_tests.cpp +++ b/src/test/serialize_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2012-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "serialize.h" #include diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp index f098d4618..04b93fb10 100644 --- a/src/test/sighash_tests.cpp +++ b/src/test/sighash_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include #include "main.h" diff --git a/src/test/sigopcount_tests.cpp b/src/test/sigopcount_tests.cpp index 96f663cce..722f14a98 100644 --- a/src/test/sigopcount_tests.cpp +++ b/src/test/sigopcount_tests.cpp @@ -1,4 +1,6 @@ - +// Copyright (c) 2012-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "key.h" #include "script.h" diff --git a/src/test/test_dogecoin.cpp b/src/test/test_dogecoin.cpp index 96d071240..3b75aad14 100644 --- a/src/test/test_dogecoin.cpp +++ b/src/test/test_dogecoin.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2011-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #define BOOST_TEST_MODULE Bitcoin Test Suite diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index e30c322cc..0d09324ec 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -1,4 +1,6 @@ - +// Copyright (c) 2011-2014 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "data/tx_invalid.json.h" #include "data/tx_valid.json.h" diff --git a/src/test/uint256_tests.cpp b/src/test/uint256_tests.cpp index 368484fdf..815babf10 100644 --- a/src/test/uint256_tests.cpp +++ b/src/test/uint256_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2011-2013 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include #include #include diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index 706737b11..b8f107f64 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2011-2014 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "util.h" #include "sync.h" diff --git a/src/test/wallet_tests.cpp b/src/test/wallet_tests.cpp index b32daba99..59a958005 100644 --- a/src/test/wallet_tests.cpp +++ b/src/test/wallet_tests.cpp @@ -1,3 +1,7 @@ +// Copyright (c) 2012-2014 The Bitcoin Core developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + #include "wallet.h" #include diff --git a/src/wallet.cpp b/src/wallet.cpp index feeee86ce..8fab1f08b 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -591,7 +591,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet) bool CWallet::AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate) { { - LOCK(cs_wallet); + AssertLockHeld(cs_wallet); bool fExisted = mapWallet.count(hash); if (fExisted && !fUpdate) return false; if (fExisted || IsMine(tx) || IsFromMe(tx)) @@ -608,9 +608,8 @@ bool CWallet::AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction& void CWallet::SyncTransaction(const uint256 &hash, const CTransaction& tx, const CBlock* pblock) { - AddToWalletIfInvolvingMe(hash, tx, pblock, true); - - if (mapWallet.count(hash) == 0) + LOCK(cs_wallet); + if (!AddToWalletIfInvolvingMe(hash, tx, pblock, true)) return; // Not one of ours // If a transaction changes 'conflicted' state, that changes the balance