From ebfc328004d77fe33ac36c89bfdbfc85a51c847b Mon Sep 17 00:00:00 2001 From: Karl-Johan Alm Date: Fri, 18 Oct 2019 11:24:01 -0300 Subject: [PATCH] [mempool] Mark mempool import fails that were found in mempool as 'already there' Summary: 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. Backport of Bitcoin Core PR11062 https://github.com/bitcoin/bitcoin/pull/11062 Test Plan: ``` make check-all ``` Reviewers: Fabien, #bitcoin_abc, deadalnix Reviewed By: Fabien, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D4266 --- src/validation.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/validation.cpp b/src/validation.cpp index 708c2ec75..d438c7e59 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -5873,6 +5873,10 @@ bool LoadMempool(const Config &config, CTxMemPool &pool) { } else { ++expired; } + + if (ShutdownRequested()) { + return false; + } } std::map mapDeltas; file >> mapDeltas;