Merge pull request #525 from rnicoll/1.7.2-dev

Merge Bitcoin 0.9.2 patches into Dogecoin
This commit is contained in:
langerhans 2014-05-19 14:28:28 +02:00
commit 79cd57af87
66 changed files with 253 additions and 55 deletions

View file

@ -2,9 +2,9 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60]) AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 1) define(_CLIENT_VERSION_MAJOR, 1)
define(_CLIENT_VERSION_MINOR, 7) define(_CLIENT_VERSION_MINOR, 7)
define(_CLIENT_VERSION_REVISION, 0) define(_CLIENT_VERSION_REVISION, 2)
define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true) define(_CLIENT_VERSION_IS_RELEASE, false)
define(_COPYRIGHT_YEAR, 2014) define(_COPYRIGHT_YEAR, 2014)
AC_INIT([Dogecoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@dogecoin.com],[dogecoin]) AC_INIT([Dogecoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@dogecoin.com],[dogecoin])
AC_CONFIG_AUX_DIR([src/build-aux]) AC_CONFIG_AUX_DIR([src/build-aux])

View file

@ -1,5 +1,5 @@
Dogecoin 1.7 Dogecoin 1.7.2 ALPHA
===================== ====================
* Copyright (c) 2009-2014 Bitcoin Developers * Copyright (c) 2009-2014 Bitcoin Developers
* Copyright (c) 2011-2013 Litecoin Developers * Copyright (c) 2011-2013 Litecoin Developers

View file

@ -1,4 +1,8 @@
#!/bin/bash #!/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 # Param1: The prefix to mingw staging
# Param2: Path to java comparison tool # Param2: Path to java comparison tool
# Param3: Number of make jobs. Defaults to 1. # Param3: Number of make jobs. Defaults to 1.

View file

@ -1,4 +1,8 @@
#!/usr/bin/python #!/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 import json
from urllib import urlopen from urllib import urlopen
import requests import requests

View file

@ -1,4 +1,8 @@
#!/bin/sh #!/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. # Helper script for pull-tester.
#Param 1: path to bitcoin srcroot #Param 1: path to bitcoin srcroot
#Param ...: arguments for build-test.sh #Param ...: arguments for build-test.sh

View file

@ -1,4 +1,8 @@
#!/bin/bash #!/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" DATADIR="@abs_top_builddir@/.bitcoin"
rm -rf "$DATADIR" rm -rf "$DATADIR"
mkdir -p "$DATADIR"/regtest mkdir -p "$DATADIR"/regtest

View file

@ -1,4 +1,7 @@
#!/usr/bin/env bash #!/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 # Test marking of spent outputs

View file

@ -1,4 +1,7 @@
#!/usr/bin/env python #!/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 # Exercise the listtransactions API

View file

@ -1,4 +1,7 @@
#!/bin/bash #!/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 TIMEOUT=10
SIGNAL=HUP SIGNAL=HUP
PIDFILE=.send.pid PIDFILE=.send.pid

View file

@ -1,4 +1,7 @@
#!/usr/bin/env python #!/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 # Skeleton for python-based regression tests using
# JSON-RPC # JSON-RPC

View file

@ -1,4 +1,7 @@
#!/usr/bin/env bash #!/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 # Test proper accounting with malleable transactions

View file

@ -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 # Helpful routines for regression testing
# #

View file

@ -1,4 +1,7 @@
#!/usr/bin/env bash #!/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 # Functions used by more than one test

View file

@ -1,4 +1,7 @@
#!/usr/bin/env bash #!/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 # Test block generation and basic wallet sending

View file

@ -1,4 +1,7 @@
#!/usr/bin/env bash #!/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 # Test wallet backup / dump / restore functionality

View file

@ -10,6 +10,7 @@
#include "ui_interface.h" #include "ui_interface.h"
#include "util.h" #include "util.h"
#include <stdint.h>
#include <algorithm> #include <algorithm>
#include <map> #include <map>

View file

@ -11,11 +11,11 @@
// These need to be macros, as version.cpp's and dogecoin-qt.rc's voodoo requires it // 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_MAJOR 1
#define CLIENT_VERSION_MINOR 7 #define CLIENT_VERSION_MINOR 7
#define CLIENT_VERSION_REVISION 0 #define CLIENT_VERSION_REVISION 2
#define CLIENT_VERSION_BUILD 0 #define CLIENT_VERSION_BUILD 0
// Set to true for release, false for prerelease or test build // 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) // Copyright year (2009-this)
// Todo: update this when changing our copyright comments in the source // Todo: update this when changing our copyright comments in the source

