CoinRoster / slotmachine

fruitgame
0 stars 0 forks source link

deposit confrmation #57

Closed RiskingTime closed 6 years ago

RiskingTime commented 6 years ago

_deposit_confirmed

btc deposit has been made and confirmed on the blockchain, but system displays a msg saying "deposit not yet confirmed". This is not related to transfers made using the admin page as both of my test users have the same issue (and only one of the user's btc has been transferred using the admin panel)

Patrick-Bay commented 6 years ago

This issue is caused by the fact that when blockchain amounts are 0, as will happen when the amount is transferred out. Currently we have no way to test for re-deposits and allow transactions that have a 0 blockchain balance since they're assumed not to be completed.

We could use the "depositcomplete value to track differences between deposits as well as to flag an account as valid (can make investment transactions), even with a 0 blockchain balance.

There are two place where thus will be updated: on the "CHECK DEPOSIT" button on the main game UI and in the "DEPOSIT" (to investment) button on the Account page.

On the back end the changes will involve the rpc_updateInvestorInfo function in the investment plugin and the RPC_checkAccountDeposit function in the main game server code. During the Admin transfer we will want to update the database so that we can detect that the available balance is valid (i.e. don't check verified balance in database).

We should add a check for this flag on the UPDATE BANKROLL MULTIPLIER function too (just to update the account if necessary). Are there other places in the app that check the account deposit? These should be updated too.

The Account page UI should update itself whenever values have changes (e.g. new deposit detected, etc.)

I would estimate this task to take approximately 3 hours, including testing.

Patrick-Bay commented 6 years ago

Also we will want to change the "deposit_complete" in the database to something more descriptive ("deposit_status"?)

RiskingTime commented 6 years ago
Patrick-Bay commented 6 years ago

Fix has been committed (https://github.com/CoinRoster/slotmachine/commit/f5ed1e681f908bdd5a4cc4fdaf31cf1d324ce684), pulled to dev server, and is available for immediate testing.

Note that BlockCypher sometimes returns negative values:

Transaction

After some investigation, it seems that these are not common but sometimes occur when it is deemed that the recent transaction(s) are highly unlikely to end up in a block. This seems to be related to our use of very low fees in the Admin page but may cause issues elsewhere too. I've tried to head this off at the pass by manipulating some returned values if they're negative but we should keep an eye on this. This is also the most probable and direct cause for issues https://github.com/CoinRoster/slotmachine/issues/45 and https://github.com/CoinRoster/slotmachine/issues/1

RiskingTime commented 6 years ago
  1. open an account
  2. make a deposit
  3. does it show up in the game balance?
  4. check to see if unconfirmed amounts prevent the user from depositing to the bankroll?
  5. wait for deposit to be confirmed
  6. try deposing to the bankroll again
  7. transfer the amount off the address using the admin panel
  8. attempt to play the game and attempt to make another bankroll deposit
  9. make another deposit on the same account
  10. try to play the game, try to make a investment deposit (while the funds are unconfirmed)
  11. see whether the available balance for investment on the my account page is different from the new unconfirmed deposit
  12. wait for confirmation, and repeat trying to play the game and make an investment deposit
RiskingTime commented 6 years ago

I added numbers to the testing steps to make it easier to understand which step to refer to

RiskingTime commented 6 years ago

I hit a bug at step 4, the game allowed me to make a deposit to the bankroll even though my deposit wasn't confirmed yet. See image

unconfirmed_investment _deposit_20180521

RiskingTime commented 6 years ago

tested this with a second account and when the deposit is unconfirmed, it does not allow the user to deposit to the bankroll (which is what it is supposed to do)

RiskingTime commented 6 years ago

tried a third account, and wasn't able to deposit to the bankroll with unconfirmed funds, it looks like just one account mnWkKfPdgFC4fCoXM5bvd37jzwJJnx4qqj had the negative balance issue as mentioned above, the other two accounts I tested worked fine, let's just make note of this, but not spend any time examining for the time being

RiskingTime commented 6 years ago

made it to testing step 10, made a subsequent unconfirmed deposit, and was able to also deposit this to the bankroll (I was able to deposit my entire balance (confirmed + unconfirmed) to the bankroll. this bug is pretty low risk, we could close it up, but let's just leave it for now

RiskingTime commented 6 years ago

blochain_transaction total_investment