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

Multi-transfer #23

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Multi-transfer #23

wants to merge 2 commits into from

Conversation

renjiexu
Copy link
Collaborator

Transfer to multiple persons

reason := parsedResult["reason"]
splitAmounts := splitCoins(totalAmount, len(toUserIds))

for i, toUserId := range toUserIds {
Copy link
Owner

Choose a reason for hiding this comment

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

Is there a way to wrap this in a transaction? I'm just worried that if someone spams a few transfers and these are going one at a time, that we end up in a bad state.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good point, I actually tried to move all the validation part to the beginning of the method, to reduce the possibility of partial transfer, but might be worth to just use a transaction wrapper, will take a look of the support of GORM

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 this pull request may close these issues.

2 participants