View file

@ -594,7 +594,7 @@ bool AppInit2(boost::thread_group& threadGroup)
if (file) fclose(file); if (file) fclose(file);
static boost::interprocess::file_lock lock(pathLockFile.string().c_str()); static boost::interprocess::file_lock lock(pathLockFile.string().c_str());
if (!lock.try_lock()) 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)) if (GetBoolArg("-shrinkdebugfile", !fDebug))
ShrinkDebugFile(); ShrinkDebugFile();

View file

@ -1849,7 +1849,7 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C
return state.DoS(100, return state.DoS(100,
error("ConnectBlock() : coinbase pays too much (actual=%d vs limit=%d)", error("ConnectBlock() : coinbase pays too much (actual=%d vs limit=%d)",
block.vtx[0].GetValueOut(), GetBlockValue(pindex->nHeight, nFees, prevHash)), block.vtx[0].GetValueOut(), GetBlockValue(pindex->nHeight, nFees, prevHash)),
REJECT_INVALID, "bad-cb-amount"); REJECT_INVALID, "bad-cb-amount");
if (!control.Wait()) if (!control.Wait())
return state.DoS(100, false); return state.DoS(100, false);
@ -3277,14 +3277,14 @@ void static ProcessGetData(CNode* pfrom)
int nHeight = mi->second->nHeight; int nHeight = mi->second->nHeight;
CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(mapBlockIndex); CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(mapBlockIndex);
if (pcheckpoint && nHeight < pcheckpoint->nHeight) { if (pcheckpoint && nHeight < pcheckpoint->nHeight) {
if (!chainActive.Contains(mi->second)) if (!chainActive.Contains(mi->second))
{ {
LogPrintf("ProcessGetData(): ignoring request for old block that isn't in the main chain\n"); LogPrintf("ProcessGetData(): ignoring request for old block that isn't in the main chain\n");
} else { } else {
send = true; send = true;
} }
} else { } else {
send = true; send = true;
} }
} }
if (send) if (send)
@ -3804,7 +3804,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
} }
int nDoS = 0; int nDoS = 0;
if (state.IsInvalid(nDoS)) if (state.IsInvalid(nDoS))
{ {
LogPrint("mempool", "%s from %s %s was not accepted into the memory pool: %s\n", tx.GetHash().ToString(), LogPrint("mempool", "%s from %s %s was not accepted into the memory pool: %s\n", tx.GetHash().ToString(),
pfrom->addr.ToString(), pfrom->cleanSubVer, pfrom->addr.ToString(), pfrom->cleanSubVer,
state.GetRejectReason()); state.GetRejectReason());

View file

@ -438,6 +438,7 @@ class CMerkleTx : public CTransaction
{ {
private: private:
int GetDepthInMainChainINTERNAL(CBlockIndex* &pindexRet) const; int GetDepthInMainChainINTERNAL(CBlockIndex* &pindexRet) const;
public: public:
uint256 hashBlock; uint256 hashBlock;
std::vector<uint256> vMerkleBranch; std::vector<uint256> vMerkleBranch;

View file

@ -7,8 +7,8 @@ AM_CPPFLAGS += -I$(top_srcdir)/src \
$(QR_CFLAGS) $(QR_CFLAGS)
bin_PROGRAMS = dogecoin-qt bin_PROGRAMS = dogecoin-qt
noinst_LIBRARIES = libbitcoinqt.a noinst_LIBRARIES = libbitcoinqt.a
SUBDIRS = $(BUILD_TEST_QT) SUBDIRS = . $(BUILD_TEST_QT)
DIST_SUBDIRS = test DIST_SUBDIRS = . test
# dogecoin qt core # # dogecoin qt core #
QT_TS = \ QT_TS = \

View file

@ -114,7 +114,7 @@ public:
case CT_NEW: case CT_NEW:
if(inModel) 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; break;
} }
parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex); parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex);

View file

