-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(mempool)!: match server/v2/cometbft and sdk mempool interface #21744
Changes from all commits
741842f
55edf6c
6c1ca6d
f2eb295
c355618
94c6858
99ff2a4
d3ccd44
efd4be2
572ec03
1990634
c3ed1fa
ee627c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,10 +14,10 @@ type Mempool interface { | |
|
||
// Select returns an Iterator over the app-side mempool. If txs are specified, | ||
// then they shall be incorporated into the Iterator. The Iterator is not thread-safe to use. | ||
Select(context.Context, [][]byte) Iterator | ||
Select(context.Context, []sdk.Tx) Iterator | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why the change here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As otherwise in server/v2 we would decode twice if the mempool implementation decodes the txs (ours do not, but we cannot know about users): https://github.com/cosmos/cosmos-sdk/blob/95b8092/server/v2/cometbft/handlers/defaults.go#L52 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we use a generic instead of either There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. err.. this interface is only used for app v1 correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea, the one of server/v2 is identical but use generic |
||
|
||
// SelectBy use callback to iterate over the mempool, it's thread-safe to use. | ||
SelectBy(context.Context, [][]byte, func(sdk.Tx) bool) | ||
SelectBy(context.Context, []sdk.Tx, func(sdk.Tx) bool) | ||
|
||
// CountTx returns the number of transactions currently in the mempool. | ||
CountTx() int | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Complete the implementation of the
SelectBy
function.The
SelectBy
function has been added to facilitate the selection of transactions based on a predicate. However, the current implementation is empty.Please complete the function logic to ensure it behaves as expected when called. Consider iterating over the input transactions and applying the predicate to each transaction to determine which ones should be selected.