mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge #11062: [mempool] Mark mempool import fails that were found in mempool as 'already there'
258d33b41
[mempool] Mark unaccepted txs present in mempool as 'already there'. (Karl-Johan Alm)
Pull request description:
I was investigating the reasons for failed imports in mempool and noticed that `LoadMempool()` and `pwallet->postInitProcess()` (for all wallets) are executed concurrently. The wallet will end up importing transactions that `LoadMempool()` later tries to import; the latter will fail due to the tx already being in the mempool.
This PR changes the log message, adding an additional "already there" entry. For transactions not accepted into mempool, a check if they are in the mempool is done first, and if found, they are counted as 'already there', otherwise counted as 'failed'.
Also slight rewording for consistency (successes, failed, expired, ... -> succeeded, failed, expired).
Tree-SHA512: 1a6134a25260917f2768365e0dfd8b278fe3f8287cab38bb028b7de3d517718a2d37696186dc7a23ceab338cc755fbbe7d45358ee94e573610fddd2a0620d6e5
This commit is contained in:
commit
26fee4f6bd
@ -4287,8 +4287,9 @@ bool LoadMempool(void)
|
||||
}
|
||||
|
||||
int64_t count = 0;
|
||||
int64_t skipped = 0;
|
||||
int64_t expired = 0;
|
||||
int64_t failed = 0;
|
||||
int64_t already_there = 0;
|
||||
int64_t nNow = GetTime();
|
||||
|
||||
try {
|
||||
@ -4319,10 +4320,18 @@ bool LoadMempool(void)
|
||||
if (state.IsValid()) {
|
||||
++count;
|
||||
} else {
|
||||
++failed;
|
||||
// mempool may contain the transaction already, e.g. from
|
||||
// wallet(s) having loaded it while we were processing
|
||||
// mempool transactions; consider these as valid, instead of
|
||||
// failed, but mark them as 'already there'
|
||||
if (mempool.exists(tx->GetHash())) {
|
||||
++already_there;
|
||||
} else {
|
||||
++failed;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
++skipped;
|
||||
++expired;
|
||||
}
|
||||
if (ShutdownRequested())
|
||||
return false;
|
||||
@ -4338,7 +4347,7 @@ bool LoadMempool(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
LogPrintf("Imported mempool transactions from disk: %i successes, %i failed, %i expired\n", count, failed, skipped);
|
||||
LogPrintf("Imported mempool transactions from disk: %i succeeded, %i failed, %i expired, %i already there\n", count, failed, expired, already_there);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user