@ -18,7 +18,6 @@
#include <QApplication> #include <QApplication>
#include <QCheckBox> #include <QCheckBox>
#include <QColor>
#include <QCursor> #include <QCursor>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QFlags> #include <QFlags>
@ -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 if (ui->treeWidget->isEnabled()) // do not update on every click for (un)select all
CoinControlDialog::updateLabels(model, this); 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 // return human readable label for priority number
@ -662,9 +673,6 @@ void CoinControlDialog::updateView()
itemWalletAddress->setFlags(flgTristate); itemWalletAddress->setFlags(flgTristate);
itemWalletAddress->setCheckState(COLUMN_CHECKBOX,Qt::Unchecked); itemWalletAddress->setCheckState(COLUMN_CHECKBOX,Qt::Unchecked);
for (int i = 0; i < ui->treeWidget->columnCount(); i++)
itemWalletAddress->setBackground(i, QColor(248, 247, 246));
// label // label
itemWalletAddress->setText(COLUMN_LABEL, sWalletLabel); itemWalletAddress->setText(COLUMN_LABEL, sWalletLabel);

View file

@ -30,6 +30,11 @@ OptionsModel::OptionsModel(QObject *parent) :
Init(); Init();
} }
void OptionsModel::addOverriddenOption(const std::string &option)
{
strOverriddenByCommandLine += QString::fromStdString(option) + "=" + QString::fromStdString(mapArgs[option]) + " ";
}
// Writes all missing QSettings with their default values // Writes all missing QSettings with their default values
void OptionsModel::Init() void OptionsModel::Init()
{ {
@ -78,23 +83,23 @@ void OptionsModel::Init()
settings.setValue("nTransactionFee", 0); settings.setValue("nTransactionFee", 0);
nTransactionFee = settings.value("nTransactionFee").toLongLong(); // if -paytxfee is set, this will be overridden later in init.cpp nTransactionFee = settings.value("nTransactionFee").toLongLong(); // if -paytxfee is set, this will be overridden later in init.cpp
if (mapArgs.count("-paytxfee")) if (mapArgs.count("-paytxfee"))
strOverriddenByCommandLine += "-paytxfee "; addOverriddenOption("-paytxfee");
if (!settings.contains("bSpendZeroConfChange")) if (!settings.contains("bSpendZeroConfChange"))
settings.setValue("bSpendZeroConfChange", true); settings.setValue("bSpendZeroConfChange", true);
if (!SoftSetBoolArg("-spendzeroconfchange", settings.value("bSpendZeroConfChange").toBool())) if (!SoftSetBoolArg("-spendzeroconfchange", settings.value("bSpendZeroConfChange").toBool()))
strOverriddenByCommandLine += "-spendzeroconfchange "; addOverriddenOption("-spendzeroconfchange");
#endif #endif
if (!settings.contains("nDatabaseCache")) if (!settings.contains("nDatabaseCache"))
settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache); settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache);
if (!SoftSetArg("-dbcache", settings.value("nDatabaseCache").toString().toStdString())) if (!SoftSetArg("-dbcache", settings.value("nDatabaseCache").toString().toStdString()))
strOverriddenByCommandLine += "-dbcache "; addOverriddenOption("-dbcache");
if (!settings.contains("nThreadsScriptVerif")) if (!settings.contains("nThreadsScriptVerif"))
settings.setValue("nThreadsScriptVerif", 0); settings.setValue("nThreadsScriptVerif", 0);
if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString())) if (!SoftSetArg("-par", settings.value("nThreadsScriptVerif").toString().toStdString()))
strOverriddenByCommandLine += "-par "; addOverriddenOption("-par");
// Network // Network
if (!settings.contains("fUseUPnP")) if (!settings.contains("fUseUPnP"))
@ -102,9 +107,9 @@ void OptionsModel::Init()
settings.setValue("fUseUPnP", true); settings.setValue("fUseUPnP", true);
#else #else
settings.setValue("fUseUPnP", false); settings.setValue("fUseUPnP", false);
#endif #endif
if (!SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool())) if (!SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool()))
strOverriddenByCommandLine += "-upnp "; addOverriddenOption("-upnp");
if (!settings.contains("fUseProxy")) if (!settings.contains("fUseProxy"))
settings.setValue("fUseProxy", false); settings.setValue("fUseProxy", false);
@ -112,18 +117,18 @@ void OptionsModel::Init()
settings.setValue("addrProxy", "127.0.0.1:9050"); settings.setValue("addrProxy", "127.0.0.1:9050");
// Only try to set -proxy, if user has enabled fUseProxy // Only try to set -proxy, if user has enabled fUseProxy
if (settings.value("fUseProxy").toBool() && !SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString())) if (settings.value("fUseProxy").toBool() && !SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString()))
strOverriddenByCommandLine += "-proxy "; addOverriddenOption("-proxy");
if (!settings.contains("nSocksVersion")) if (!settings.contains("nSocksVersion"))
settings.setValue("nSocksVersion", 5); settings.setValue("nSocksVersion", 5);
// Only try to set -socks, if user has enabled fUseProxy // Only try to set -socks, if user has enabled fUseProxy
if (settings.value("fUseProxy").toBool() && !SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString())) if (settings.value("fUseProxy").toBool() && !SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString()))
strOverriddenByCommandLine += "-socks "; addOverriddenOption("-socks");
// Display // Display
if (!settings.contains("language")) if (!settings.contains("language"))
settings.setValue("language", ""); settings.setValue("language", "");
if (!SoftSetArg("-lang", settings.value("language").toString().toStdString())) if (!SoftSetArg("-lang", settings.value("language").toString().toStdString()))
strOverriddenByCommandLine += "-lang"; addOverriddenOption("-lang");
language = settings.value("language").toString(); language = settings.value("language").toString();
} }

