mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-04 08:51:00 +02:00
Merge bitcoin/bitcoin#31190: TxDownloadManager followups
5dc94d13d419b8d5e543cb50edeb872335c090e7 fuzz fix: assert MAX_PEER_TX_ANNOUNCEMENTS is not exceeded (glozow)
8351562bec6081eda2a600bfe4edeb264a9dee0b [fuzz] allow negative time jumps in txdownloadman_impl (glozow)
917ab810d9380aa0c649847a647078b2f02d2643 [doc] comment fixups from n30110 (glozow)
Pull request description:
Addresses some remaining followups from #30110:
- https://github.com/bitcoin/bitcoin/pull/30110#discussion_r1818893833
- https://github.com/bitcoin/bitcoin/pull/30110#discussion_r1819638959
- https://github.com/bitcoin/bitcoin/pull/30110#discussion_r1819634235
ACKs for top commit:
naumenkogs:
ACK 5dc94d13d4
instagibbs:
ACK 5dc94d13d419b8d5e543cb50edeb872335c090e7
theStack:
ACK 5dc94d13d419b8d5e543cb50edeb872335c090e7
Tree-SHA512: 568de8822b2ba73407d2231d9c8c83e6c53fb929b598102b6135c16805752954b3b9b53f4e698856d4422fd8ac2f58ce7d033e9d8e101ed09986578b7605df66
This commit is contained in:
commit
018e5fcc46
@ -134,7 +134,8 @@ public:
|
||||
/** Deletes all txrequest announcements and orphans for a given peer. */
|
||||
void DisconnectedPeer(NodeId nodeid);
|
||||
|
||||
/** New inv has been received. May be added as a candidate to txrequest.
|
||||
/** Consider adding this tx hash to txrequest. Should be called whenever a new inv has been received.
|
||||
* Also called internally when a transaction is missing parents so that we can request them.
|
||||
* @param[in] p2p_inv When true, only add this announcement if we don't already have the tx.
|
||||
* Returns true if this was a dropped inv (p2p_inv=true and we already have the tx), false otherwise. */
|
||||
bool AddTxAnnouncement(NodeId peer, const GenTxid& gtxid, std::chrono::microseconds now, bool p2p_inv);
|
||||
|
@ -160,7 +160,9 @@ public:
|
||||
void ConnectedPeer(NodeId nodeid, const TxDownloadConnectionInfo& info);
|
||||
void DisconnectedPeer(NodeId nodeid);
|
||||
|
||||
/** New inv has been received. May be added as a candidate to txrequest. */
|
||||
/** Consider adding this tx hash to txrequest. Should be called whenever a new inv has been received.
|
||||
* Also called internally when a transaction is missing parents so that we can request them.
|
||||
*/
|
||||
bool AddTxAnnouncement(NodeId peer, const GenTxid& gtxid, std::chrono::microseconds now, bool p2p_inv);
|
||||
|
||||
/** Get getdata requests to send. */
|
||||
|
@ -287,7 +287,7 @@ static void CheckInvariants(const node::TxDownloadManagerImpl& txdownload_impl,
|
||||
// We should never have more than the maximum in-flight requests out for a peer.
|
||||
for (NodeId peer = 0; peer < NUM_PEERS; ++peer) {
|
||||
if (!HasRelayPermissions(peer)) {
|
||||
Assert(txdownload_impl.m_txrequest.CountInFlight(peer) <= node::MAX_PEER_TX_REQUEST_IN_FLIGHT);
|
||||
Assert(txdownload_impl.m_txrequest.Count(peer) <= node::MAX_PEER_TX_ANNOUNCEMENTS);
|
||||
}
|
||||
}
|
||||
txdownload_impl.m_txrequest.SanityCheck();
|
||||
@ -430,8 +430,9 @@ FUZZ_TARGET(txdownloadman_impl, .init = initialize)
|
||||
}
|
||||
);
|
||||
|
||||
// Jump ahead in time
|
||||
time += fuzzed_data_provider.PickValueInArray(TIME_SKIPS);
|
||||
auto time_skip = fuzzed_data_provider.PickValueInArray(TIME_SKIPS);
|
||||
if (fuzzed_data_provider.ConsumeBool()) time_skip *= -1;
|
||||
time += time_skip;
|
||||
CheckInvariants(txdownload_impl, max_orphan_count);
|
||||
}
|
||||
// Disconnect everybody, check that all data structures are empty.
|
||||
|
@ -27,7 +27,7 @@ struct Behaviors {
|
||||
bool m_ignore_inv_txid;
|
||||
bool m_ignore_inv_wtxid;
|
||||
|
||||
// Constructor. We are passing and casting ints because they are more readable in a table (see all_expected_results).
|
||||
// Constructor. We are passing and casting ints because they are more readable in a table (see expected_behaviors).
|
||||
Behaviors(bool txid_rejects, bool wtxid_rejects, bool txid_recon, bool wtxid_recon, bool keep, bool txid_inv, bool wtxid_inv) :
|
||||
m_txid_in_rejects(txid_rejects),
|
||||
m_wtxid_in_rejects(wtxid_rejects),
|
||||
|
Loading…
x
Reference in New Issue
Block a user