Skip to content
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

vms/avm: Add exists bool to mempool Peek #2465

Merged
merged 3 commits into from
Dec 11, 2023
Merged

Conversation

dhrubabasu
Copy link
Contributor

Why this should be merged

Seems odd to use the zero value to determine non-existence, let's be explicit

How this works

Adds an exists return param

How this was tested

CI

@dhrubabasu dhrubabasu added the cleanup Code quality improvement label Dec 11, 2023
@dhrubabasu dhrubabasu added this to the v1.10.18 milestone Dec 11, 2023
@dhrubabasu dhrubabasu self-assigned this Dec 11, 2023
// Invariant: [mempool.MaxTxSize] < [targetBlockSize]. This guarantees
// that we will only stop building a block once there are no
// transactions in the mempool or the block is at least
// [targetBlockSize - mempool.MaxTxSize] bytes full.
if tx == nil || len(tx.Bytes()) > remainingSize {
if !exists && tx == nil || len(tx.Bytes()) > remainingSize {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should check if tx == nil anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it could still return nil but we do guard against that since we verify the tx first before adding it to the mempool- dropping

@StephenButtolph StephenButtolph added this pull request to the merge queue Dec 11, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 11, 2023
@StephenButtolph StephenButtolph added this pull request to the merge queue Dec 11, 2023
Merged via the queue into dev with commit a361868 Dec 11, 2023
16 checks passed
@StephenButtolph StephenButtolph deleted the add-exists-bool-to-Peek branch December 11, 2023 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Code quality improvement
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants