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

Automatically cancel RefundRequested transactions #12

Closed
stanly-johnson opened this issue Feb 7, 2022 · 3 comments · Fixed by virto-network/kreivo#198
Closed

Automatically cancel RefundRequested transactions #12

stanly-johnson opened this issue Feb 7, 2022 · 3 comments · Fixed by virto-network/kreivo#198
Assignees
Milestone

Comments

@stanly-johnson
Copy link
Member

ideally the refund is executed automatically...
There are several ways to do this but perhaps it will be a good time for off-chain workers to shine? since we might be iterating and filtering the potentially big list of payments I think it's something we can delegate to a worker, we might also want to keep track separately of payments in the RefundRequested state for simpler processing

Originally posted by @olanod in virto-network/kreivo#186 (review)

@olanod
Copy link
Member

olanod commented Feb 18, 2022

Another approach that is simpler than off-chain workers and elegant enough is to do like the scheduler pallet that has an Agenda which is a storage item that indexes the tasks(e.g. Task::Refund(from, to)) by block number so the on_initialize hook can check for each block if there's anything to be done. Can also be used for #8

@stanly-johnson
Copy link
Member Author

How about on_idle hook? The caveat is that we can't guarantee it would execute at block X, it would execute at any non-full block after block X. wdyt?

@olanod
Copy link
Member

olanod commented Feb 20, 2022

on_idle sounds reasonable, maybe not for the recurrent payment indexed by block number but here could work, we keep a "queue" of pending refunds and try to refund as many as possible with the remaining weight of the idle block

@stanly-johnson stanly-johnson self-assigned this Feb 23, 2022
@olanod olanod transferred this issue from virto-network/kreivo Mar 20, 2022
@olanod olanod added this to the Payments V1 milestone Mar 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants