Page MenuHomePhabricator

D11764.id34410.diff
No OneTemporary

D11764.id34410.diff

diff --git a/src/txmempool.h b/src/txmempool.h
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -808,7 +808,8 @@
/** Adds a transaction to the unbroadcast set */
void AddUnbroadcastTx(const TxId &txid) {
LOCK(cs);
- // Sanity Check: the transaction should also be in the mempool
+ // Sanity check the transaction is in the mempool & insert into
+ // unbroadcast set.
if (exists(txid)) {
m_unbroadcast_txids.insert(txid);
}
diff --git a/src/validation.cpp b/src/validation.cpp
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -5798,18 +5798,22 @@
// TODO: remove this try...catch after May 15th 2021,
// when no one is running v0.22.11 or lower anymore.
// This will be done by backporting PR20854.
+ std::set<TxId> unbroadcast_txids;
try {
- std::set<TxId> 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.22.12 will not have an
// unbroadcast set. No need to log a failure if parsing fails here.
}
-
+ for (const auto &txid : unbroadcast_txids) {
+ // Ensure transactions were accepted to mempool then add to
+ // unbroadcast set.
+ if (pool.get(txid) != nullptr) {
+ pool.AddUnbroadcastTx(txid);
+ }
+ }
} catch (const std::exception &e) {
LogPrintf("Failed to deserialize mempool data on disk: %s. Continuing "
"anyway.\n",

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 26, 12:05 (2 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5573500
Default Alt Text
D11764.id34410.diff (1 KB)

Event Timeline