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

[ADDED] getrealbalance wrapper for payouts #1757

Merged
merged 4 commits into from
Feb 16, 2014
Merged

Conversation

TheSerapher
Copy link
Contributor

During payouts, we must ensure our wallets main accounts has the funds
to payout users. Hence we implement a wrapper method:

  • If account count == 1 we only have main account, return getbalance
  • Else return our main accounts balance - calculated unconfirmed

This should keep getbalance untouched when used on other places but
gives our payout processing a proper main account balance.

It's mostly a wrapper for those wallets running multiple accounts in one
wallet. They are warned on the front-end already but this ensure payouts
process properly.

Fixes #1755 once merged.

During payouts, we must ensure our wallets main accounts has the funds
to payout users. Hence we implement a wrapper method:

* If account count == 1 we only have main account, return getbalance
* Else return our main accounts balance - calculated unconfirmed

This should keep getbalance untouched when used on other places but
gives our payout processing a proper main account balance.

It's mostly a wrapper for those wallets running multiple accounts in one
wallet. They are warned on the front-end already but this ensure payouts
process properly.

Fixes #1755 once merged.
using php abs() should do the trick with negative balance
@TheSerapher
Copy link
Contributor Author

Looks good. Please get it tested then merge.

@iAmShorty
Copy link
Contributor

tested and looks good so far, can someone confirm this?

@TheSerapher
Copy link
Contributor Author

Tested with multiple accounts, positive main account balance. Returned value was the expected one for a getbalance call. Looks fine so far, but negative main account may be interesting too?

@TheSerapher
Copy link
Contributor Author

Moved out more than available coins from the main account. Updated the bitcoinwrapper since you missed a ; in line 56. Also I don't think we need to check further if the main account is negative, we can just return this negative amount.

Now it should be okay?

@iAmShorty
Copy link
Contributor

yeah, forgot that. was copy and paste from ipad directly to your pr, no push :)

sure, if main account is negative there's no need to do further checks. payout should be stopped because of insufficient funds. so i think we can merge if no one complains. but we can delete the if case, effect is the same, balance is negative.

@TheSerapher
Copy link
Contributor Author

True but balance had a wrong negative value. I prefer to bail with the actual main accounts negative value instead of a strange one.

We merge in a few hours unless we hear a veto.

@iAmShorty
Copy link
Contributor

no veto from here :)

TheSerapher added a commit that referenced this pull request Feb 16, 2014
[ADDED] getrealbalance wrapper for payouts
@TheSerapher TheSerapher merged commit 5dd13d4 into next Feb 16, 2014
@TheSerapher TheSerapher deleted the getrealbalance-wrapper branch February 16, 2014 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants