diff options
author | Amiti Uttarwar <amiti@uttarwar.org> | 2020-07-27 21:30:50 -0700 |
---|---|---|
committer | Amiti Uttarwar <amiti@uttarwar.org> | 2020-09-04 14:29:29 -0700 |
commit | cb79b9dbf4cd06e17c8c65b36bf15c3ea2641de4 (patch) | |
tree | 43860832dcabade3ecfcfdba3af41ba10cfe9adb /src/net_processing.cpp | |
parent | 23d3ae7accfc690298b1b0bac9615155f485c5ad (diff) | |
download | bitcoin-cb79b9dbf4cd06e17c8c65b36bf15c3ea2641de4.tar.xz |
[mempool] Revert unbroadcast set to tracking just txid
When I originally implemented the unbroadcast set in 18038, it just tracked
txids. After 18038 was merged, I offered a patch to 18044 to make the
unbroadcast changes compatible with wtxid relay. In this patch, I updated
`unbroadcast_txids` to a map of txid -> wtxid. Post merge review comments shed
light on the fact that this update was unnecessary, and distracting. So, this
commit updates the unbroadcast ids back to a set.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index ce4ac3cd75..e1007e071f 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -889,15 +889,16 @@ void PeerLogicValidation::InitializeNode(CNode *pnode) { void PeerLogicValidation::ReattemptInitialBroadcast(CScheduler& scheduler) const { - std::map<uint256, uint256> unbroadcast_txids = m_mempool.GetUnbroadcastTxs(); + std::set<uint256> unbroadcast_txids = m_mempool.GetUnbroadcastTxs(); - for (const auto& elem : unbroadcast_txids) { - // Sanity check: all unbroadcast txns should exist in the mempool - if (m_mempool.exists(elem.first)) { + for (const auto& txid : unbroadcast_txids) { + CTransactionRef tx = m_mempool.get(txid); + + if (tx != nullptr) { LOCK(cs_main); - RelayTransaction(elem.first, elem.second, m_connman); + RelayTransaction(txid, tx->GetWitnessHash(), m_connman); } else { - m_mempool.RemoveUnbroadcastTx(elem.first, true); + m_mempool.RemoveUnbroadcastTx(txid, true); } } |