mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge #12681: Fix ComputeTimeSmart test failure with -DDEBUG_LOCKORDER
33eb9071b9
Fix ComputeTimeSmart test failure with -DDEBUG_LOCKORDER (Russell Yanofsky)
Pull request description:
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
```
Seems to be caused by acquiring `cs_main` inside `CWallet::ComputeTimeSmart` in #11041.
I think this may be causing timeouts on travis like: https://travis-ci.org/bitcoin/bitcoin/jobs/353005676#L2692
Tree-SHA512: b263cd122ea9c88204d1d8e7e35291c71ea6319f05114c5009235a75dbd0f669bc0394f44afeed0d9eb08c2a956cd7c08f1ac4ef28616932fef9b43eaac5521b
This commit is contained in:
parent
e0acd39ce2
commit
e723edb4e6
@ -554,7 +554,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;
|
||||
}
|
||||
|
@ -4964,12 +4964,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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user