miaomiaomiao Posted June 10 Report Share Posted June 10 (edited) country is ID The actual balance is 22,517,929.24 After logging in, a wallet event was triggered, and it's showing an incorrect balance of -20431743.72 Could anyone help me understand what might be going wrong and guide me on how to fix it? Edited June 10 by miaomiaomiao add content Quote Link to comment Share on other sites More sharing options...
miaomiaomiao Posted June 20 Author Report Share Posted June 20 Received wallet info update: { has_wallet: true, balance: -2132471336, currency: 15, balance_delayed: 0, balance64: '2162495960', balance64_delayed: '0', realm: 1 } this is a wallet event balance64 is Correct // source code this.emit('wallet', body.has_wallet, body.currency, body.balance / 100); this.wallet = { hasWallet: body.has_wallet, currency: body.currency, balance: body.balance / 100 }; body.balance use body.balance64 is ok doctor can update this? Quote Link to comment Share on other sites More sharing options...
HypeLevels Posted September 19 Report Share Posted September 19 On 6/20/2024 at 3:44 AM, miaomiaomiao said: Received wallet info update: { has_wallet: true, balance: -2132471336, currency: 15, balance_delayed: 0, balance64: '2162495960', balance64_delayed: '0', realm: 1 } this is a wallet event balance64 is Correct // source code this.emit('wallet', body.has_wallet, body.currency, body.balance / 100); this.wallet = { hasWallet: body.has_wallet, currency: body.currency, balance: body.balance / 100 }; body.balance use body.balance64 is ok doctor can update this? The reason this is happening is because balance is a 32 bit integer. Ur balance goes above the 32 bit integer limit so what it is doing is when it overflows over the INT_MAX (2147483647) it "resets" to INT_MIN (-2147483647) and adds the remainder of Balance - INT_MAX which is (15012313) back to INT_MIN which makes it -2132471336. Just use balance64 and you should be good but if you NEED to use balance you can just do balance + 2 + 2 * INT_MAX Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.