From 333a48e4e209ad15379375ad73e44e13459e007d Mon Sep 17 00:00:00 2001 From: Tao Zhu <82401714+taozhu-chicago@users.noreply.github.com> Date: Thu, 21 Jul 2022 20:15:17 -0500 Subject: [PATCH] Add comment for forwarder buffer iteration behavior (#26721) Add comment of forwarder buffer iteration behavior --- core/src/banking_stage.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/src/banking_stage.rs b/core/src/banking_stage.rs index 1ddb82dcbc..5c8a10fe3e 100644 --- a/core/src/banking_stage.rs +++ b/core/src/banking_stage.rs @@ -527,6 +527,14 @@ impl BankingStage { result }; + // Iterates buffered packets from high priority to low, places each packet into + // forwarding account buckets by calling `forward_packet_batches_by_accounts.add_packet()`. + // Iteration stops as soon as `add_packet()` returns false when a packet fails to fit into + // buckets, ignoring remaining lower priority packets that could fit. + // The motivation of this is during bot spamming, buffer is likely to be filled with + // transactions have higher priority and write to same account(s), other lower priority + // transactions will not make into buffer, therefore it shall exit as soon as first + // transaction failed to fit in forwarding buckets. buffered_packet_batches.iter_desc(filter_forwardable_packet); inc_new_counter_info!(