mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Fix ComputeTimeSmart test failure with -DDEBUG_LOCKORDER
Failure looks like:
Entering test case "ComputeTimeSmart"
test_bitcoin: sync.cpp💯 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.
This commit is contained in:
@@ -553,7 +553,10 @@ static int64_t AddTx(CWallet& wallet, uint32_t lockTime, int64_t mockTime, int64
|
||||
if (block) {
|
||||
wtx.SetMerkleBranch(block, 0);
|
||||
}
|
||||
wallet.AddToWallet(wtx);
|
||||
{
|
||||
LOCK(cs_main);
|
||||
wallet.AddToWallet(wtx);
|
||||
}
|
||||
LOCK(wallet.cs_wallet);
|
||||
return wallet.mapWallet.at(wtx.GetHash()).nTimeSmart;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user