View file

@ -75,6 +75,9 @@ private:
/* settings that were overriden by command-line */ /* settings that were overriden by command-line */
QString strOverriddenByCommandLine; QString strOverriddenByCommandLine;
/// Add option to list of GUI options overridden through command line/config file
void addOverriddenOption(const std::string &option);
signals: signals:
void displayUnitChanged(int unit); void displayUnitChanged(int unit);
void transactionFeeChanged(qint64); void transactionFeeChanged(qint64);

View file

@ -195,8 +195,10 @@ void SendCoinsEntry::setValue(const SendCoinsRecipient &value)
ui->messageTextLabel->setVisible(!recipient.message.isEmpty()); ui->messageTextLabel->setVisible(!recipient.message.isEmpty());
ui->messageLabel->setVisible(!recipient.message.isEmpty()); ui->messageLabel->setVisible(!recipient.message.isEmpty());
ui->payTo->setText(recipient.address); ui->addAsLabel->clear();
ui->addAsLabel->setText(recipient.label); 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); ui->payAmount->setValue(recipient.amount);
} }
} }

View file

@ -213,6 +213,9 @@ Value importwallet(const Array& params, bool fHelp)
while (pindex && pindex->pprev && pindex->nTime > nTimeBegin - 7200) while (pindex && pindex->pprev && pindex->nTime > nTimeBegin - 7200)
pindex = pindex->pprev; pindex = pindex->pprev;
if (!pwalletMain->nTimeFirstKey || nTimeBegin < pwalletMain->nTimeFirstKey)
pwalletMain->nTimeFirstKey = nTimeBegin;
LogPrintf("Rescanning last %i blocks\n", chainActive.Height() - pindex->nHeight + 1); LogPrintf("Rescanning last %i blocks\n", chainActive.Height() - pindex->nHeight + 1);
pwalletMain->ScanForWalletTransactions(pindex); pwalletMain->ScanForWalletTransactions(pindex);
pwalletMain->MarkDirty(); pwalletMain->MarkDirty();

View file

@ -46,8 +46,9 @@ Value getinfo(const Array& params, bool fHelp)
" \"testnet\": true|false, (boolean) if the server is using testnet or not\n" " \"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" " \"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" " \"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" " \"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" " \"errors\": \"...\" (string) any error messages\n"
"}\n" "}\n"
"\nExamples:\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("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime()));
obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize())); obj.push_back(Pair("keypoolsize", (int)pwalletMain->GetKeyPoolSize()));
} }
obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee)));
if (pwalletMain && pwalletMain->IsCrypted()) if (pwalletMain && pwalletMain->IsCrypted())
obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime)); obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime));
obj.push_back(Pair("paytxfee", ValueFromAmount(nTransactionFee)));
#endif #endif
obj.push_back(Pair("relayfee", ValueFromAmount(CTransaction::nMinRelayTxFee)));
obj.push_back(Pair("errors", GetWarnings("statusbar"))); obj.push_back(Pair("errors", GetWarnings("statusbar")));
return obj; return obj;
} }

