diff options
author | Amiti Uttarwar <amiti@uttarwar.org> | 2020-04-30 18:20:01 -0700 |
---|---|---|
committer | Suhas Daftuar <sdaftuar@gmail.com> | 2020-07-18 19:00:01 -0400 |
commit | c7eb6b4f1fe5bd76388a023529977674534334a7 (patch) | |
tree | af43adf8cbb691da6e6b330c2b14926985cb0775 /src/validation.cpp | |
parent | 2b4b90aa8f0440deacefb5997d7bd1f9f5c591b3 (diff) |
Add wtxid to mempool unbroadcast tracking
Diffstat (limited to 'src/validation.cpp')
-rw-r--r-- | src/validation.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index b90ff440be..d271be6310 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -5083,19 +5083,22 @@ bool LoadMempool(CTxMemPool& pool) } // TODO: remove this try except in v0.22 + std::map<uint256, uint256> unbroadcast_txids; try { - std::set<uint256> unbroadcast_txids; file >> unbroadcast_txids; unbroadcast = unbroadcast_txids.size(); - - for (const auto& txid : unbroadcast_txids) { - pool.AddUnbroadcastTx(txid); - } } catch (const std::exception&) { // mempool.dat files created prior to v0.21 will not have an // unbroadcast set. No need to log a failure if parsing fails here. } - + for (const auto& elem : unbroadcast_txids) { + // Don't add unbroadcast transactions that didn't get back into the + // mempool. + const CTransactionRef& added_tx = pool.get(elem.first); + if (added_tx != nullptr) { + pool.AddUnbroadcastTx(elem.first, added_tx->GetWitnessHash()); + } + } } catch (const std::exception& e) { LogPrintf("Failed to deserialize mempool data on disk: %s. Continuing anyway.\n", e.what()); return false; @@ -5111,7 +5114,7 @@ bool DumpMempool(const CTxMemPool& pool) std::map<uint256, CAmount> mapDeltas; std::vector<TxMempoolInfo> vinfo; - std::set<uint256> unbroadcast_txids; + std::map<uint256, uint256> unbroadcast_txids; static Mutex dump_mutex; LOCK(dump_mutex); |