Add wtxid to mempool unbroadcast tracking

This commit is contained in:
Amiti Uttarwar
2020-04-30 18:20:01 -07:00
committed by Suhas Daftuar
parent 2b4b90aa8f
commit c7eb6b4f1f
4 changed files with 24 additions and 18 deletions

View File

@@ -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);