mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-29 16:29:31 +02:00
Merge #18895: p2p: unbroadcast followups: rpcs, nLastResend, mempool sanity check
651f1d816f[test] wait for inital broadcast before comparing mempool entries (gzhao408)9d3f7eb986[mempool] sanity check that all unbroadcast txns are in mempool (gzhao408)a7ebe48b94[rpc] add unbroadcast info to mempool entries and getmempoolinfo (gzhao408)d160069604[wallet] remove nLastResend logic (gzhao408) Pull request description: Followup to #18038 by amitiuttarwar which introduces the unbroadcast set: "a mechanism for the mempool to track locally submitted transactions" and decreases the frequency of rebroadcast from 10-15 minutes to 12-36 hours. This PR addresses some of the outstanding TODOs building on top of it: - remove `nLastResend` logic, which is used to ensure rebroadcast doesn't happen again if no new block has been mined (makes sense in 10-15 min period, but not necessary for 12-36 hour period). (#18038 [comment](https://github.com/bitcoin/bitcoin/pull/18038#discussion_r416826914)) - expose unbroadcast info via RPCs, for more informative queries and testing (#18038 [comment](https://github.com/bitcoin/bitcoin/pull/18038#discussion_r416837980)) - add sanity check to verify unbroadcast transactions still exist in mempool before rebroadcasting (#18038 [comment](https://github.com/bitcoin/bitcoin/pull/18038#discussion_r416861609)) ACKs for top commit: naumenkogs: Code review ACK651f1d816famitiuttarwar: ACK651f1d816f🎉 MarcoFalke: Review ACK651f1d816fTree-SHA512: d5327e95ef39d44152b48df5c610502ae11c168f43dbbfb2885340c93d1ba9426eb3a5794573f5fc843502109cb3ffb63efa3f2db4f8f112efcde8f76d9a8845
This commit is contained in:
@@ -817,7 +817,12 @@ void PeerLogicValidation::ReattemptInitialBroadcast(CScheduler& scheduler) const
|
||||
std::set<uint256> unbroadcast_txids = m_mempool.GetUnbroadcastTxs();
|
||||
|
||||
for (const uint256& txid : unbroadcast_txids) {
|
||||
RelayTransaction(txid, *connman);
|
||||
// Sanity check: all unbroadcast txns should exist in the mempool
|
||||
if (m_mempool.exists(txid)) {
|
||||
RelayTransaction(txid, *connman);
|
||||
} else {
|
||||
m_mempool.RemoveUnbroadcastTx(txid, true);
|
||||
}
|
||||
}
|
||||
|
||||
// schedule next run for 10-15 minutes in the future
|
||||
|
||||
Reference in New Issue
Block a user