View file

@ -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 // Unit tests for block-chain checkpoints
// //

View file

@ -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 // Unit tests for denial-of-service detection/prevention code
// //

View file

@ -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 "wallet.h"
#include "walletdb.h" #include "walletdb.h"

View file

@ -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 // Unit tests for alert system
// //

View file

@ -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" #include "util.h"

View file

@ -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" #include "util.h"

View file

@ -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 "base58.h"
#include "data/base58_encode_decode.json.h" #include "data/base58_encode_decode.json.h"

View file

@ -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" #include "util.h"

View file

@ -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 "bignum.h"
#include <limits> #include <limits>

View file

@ -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 <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include "base58.h" #include "base58.h"

View file

@ -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 "bloom.h"
#include "base58.h" #include "base58.h"

View file

@ -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 // Unit tests for canonical signatures
// //

View file

@ -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() // Unit tests for block.CheckBlock()
// //
@ -15,8 +19,7 @@
BOOST_AUTO_TEST_SUITE(CheckBlock_tests) BOOST_AUTO_TEST_SUITE(CheckBlock_tests)
bool bool read_block(const std::string& filename, CBlock& block)
read_block(const std::string& filename, CBlock& block)
{ {
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
fs::path testFile = fs::current_path() / "data" / filename; fs::path testFile = fs::current_path() / "data" / filename;

View file

@ -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 "main.h"
#include "util.h" #include "util.h"

14
src/test/data/README.md Normal file
View file

@ -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.

View file

@ -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" #include "util.h"

View file

@ -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 "hash.h"
#include "util.h" #include "util.h"

View file

@ -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 "hash.h"
#include "util.h" #include "util.h"

View file

@ -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 "key.h"
#include "base58.h" #include "base58.h"

View file

@ -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 "core.h"
#include "main.h" #include "main.h"
#include "uint256.h" #include "uint256.h"

View file

@ -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 "main.h"
#include "miner.h" #include "miner.h"

View file

@ -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 "mruset.h"
#include "util.h" #include "util.h"

View file

@ -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 "key.h"
#include "keystore.h" #include "keystore.h"

View file

@ -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 "netbase.h"
#include <string> #include <string>

View file

@ -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 "main.h"
#include "serialize.h" #include "serialize.h"

View file

@ -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 "rpcserver.h"
#include "rpcclient.h" #include "rpcclient.h"

View file

@ -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 "rpcserver.h"
#include "rpcclient.h" #include "rpcclient.h"

View file

@ -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 "script.h"
#include "key.h" #include "key.h"

View file

@ -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 "script.h"
#include "data/script_invalid.json.h" #include "data/script_invalid.json.h"

View file

@ -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 "serialize.h"
#include <stdint.h> #include <stdint.h>

View file

@ -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 <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include "main.h" #include "main.h"

View file

@ -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 "key.h"
#include "script.h" #include "script.h"

View file

@ -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 #define BOOST_TEST_MODULE Bitcoin Test Suite

View file

@ -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_invalid.json.h"
#include "data/tx_valid.json.h" #include "data/tx_valid.json.h"

View file

@ -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 <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <stdint.h> #include <stdint.h>
#include <sstream> #include <sstream>

View file

@ -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 "util.h"
#include "sync.h" #include "sync.h"

View file

@ -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 "wallet.h"
#include <set> #include <set>

View file

@ -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) 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); bool fExisted = mapWallet.count(hash);
if (fExisted && !fUpdate) return false; if (fExisted && !fUpdate) return false;
if (fExisted || IsMine(tx) || IsFromMe(tx)) 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) void CWallet::SyncTransaction(const uint256 &hash, const CTransaction& tx, const CBlock* pblock)
{ {
AddToWalletIfInvolvingMe(hash, tx, pblock, true); LOCK(cs_wallet);
if (!AddToWalletIfInvolvingMe(hash, tx, pblock, true))
if (mapWallet.count(hash) == 0)
return; // Not one of ours return; // Not one of ours
// If a transaction changes 'conflicted' state, that changes the balance // If a transaction changes 'conflicted' state, that changes the balance