Conversation
| let nonce_span = nonce.saturating_sub(on_chain_nonce); | ||
| if nonce_span > self.max_rate { | ||
| debug!("Current nonce={nonce}, on-chain nonce={on_chain_nonce}. Sending 10 txs"); | ||
| let batch_entries = self.build_batch_entries(10, on_chain_nonce).await?; |
There was a problem hiding this comment.
Why 10? should it not be none_span?
There was a problem hiding this comment.
Just a small number of tx to clear the nonce gap in case there is one. Note that it might be that there is no nonce gap and the blocks are committed slower than the injection rate. So we shouldn't inject a lot of transactions here as we might very well send a lot of duplicates.
| break; | ||
| // Report individual results. | ||
| for ((_, tx_bytes_len), result) in batch_entries.into_iter().zip(results) { | ||
| let mapped_result = result.map(|_| tx_bytes_len); |
There was a problem hiding this comment.
Why are we discarding the Ok value of results?
There was a problem hiding this comment.
I think it's because it contains the tx hash, which isn't used later anywhere, and we don't care about single tx success because it will slow down the spammer. We should modify this if needed. cc @mpoke
|
|
||
| // Report individual results. | ||
| for ((_, tx_bytes_len), result) in batch_entries.into_iter().zip(results) { | ||
| let mapped_result = result.map(|_| tx_bytes_len); |
ljoss17
left a comment
There was a problem hiding this comment.
Pre-approving.
Left a few questions
Replaces #120