chore(mempool): user batch followups#2034
Merged
Mirko-von-Leipzig merged 10 commits intomainfrom May 7, 2026
Merged
Conversation
sergerad
reviewed
May 5, 2026
| for tx in &txs { | ||
| assert!(self.by_tx.insert(*tx, batch).is_none()); | ||
| } | ||
| assert!(self.by_batch.insert(batch, txs).is_none()); |
Collaborator
There was a problem hiding this comment.
Why do we want the assert here? Even if we expect this API to never be used with the same inserts more than once, I would think this type should be factored to be robust against that.
Collaborator
Author
There was a problem hiding this comment.
Its more that this is a helper function/struct, and in the caller's scope a double insert would constitute a logical bug.
So its not that the BatchTxMap cannot be hardened against this, its that this indicates a larger !@#!%$ up in the mempool in general. And this is a convenient place to do an assert on this.
sergerad
reviewed
May 5, 2026
|
|
||
| fn contains_tx(&self, tx: &TransactionId) -> bool { | ||
| self.by_tx.contains_key(tx) | ||
| } |
Collaborator
There was a problem hiding this comment.
Could be worth adding quick unit tests for this type
sergerad
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the minor #1995 follow-up tasks, others have issues created now.
Closes #1995