aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build-aux/m4/bitcoin_find_bdb48.m4120
-rw-r--r--contrib/testgen/base58.py1
-rwxr-xr-xcontrib/testgen/gen_base58_test_vectors.py1
-rw-r--r--doc/build-openbsd.md6
-rw-r--r--doc/build-unix.md4
-rwxr-xr-xqa/rpc-tests/forknotify.py2
-rwxr-xr-xqa/rpc-tests/p2p-segwit.py1
-rwxr-xr-xqa/rpc-tests/receivedby.py3
-rwxr-xr-xqa/rpc-tests/replace-by-fee.py1
-rwxr-xr-xqa/rpc-tests/wallet.py1
-rw-r--r--src/addrman.cpp3
-rw-r--r--src/bench/bench.cpp16
-rw-r--r--src/bench/bench.h3
-rw-r--r--src/chainparams.cpp1
-rw-r--r--src/net.cpp18
-rw-r--r--src/net_processing.cpp10
-rw-r--r--src/qt/intro.cpp11
-rw-r--r--src/sync.cpp50
18 files changed, 119 insertions, 133 deletions
diff --git a/build-aux/m4/bitcoin_find_bdb48.m4 b/build-aux/m4/bitcoin_find_bdb48.m4
index 0c3d49c2bc..980f1e8f19 100644
--- a/build-aux/m4/bitcoin_find_bdb48.m4
+++ b/build-aux/m4/bitcoin_find_bdb48.m4
@@ -3,68 +3,76 @@ dnl Distributed under the MIT software license, see the accompanying
dnl file COPYING or http://www.opensource.org/licenses/mit-license.php.
AC_DEFUN([BITCOIN_FIND_BDB48],[
- AC_MSG_CHECKING([for Berkeley DB C++ headers])
- BDB_CPPFLAGS=
- BDB_LIBS=
- bdbpath=X
- bdb48path=X
- bdbdirlist=
- for _vn in 4.8 48 4 5 ''; do
- for _pfx in b lib ''; do
- bdbdirlist="$bdbdirlist ${_pfx}db${_vn}"
+ AC_ARG_VAR(BDB_CFLAGS, [C compiler flags for BerkeleyDB, bypasses autodetection])
+ AC_ARG_VAR(BDB_LIBS, [Linker flags for BerkeleyDB, bypasses autodetection])
+
+ if test "x$BDB_CFLAGS" = "x"; then
+ AC_MSG_CHECKING([for Berkeley DB C++ headers])
+ BDB_CPPFLAGS=
+ bdbpath=X
+ bdb48path=X
+ bdbdirlist=
+ for _vn in 4.8 48 4 5 ''; do
+ for _pfx in b lib ''; do
+ bdbdirlist="$bdbdirlist ${_pfx}db${_vn}"
+ done
+ done
+ for searchpath in $bdbdirlist ''; do
+ test -n "${searchpath}" && searchpath="${searchpath}/"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <${searchpath}db_cxx.h>
+ ]],[[
+ #if !((DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 8) || DB_VERSION_MAJOR > 4)
+ #error "failed to find bdb 4.8+"
+ #endif
+ ]])],[
+ if test "x$bdbpath" = "xX"; then
+ bdbpath="${searchpath}"
+ fi
+ ],[
+ continue
+ ])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <${searchpath}db_cxx.h>
+ ]],[[
+ #if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8)
+ #error "failed to find bdb 4.8"
+ #endif
+ ]])],[
+ bdb48path="${searchpath}"
+ break
+ ],[])
done
- done
- for searchpath in $bdbdirlist ''; do
- test -n "${searchpath}" && searchpath="${searchpath}/"
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #include <${searchpath}db_cxx.h>
- ]],[[
- #if !((DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 8) || DB_VERSION_MAJOR > 4)
- #error "failed to find bdb 4.8+"
- #endif
- ]])],[
- if test "x$bdbpath" = "xX"; then
- bdbpath="${searchpath}"
- fi
- ],[
- continue
- ])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- #include <${searchpath}db_cxx.h>
- ]],[[
- #if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8)
- #error "failed to find bdb 4.8"
- #endif
- ]])],[
- bdb48path="${searchpath}"
- break
- ],[])
- done
- if test "x$bdbpath" = "xX"; then
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([libdb_cxx headers missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
- elif test "x$bdb48path" = "xX"; then
- BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx)
- AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 4.8])],[
- AC_MSG_WARN([Found Berkeley DB other than 4.8; wallets opened by this build will not be portable!])
- ],[
- AC_MSG_ERROR([Found Berkeley DB other than 4.8, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)])
- ])
+ if test "x$bdbpath" = "xX"; then
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([libdb_cxx headers missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
+ elif test "x$bdb48path" = "xX"; then
+ BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx)
+ AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 4.8])],[
+ AC_MSG_WARN([Found Berkeley DB other than 4.8; wallets opened by this build will not be portable!])
+ ],[
+ AC_MSG_ERROR([Found Berkeley DB other than 4.8, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)])
+ ])
+ else
+ BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx)
+ bdbpath="${bdb48path}"
+ fi
else
- BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx)
- bdbpath="${bdb48path}"
+ BDB_CPPFLAGS=${BDB_CFLAGS}
fi
AC_SUBST(BDB_CPPFLAGS)
- # TODO: Ideally this could find the library version and make sure it matches the headers being used
- for searchlib in db_cxx-4.8 db_cxx; do
- AC_CHECK_LIB([$searchlib],[main],[
- BDB_LIBS="-l${searchlib}"
- break
- ])
- done
if test "x$BDB_LIBS" = "x"; then
- AC_MSG_ERROR([libdb_cxx missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
+ # TODO: Ideally this could find the library version and make sure it matches the headers being used
+ for searchlib in db_cxx-4.8 db_cxx; do
+ AC_CHECK_LIB([$searchlib],[main],[
+ BDB_LIBS="-l${searchlib}"
+ break
+ ])
+ done
+ if test "x$BDB_LIBS" = "x"; then
+ AC_MSG_ERROR([libdb_cxx missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
+ fi
fi
AC_SUBST(BDB_LIBS)
])
diff --git a/contrib/testgen/base58.py b/contrib/testgen/base58.py
index bb0aeaff05..0d09692b36 100644
--- a/contrib/testgen/base58.py
+++ b/contrib/testgen/base58.py
@@ -84,7 +84,6 @@ def b58decode_chk(v):
result = b58decode(v)
if result is None:
return None
- h3 = checksum(result[:-4])
if result[-4:] == checksum(result[:-4]):
return result[:-4]
else:
diff --git a/contrib/testgen/gen_base58_test_vectors.py b/contrib/testgen/gen_base58_test_vectors.py
index 7e475b7a36..ac0701e6be 100755
--- a/contrib/testgen/gen_base58_test_vectors.py
+++ b/contrib/testgen/gen_base58_test_vectors.py
@@ -45,7 +45,6 @@ def is_valid(v):
result = b58decode_chk(v)
if result is None:
return False
- valid = False
for template in templates:
prefix = str(bytearray(template[0]))
suffix = str(bytearray(template[2]))
diff --git a/doc/build-openbsd.md b/doc/build-openbsd.md
index 55283d6dce..f4a9826d80 100644
--- a/doc/build-openbsd.md
+++ b/doc/build-openbsd.md
@@ -1,6 +1,6 @@
OpenBSD build guide
======================
-(updated for OpenBSD 5.9)
+(updated for OpenBSD 6.0)
This guide describes how to build bitcoind and command-line utilities on OpenBSD.
@@ -124,7 +124,7 @@ To configure with wallet:
```bash
./configure --with-gui=no --with-boost=$BOOST_PREFIX \
CC=egcc CXX=eg++ CPP=ecpp \
- LDFLAGS="-L${BDB_PREFIX}/lib/" CPPFLAGS="-I${BDB_PREFIX}/include/"
+ BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include"
```
To configure without wallet:
@@ -142,6 +142,8 @@ gmake check
Clang (not currently working)
------------------------------
+WARNING: This is outdated, needs to be updated for OpenBSD 6.0 and re-tried.
+
Using a newer g++ results in linking the new code to a new libstdc++.
Libraries built with the old g++, will still import the old library.
This gives conflicts, necessitating rebuild of all C++ dependencies of the application.
diff --git a/doc/build-unix.md b/doc/build-unix.md
index 5b0a38457e..31a88a1b18 100644
--- a/doc/build-unix.md
+++ b/doc/build-unix.md
@@ -315,7 +315,7 @@ For further documentation on the depends system see [README.md](../depends/READM
Building on FreeBSD
--------------------
-(Updated as of FreeBSD 10.3)
+(Updated as of FreeBSD 11.0)
Clang is installed by default as `cc` compiler, this makes it easier to get
started than on [OpenBSD](build-openbsd.md). Installing dependencies:
@@ -337,7 +337,7 @@ with 4.8-built Bitcoin Core is needed follow the steps under "Berkeley DB" above
Then build using:
./autogen.sh
- ./configure --with-incompatible-bdb CPPFLAGS=-I/usr/local/include/db5 LDFLAGS=-L/usr/local/lib/db5
+ ./configure --with-incompatible-bdb BDB_CFLAGS="-I/usr/local/include/db5" BDB_LIBS="-L/usr/local/lib -ldb_cxx-5"
make
*Note on debugging*: The version of `gdb` installed by default is [ancient and considered harmful](https://wiki.freebsd.org/GdbRetirement).
diff --git a/qa/rpc-tests/forknotify.py b/qa/rpc-tests/forknotify.py
index a1901aedab..8b1403083f 100755
--- a/qa/rpc-tests/forknotify.py
+++ b/qa/rpc-tests/forknotify.py
@@ -22,7 +22,7 @@ class ForkNotifyTest(BitcoinTestFramework):
def setup_network(self):
self.nodes = []
self.alert_filename = os.path.join(self.options.tmpdir, "alert.txt")
- with open(self.alert_filename, 'w', encoding='utf8') as f:
+ with open(self.alert_filename, 'w', encoding='utf8'):
pass # Just open then close to create zero-length file
self.nodes.append(start_node(0, self.options.tmpdir,
["-blockversion=2", "-alertnotify=echo %s >> \"" + self.alert_filename + "\""]))
diff --git a/qa/rpc-tests/p2p-segwit.py b/qa/rpc-tests/p2p-segwit.py
index a7858ad3d8..2f339bb54f 100755
--- a/qa/rpc-tests/p2p-segwit.py
+++ b/qa/rpc-tests/p2p-segwit.py
@@ -951,7 +951,6 @@ class SegWitTest(BitcoinTestFramework):
tx.rehash()
tx_hash = tx.sha256
- tx_value = tx.vout[0].nValue
# Verify that unnecessary witnesses are rejected.
self.test_node.announce_tx_and_wait_for_getdata(tx)
diff --git a/qa/rpc-tests/receivedby.py b/qa/rpc-tests/receivedby.py
index 4f17b661cb..1b90b23330 100755
--- a/qa/rpc-tests/receivedby.py
+++ b/qa/rpc-tests/receivedby.py
@@ -14,7 +14,6 @@ def get_sub_array_from_array(object_array, to_match):
Finds and returns a sub array from an array of arrays.
to_match should be a unique idetifier of a sub array
'''
- num_matched = 0
for item in object_array:
all_match = True
for key,value in to_match.items():
@@ -104,7 +103,7 @@ class ReceivedByTest(BitcoinTestFramework):
received_by_account_json = get_sub_array_from_array(self.nodes[1].listreceivedbyaccount(),{"account":account})
if len(received_by_account_json) == 0:
raise AssertionError("No accounts found in node")
- balance_by_account = rec_by_accountArr = self.nodes[1].getreceivedbyaccount(account)
+ balance_by_account = self.nodes[1].getreceivedbyaccount(account)
txid = self.nodes[0].sendtoaddress(addr, 0.1)
self.sync_all()
diff --git a/qa/rpc-tests/replace-by-fee.py b/qa/rpc-tests/replace-by-fee.py
index 8aba06c60c..2b29dfdd2b 100755
--- a/qa/rpc-tests/replace-by-fee.py
+++ b/qa/rpc-tests/replace-by-fee.py
@@ -393,7 +393,6 @@ class ReplaceByFeeTest(BitcoinTestFramework):
utxo = make_utxo(self.nodes[0], initial_nValue)
fee = int(0.0001*COIN)
split_value = int((initial_nValue-fee)/(MAX_REPLACEMENT_LIMIT+1))
- actual_fee = initial_nValue - split_value*(MAX_REPLACEMENT_LIMIT+1)
outputs = []
for i in range(MAX_REPLACEMENT_LIMIT+1):
diff --git a/qa/rpc-tests/wallet.py b/qa/rpc-tests/wallet.py
index f325ecb4a3..c82e0adffa 100755
--- a/qa/rpc-tests/wallet.py
+++ b/qa/rpc-tests/wallet.py
@@ -359,7 +359,6 @@ class WalletTest (BitcoinTestFramework):
rawtx = self.nodes[0].createrawtransaction([{"txid":singletxid, "vout":0}], {chain_addrs[0]:node0_balance/2-Decimal('0.01'), chain_addrs[1]:node0_balance/2-Decimal('0.01')})
signedtx = self.nodes[0].signrawtransaction(rawtx)
singletxid = self.nodes[0].sendrawtransaction(signedtx["hex"])
- txids = [singletxid, singletxid]
self.nodes[0].generate(1)
# Make a long chain of unconfirmed payments without hitting mempool limit
diff --git a/src/addrman.cpp b/src/addrman.cpp
index ab84bf8e35..f3c238fbb2 100644
--- a/src/addrman.cpp
+++ b/src/addrman.cpp
@@ -54,11 +54,8 @@ double CAddrInfo::GetChance(int64_t nNow) const
{
double fChance = 1.0;
- int64_t nSinceLastSeen = nNow - nTime;
int64_t nSinceLastTry = nNow - nLastTry;
- if (nSinceLastSeen < 0)
- nSinceLastSeen = 0;
if (nSinceLastTry < 0)
nSinceLastTry = 0;
diff --git a/src/bench/bench.cpp b/src/bench/bench.cpp
index 1bd9d06b80..3c9df4f713 100644
--- a/src/bench/bench.cpp
+++ b/src/bench/bench.cpp
@@ -9,7 +9,10 @@
#include <iomanip>
#include <sys/time.h>
-std::map<std::string, benchmark::BenchFunction> benchmark::BenchRunner::benchmarks;
+benchmark::BenchRunner::BenchmarkMap &benchmark::BenchRunner::benchmarks() {
+ static std::map<std::string, benchmark::BenchFunction> benchmarks_map;
+ return benchmarks_map;
+}
static double gettimedouble(void) {
struct timeval tv;
@@ -19,7 +22,7 @@ static double gettimedouble(void) {
benchmark::BenchRunner::BenchRunner(std::string name, benchmark::BenchFunction func)
{
- benchmarks.insert(std::make_pair(name, func));
+ benchmarks().insert(std::make_pair(name, func));
}
void
@@ -29,12 +32,9 @@ benchmark::BenchRunner::RunAll(double elapsedTimeForOne)
std::cout << "#Benchmark" << "," << "count" << "," << "min" << "," << "max" << "," << "average" << ","
<< "min_cycles" << "," << "max_cycles" << "," << "average_cycles" << "\n";
- for (std::map<std::string,benchmark::BenchFunction>::iterator it = benchmarks.begin();
- it != benchmarks.end(); ++it) {
-
- State state(it->first, elapsedTimeForOne);
- benchmark::BenchFunction& func = it->second;
- func(state);
+ for (const auto &p: benchmarks()) {
+ State state(p.first, elapsedTimeForOne);
+ p.second(state);
}
perf_fini();
}
diff --git a/src/bench/bench.h b/src/bench/bench.h
index 80dad6a8ef..0e7605c726 100644
--- a/src/bench/bench.h
+++ b/src/bench/bench.h
@@ -63,7 +63,8 @@ namespace benchmark {
class BenchRunner
{
- static std::map<std::string, BenchFunction> benchmarks;
+ typedef std::map<std::string, BenchFunction> BenchmarkMap;
+ static BenchmarkMap &benchmarks();
public:
BenchRunner(std::string name, BenchFunction func);
diff --git a/src/chainparams.cpp b/src/chainparams.cpp
index d99f800f0a..6c6f677df7 100644
--- a/src/chainparams.cpp
+++ b/src/chainparams.cpp
@@ -124,7 +124,6 @@ public:
vSeeds.push_back(CDNSSeedData("bluematt.me", "dnsseed.bluematt.me", true)); // Matt Corallo, only supports x9
vSeeds.push_back(CDNSSeedData("dashjr.org", "dnsseed.bitcoin.dashjr.org")); // Luke Dashjr
vSeeds.push_back(CDNSSeedData("bitcoinstats.com", "seed.bitcoinstats.com", true)); // Christian Decker, supports x1 - xf
- vSeeds.push_back(CDNSSeedData("xf2.org", "bitseed.xf2.org")); // Jeff Garzik
vSeeds.push_back(CDNSSeedData("bitcoin.jonasschnelli.ch", "seed.bitcoin.jonasschnelli.ch", true)); // Jonas Schnelli, only supports x1, x5, x9, and xd
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,0);
diff --git a/src/net.cpp b/src/net.cpp
index 2625cccaa3..7c45cff1dd 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1100,20 +1100,18 @@ void CConnman::ThreadSocketHandler()
BOOST_FOREACH(CNode* pnode, vNodesDisconnectedCopy)
{
// wait until threads are done using it
- if (pnode->GetRefCount() <= 0)
- {
+ if (pnode->GetRefCount() <= 0) {
bool fDelete = false;
{
- TRY_LOCK(pnode->cs_vSend, lockSend);
- if (lockSend)
- {
- TRY_LOCK(pnode->cs_inventory, lockInv);
- if (lockInv)
- fDelete = true;
+ TRY_LOCK(pnode->cs_inventory, lockInv);
+ if (lockInv) {
+ TRY_LOCK(pnode->cs_vSend, lockSend);
+ if (lockSend) {
+ fDelete = true;
+ }
}
}
- if (fDelete)
- {
+ if (fDelete) {
vNodesDisconnected.remove(pnode);
DeleteNode(pnode);
}
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 3a89c7ac42..bb14e69d83 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -863,7 +863,15 @@ void PeerLogicValidation::BlockChecked(const CBlock& block, const CValidationSta
Misbehaving(it->second.first, nDoS);
}
}
- else if (state.IsValid() && !IsInitialBlockDownload() && mapBlocksInFlight.count(hash) == mapBlocksInFlight.size()) {
+ // Check that:
+ // 1. The block is valid
+ // 2. We're not in initial block download
+ // 3. This is currently the best block we're aware of. We haven't updated
+ // the tip yet so we have no way to check this directly here. Instead we
+ // just check that there are currently no other blocks in flight.
+ else if (state.IsValid() &&
+ !IsInitialBlockDownload() &&
+ mapBlocksInFlight.count(hash) == mapBlocksInFlight.size()) {
if (it != mapBlockSource.end()) {
MaybeSetPeerAsAnnouncingHeaderAndIDs(it->second.first, *connman);
}
diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp
index e0678f45fc..6b5ac47f20 100644
--- a/src/qt/intro.cpp
+++ b/src/qt/intro.cpp
@@ -23,7 +23,7 @@
static const uint64_t GB_BYTES = 1000000000LL;
/* Minimum free space (in GB) needed for data directory */
-static const uint64_t BLOCK_CHAIN_SIZE = 80;
+static const uint64_t BLOCK_CHAIN_SIZE = 120;
/* Minimum free space (in GB) needed for data directory when pruned; Does not include prune target */
static const uint64_t CHAIN_STATE_SIZE = 2;
/* Total required space (in GB) depending on user choice (prune, not prune) */
@@ -126,8 +126,13 @@ Intro::Intro(QWidget *parent) :
ui->storageLabel->setText(ui->storageLabel->text().arg(tr(PACKAGE_NAME)));
uint64_t pruneTarget = std::max<int64_t>(0, GetArg("-prune", 0));
requiredSpace = BLOCK_CHAIN_SIZE;
- if (pruneTarget)
- requiredSpace = CHAIN_STATE_SIZE + std::ceil(pruneTarget * 1024 * 1024.0 / GB_BYTES);
+ if (pruneTarget) {
+ uint64_t prunedGBs = std::ceil(pruneTarget * 1024 * 1024.0 / GB_BYTES);
+ if (prunedGBs <= requiredSpace) {
+ requiredSpace = prunedGBs;
+ }
+ }
+ requiredSpace += CHAIN_STATE_SIZE;
ui->sizeWarningLabel->setText(ui->sizeWarningLabel->text().arg(tr(PACKAGE_NAME)).arg(requiredSpace));
startThread();
}
diff --git a/src/sync.cpp b/src/sync.cpp
index a18d0f1485..fce57f1df9 100644
--- a/src/sync.cpp
+++ b/src/sync.cpp
@@ -77,52 +77,28 @@ boost::thread_specific_ptr<LockStack> lockstack;
static void potential_deadlock_detected(const std::pair<void*, void*>& mismatch, const LockStack& s1, const LockStack& s2)
{
- // We attempt to not assert on probably-not deadlocks by assuming that
- // a try lock will immediately have otherwise bailed if it had
- // failed to get the lock
- // We do this by, for the locks which triggered the potential deadlock,
- // in either lockorder, checking that the second of the two which is locked
- // is only a TRY_LOCK, ignoring locks if they are reentrant.
- bool firstLocked = false;
- bool secondLocked = false;
- bool onlyMaybeDeadlock = false;
-
LogPrintf("POTENTIAL DEADLOCK DETECTED\n");
LogPrintf("Previous lock order was:\n");
BOOST_FOREACH (const PAIRTYPE(void*, CLockLocation) & i, s2) {
if (i.first == mismatch.first) {
LogPrintf(" (1)");
- if (!firstLocked && secondLocked && i.second.fTry)
- onlyMaybeDeadlock = true;
- firstLocked = true;
}
if (i.first == mismatch.second) {
LogPrintf(" (2)");
- if (!secondLocked && firstLocked && i.second.fTry)
- onlyMaybeDeadlock = true;
- secondLocked = true;
}
LogPrintf(" %s\n", i.second.ToString());
}
- firstLocked = false;
- secondLocked = false;
LogPrintf("Current lock order is:\n");
BOOST_FOREACH (const PAIRTYPE(void*, CLockLocation) & i, s1) {
if (i.first == mismatch.first) {
LogPrintf(" (1)");
- if (!firstLocked && secondLocked && i.second.fTry)
- onlyMaybeDeadlock = true;
- firstLocked = true;
}
if (i.first == mismatch.second) {
LogPrintf(" (2)");
- if (!secondLocked && firstLocked && i.second.fTry)
- onlyMaybeDeadlock = true;
- secondLocked = true;
}
LogPrintf(" %s\n", i.second.ToString());
}
- assert(onlyMaybeDeadlock);
+ assert(false);
}
static void push_lock(void* c, const CLockLocation& locklocation, bool fTry)
@@ -134,21 +110,19 @@ static void push_lock(void* c, const CLockLocation& locklocation, bool fTry)
(*lockstack).push_back(std::make_pair(c, locklocation));
- if (!fTry) {
- BOOST_FOREACH (const PAIRTYPE(void*, CLockLocation) & i, (*lockstack)) {
- if (i.first == c)
- break;
+ BOOST_FOREACH (const PAIRTYPE(void*, CLockLocation) & i, (*lockstack)) {
+ if (i.first == c)
+ break;
- std::pair<void*, void*> p1 = std::make_pair(i.first, c);
- if (lockdata.lockorders.count(p1))
- continue;
- lockdata.lockorders[p1] = (*lockstack);
+ std::pair<void*, void*> p1 = std::make_pair(i.first, c);
+ if (lockdata.lockorders.count(p1))
+ continue;
+ lockdata.lockorders[p1] = (*lockstack);
- std::pair<void*, void*> p2 = std::make_pair(c, i.first);
- lockdata.invlockorders.insert(p2);
- if (lockdata.lockorders.count(p2))
- potential_deadlock_detected(p1, lockdata.lockorders[p2], lockdata.lockorders[p1]);
- }
+ std::pair<void*, void*> p2 = std::make_pair(c, i.first);
+ lockdata.invlockorders.insert(p2);
+ if (lockdata.lockorders.count(p2))
+ potential_deadlock_detected(p1, lockdata.lockorders[p2], lockdata.lockorders[p1]);
}
}