-
Notifications
You must be signed in to change notification settings - Fork 493
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
ledger: disable minimum balance check when not validating or generating #2149
ledger: disable minimum balance check when not validating or generating #2149
Conversation
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.
Could you call applyTransaction
directly instead of disabling the verification logic?
ledger/eval.go
Outdated
// Only do those checks if needed. It is useful to skip them if the user cannot provide | ||
// account data that contains enough information to compute the correct minimum balance | ||
// (the case with indexer). | ||
if eval.validate || eval.generate { |
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.
Please avoid the indentation to match the rest of the code by changing this to
if !eval.validate && !eval.generate {
continue
}
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.
I think it's common to have an if statement for eval.validate
or eval.generate
. I also oppose continue
and break
. :)
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.
I think that we should take one step back here.
This entire for loop could be skipped in case !eval.validate && !eval.generate
holds true.
Please take a close look, but if this true, I think that we could extract this for-loop into a separate method. That would address the indentation issue, provide faster code and work for the indexer - all at the same time.
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.
You are right, thanks!
I think it's not so easy. There is logic outside of |
ledger/eval.go
Outdated
if eval.validate || eval.generate { | ||
err := eval.checkMinBalance(cow) | ||
if err != nil { | ||
return fmt.Errorf("transaction: %v err: %w", txid, err) |
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.
"transaction: %v err: %w"
-> "transaction %v: %w"
just to retain the previous error strings, which might be used elsewhere.
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.
run make fmt
to format your changes.
…ng (algorand#2149) ledger: disable minimum balance check when not validating or generating
Summary
This is needed for indexer that doesn't store
AccountData.TotalSchema
that allows computing account's minimum balance.Test Plan
The change is trivial.