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

chequebook: change cashout api to include uncashed amount #1402

Merged
merged 3 commits into from
Mar 24, 2021

Conversation

ralph-pichler
Copy link
Member

@ralph-pichler ralph-pichler commented Mar 9, 2021

changes the GET cashout endpoint to include uncashed amount. it always returns uncashed amount even if no cashout has taken place so far (as long as we have in fact at least one cheque from the peer).

The main advantage of putting this into cashout endpoint are easier cashout scripts as we can all relevant values in one call and better handling of currently pending or cancelled transactions (in the calculation of uncashed amount).

This is an API-breaking change as in addition to the new uncashedAmount, several values moved into lastCashedCheque (which may be null).

@ralph-pichler ralph-pichler self-assigned this Mar 9, 2021
@ralph-pichler ralph-pichler added the ready for review The PR is ready to be reviewed label Mar 9, 2021
@ralph-pichler ralph-pichler marked this pull request as ready for review March 9, 2021 08:47
Copy link
Member

@zelig zelig left a comment

Choose a reason for hiding this comment

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

i presume s.swap.CashoutStatus(r.Context(), peer) fills in UncashedAmount and it is tested.

@ralph-pichler
Copy link
Member Author

@zelig swap just translates from peer to chequebook and forwards the reference to the cashout status struct, so there was no change necessary there.

Copy link
Member

@acud acud left a comment

Choose a reason for hiding this comment

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

LGTM

var action *cashoutAction
err := s.store.Get(cashoutActionKey(chequebookAddress), &action)
err = s.store.Get(cashoutActionKey(chequebookAddress), &action)
Copy link
Member

Choose a reason for hiding this comment

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

consider initializing action as an instance, then just pass the address here

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@ralph-pichler ralph-pichler merged commit c050516 into master Mar 24, 2021
@ralph-pichler ralph-pichler deleted the uncashed_amount branch March 24, 2021 18:34
@Eknir Eknir mentioned this pull request Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull-request ready for review The PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants