-
Notifications
You must be signed in to change notification settings - Fork 27
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
multi: add payment request processing. #140
Conversation
26d41dd
to
55f9922
Compare
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.
Looks good to me, just added one question
maturePayments, err := FetchMaturePendingPayments(db, height) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
bundles := generatePaymentBundles(maturePayments) | ||
for idx := 0; idx < len(bundles); idx++ { | ||
for idx := len(bundles) - 1; idx >= 0; idx-- { |
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.
Is there a reason this is iterating backwards? Might be nice to explain this unusual loop with a comment
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.
Yeah, iterating backwards is convenient here because the slice gets updated (via deletion) during iteration. When that happens the current index decrements (i--
), iterating backwards already takes care of the decrement if there should be a deletion. It's ideal as result.
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.
Clever. Definitely worth a comment to ensure people don't try and change this in future
This implements payment processing infrastructure to the pool and fixes an off-by-one bug regarding pruning eligible payments based on the minimum allowed amount.
55f9922
to
abd2ed7
Compare
This implements payment processing infrastructure to the pool and fixes an off-by-one bug regarding pruning eligible payments based on the minimum allowed amount.