aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp11
-rw-r--r--src/main.cpp19
-rw-r--r--src/main.h4
-rw-r--r--src/net.cpp2
-rw-r--r--src/qt/bitcoinstrings.cpp2
-rw-r--r--src/rpcrawtransaction.cpp2
-rw-r--r--src/util.h7
-rw-r--r--src/wallet.cpp4
-rw-r--r--src/wallet.h2
9 files changed, 30 insertions, 23 deletions
diff --git a/src/init.cpp b/src/init.cpp
index f8b2b23fd0..fe74cd6963 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -744,6 +744,12 @@ bool AppInit2(boost::thread_group& threadGroup)
if (!mapBlockIndex.empty() && pindexGenesisBlock == NULL)
return InitError(_("Incorrect or no genesis block found. Wrong datadir for network?"));
+ // Check for changed -txindex state (only necessary if we are not reindexing anyway)
+ if (!fReindex && fTxIndex != GetBoolArg("-txindex", false)) {
+ strLoadError = _("You need to rebuild the database using -reindex to change -txindex");
+ break;
+ }
+
// Initialize the block index (no-op if non-empty database was already loaded)
if (!InitBlockIndex()) {
strLoadError = _("Error initializing block database");
@@ -767,7 +773,7 @@ bool AppInit2(boost::thread_group& threadGroup)
// first suggest a reindex
if (!fReset) {
bool fRet = uiInterface.ThreadSafeMessageBox(
- strLoadError + ".\n" + _("Do you want to rebuild the block database now?"),
+ strLoadError + ".\n\n" + _("Do you want to rebuild the block database now?"),
"", CClientUIInterface::MSG_ERROR | CClientUIInterface::BTN_ABORT);
if (fRet) {
fReindex = true;
@@ -781,9 +787,6 @@ bool AppInit2(boost::thread_group& threadGroup)
}
}
- if (mapArgs.count("-txindex") && fTxIndex != GetBoolArg("-txindex", false))
- return InitError(_("You need to rebuild the databases using -reindex to change -txindex"));
-
// as LoadBlockIndex can take several minutes, it's possible the user
// requested to kill bitcoin-qt during the last operation. If so, exit.
// As the program has not fully started yet, Shutdown() is possibly overkill.
diff --git a/src/main.cpp b/src/main.cpp
index 98921e1423..f0c08d273f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -694,7 +694,7 @@ void CTxMemPool::pruneSpent(const uint256 &hashTx, CCoins &coins)
}
}
-bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fCheckInputs, bool fLimitFree,
+bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fLimitFree,
bool* pfMissingInputs)
{
if (pfMissingInputs)
@@ -751,7 +751,6 @@ bool CTxMemPool::accept(CValidationState &state, CTransaction &tx, bool fCheckIn
}
}
- if (fCheckInputs)
{
CCoinsView dummy;
CCoinsViewCache view(dummy);
@@ -968,15 +967,15 @@ int CMerkleTx::GetBlocksToMaturity() const
}
-bool CMerkleTx::AcceptToMemoryPool(bool fCheckInputs, bool fLimitFree)
+bool CMerkleTx::AcceptToMemoryPool(bool fLimitFree)
{
CValidationState state;
- return mempool.accept(state, *this, fCheckInputs, fLimitFree, NULL);
+ return mempool.accept(state, *this, fLimitFree, NULL);
}
-bool CWalletTx::AcceptWalletTransaction(bool fCheckInputs)
+bool CWalletTx::AcceptWalletTransaction()
{
{
LOCK(mempool.cs);
@@ -987,10 +986,10 @@ bool CWalletTx::AcceptWalletTransaction(bool fCheckInputs)
{
uint256 hash = tx.GetHash();
if (!mempool.exists(hash) && pcoinsTip->HaveCoins(hash))
- tx.AcceptToMemoryPool(fCheckInputs, false);
+ tx.AcceptToMemoryPool(false);
}
}
- return AcceptToMemoryPool(fCheckInputs, false);
+ return AcceptToMemoryPool(false);
}
return false;
}
@@ -1865,7 +1864,7 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
BOOST_FOREACH(CTransaction& tx, vResurrect) {
// ignore validation errors in resurrected transactions
CValidationState stateDummy;
- mempool.accept(stateDummy, tx, true, false, NULL);
+ mempool.accept(stateDummy, tx, false, NULL);
}
// Delete redundant memory transactions that are in the connected branch
@@ -3507,7 +3506,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
bool fMissingInputs = false;
CValidationState state;
- if (mempool.accept(state, tx, true, true, &fMissingInputs))
+ if (mempool.accept(state, tx, true, &fMissingInputs))
{
RelayTransaction(tx, inv.hash, vMsg);
mapAlreadyAskedFor.erase(inv);
@@ -3530,7 +3529,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
// Use a dummy CValidationState so someone can't setup nodes to counter-DoS based on orphan resolution (that is, feeding people an invalid transaction based on LegitTxX in order to get anyone relaying LegitTxX banned)
CValidationState stateDummy;
- if (mempool.accept(stateDummy, tx, true, true, &fMissingInputs2))
+ if (mempool.accept(stateDummy, tx, true, &fMissingInputs2))
{
printf(" accepted orphan tx %s\n", inv.hash.ToString().c_str());
RelayTransaction(tx, inv.hash, vMsg);
diff --git a/src/main.h b/src/main.h
index f20fad98a4..87f1dbfa8f 100644
--- a/src/main.h
+++ b/src/main.h
@@ -478,7 +478,7 @@ public:
int GetDepthInMainChain() const { CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); }
bool IsInMainChain() const { return GetDepthInMainChain() > 0; }
int GetBlocksToMaturity() const;
- bool AcceptToMemoryPool(bool fCheckInputs=true, bool fLimitFree=true);
+ bool AcceptToMemoryPool(bool fLimitFree=true);
};
@@ -1334,7 +1334,7 @@ public:
std::map<uint256, CTransaction> mapTx;
std::map<COutPoint, CInPoint> mapNextTx;
- bool accept(CValidationState &state, CTransaction &tx, bool fCheckInputs, bool fLimitFree, bool* pfMissingInputs);
+ bool accept(CValidationState &state, CTransaction &tx, bool fLimitFree, bool* pfMissingInputs);
bool addUnchecked(const uint256& hash, CTransaction &tx);
bool remove(const CTransaction &tx, bool fRecursive = false);
bool removeConflicts(const CTransaction &tx);
diff --git a/src/net.cpp b/src/net.cpp
index 1f8b39ac98..1d181823e2 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -533,7 +533,7 @@ void CNode::PushVersion()
RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
printf("send version message: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString().c_str(), addrYou.ToString().c_str(), addr.ToString().c_str());
PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
- nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector<string>()), nBestHeight);
+ nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector<string>()), nBestHeight, true);
}
diff --git a/src/qt/bitcoinstrings.cpp b/src/qt/bitcoinstrings.cpp
index 4dae8999c3..1afce2eb7c 100644
--- a/src/qt/bitcoinstrings.cpp
+++ b/src/qt/bitcoinstrings.cpp
@@ -205,6 +205,6 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Verifying wallet..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Wallet needed to be rewritten: restart Bitcoin to complete"),
QT_TRANSLATE_NOOP("bitcoin-core", "Warning"),
QT_TRANSLATE_NOOP("bitcoin-core", "Warning: This version is obsolete, upgrade required!"),
-QT_TRANSLATE_NOOP("bitcoin-core", "You need to rebuild the databases using -reindex to change -txindex"),
+QT_TRANSLATE_NOOP("bitcoin-core", "You need to rebuild the database using -reindex to change -txindex"),
QT_TRANSLATE_NOOP("bitcoin-core", "wallet.dat corrupt, salvage failed"),
}; \ No newline at end of file
diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp
index 917c2f5de9..61cb4e390e 100644
--- a/src/rpcrawtransaction.cpp
+++ b/src/rpcrawtransaction.cpp
@@ -555,7 +555,7 @@ Value sendrawtransaction(const Array& params, bool fHelp)
if (!fHave) {
// push to local node
CValidationState state;
- if (!mempool.accept(state, tx, true, false, NULL))
+ if (!mempool.accept(state, tx, false, NULL))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX rejected"); // TODO: report validation state
}
}
diff --git a/src/util.h b/src/util.h
index 2272ed02f4..9173b5bb58 100644
--- a/src/util.h
+++ b/src/util.h
@@ -20,6 +20,7 @@
#include <vector>
#include <string>
+#include <boost/version.hpp>
#include <boost/thread.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/path.hpp>
@@ -104,7 +105,11 @@ T* alignup(T* p)
inline void MilliSleep(int64 n)
{
-#if BOOST_VERSION >= 105000
+// Boost's sleep_for was uninterruptable when backed by nanosleep from 1.50
+// until fixed in 1.52. Use the deprecated sleep method for the broken case.
+// See: https://svn.boost.org/trac/boost/ticket/7238
+
+#if BOOST_VERSION >= 105000 && (!defined(BOOST_HAS_NANOSLEEP) || BOOST_VERSION >= 105200)
boost::this_thread::sleep_for(boost::chrono::milliseconds(n));
#else
boost::this_thread::sleep(boost::posix_time::milliseconds(n));
diff --git a/src/wallet.cpp b/src/wallet.cpp
index 9a4a92cd5f..4cd04bb6e2 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -852,7 +852,7 @@ void CWallet::ReacceptWalletTransactions()
{
// Re-accept any txes of ours that aren't already in a block
if (!wtx.IsCoinBase())
- wtx.AcceptWalletTransaction(false);
+ wtx.AcceptWalletTransaction();
}
}
if (fMissing)
@@ -1365,7 +1365,7 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey)
mapRequestCount[wtxNew.GetHash()] = 0;
// Broadcast
- if (!wtxNew.AcceptToMemoryPool(true, false))
+ if (!wtxNew.AcceptToMemoryPool(false))
{
// This must not fail. The transaction has already been signed and recorded.
printf("CommitTransaction() : Error: Transaction not valid");
diff --git a/src/wallet.h b/src/wallet.h
index a0688b8a02..2b3131261c 100644
--- a/src/wallet.h
+++ b/src/wallet.h
@@ -689,7 +689,7 @@ public:
int GetRequestCount() const;
void AddSupportingTransactions();
- bool AcceptWalletTransaction(bool fCheckInputs=true);
+ bool AcceptWalletTransaction();
void RelayWalletTransaction();
};