aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2018-03-13 18:33:17 -0400
committerRussell Yanofsky <russ@yanofsky.org>2018-03-13 19:41:38 -0400
commit33eb9071b98e63fd66c1211254e420535320eebd (patch)
tree7c2edef09e479d9a11345f83901a7e302a8cd805 /src/wallet/wallet.cpp
parentd42a4fe5aaae60f33a89bde78f21820abefce922 (diff)
Fix ComputeTimeSmart test failure with -DDEBUG_LOCKORDER
Failure looks like: Entering test case "ComputeTimeSmart" test_bitcoin: sync.cpp:100: void potential_deadlock_detected(const std::pair<void*, void*>&, const LockStack&, const LockStack&): Assertion `false' failed. unknown location(0): fatal error in "ComputeTimeSmart": signal: SIGABRT (application abort requested) wallet/test/wallet_tests.cpp(566): last checkpoint Reproducible with: ./configure --enable-debug make -C src test/test_bitcoin && src/test/test_bitcoin --log_level=test_suite --run_test=wallet_tests/ComputeTimeSmart Happens due to "92fabcd443 Add LookupBlockIndex function" which acquires cs_main from inside CWallet::ComputeTimeSmart.
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index e1f940e114..3e77daf0bf 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -3813,12 +3813,7 @@ unsigned int CWallet::ComputeTimeSmart(const CWalletTx& wtx) const
{
unsigned int nTimeSmart = wtx.nTimeReceived;
if (!wtx.hashUnset()) {
- const CBlockIndex* pindex = nullptr;
- {
- LOCK(cs_main);
- pindex = LookupBlockIndex(wtx.hashBlock);
- }
- if (pindex) {
+ if (const CBlockIndex* pindex = LookupBlockIndex(wtx.hashBlock)) {
int64_t latestNow = wtx.nTimeReceived;
int64_t latestEntry = 0;