Open sunnyking opened 5 years ago
In fact, whether using a cold wallet or a hot wallet, send or lease, there will be such a problem.
Sergiojiu747 and I found out the reason for the display problem. The following is the original code: amount: Number((this.coldAmount VEE_PRECISION).toFixed(0)) where VEE_PRECISION=1e8 this is used to solve the problem of precision in arithmetic operation in JavaScript (By converting decimals to integers ,then calculating) However, the maximum number of digits that javascript supports is 16bits.So if the integer >1e16 (or 9007199254740992),the result will be wrong. Test results: 1.Input:10000000.00000001 位数:16 (Input1e8).toFixed(0): 1000000000000001 and transfered number is: 10000000.00000001 2.Input:1000000000.00000001 位数:18 (Input*1e8).toFixed(0): 100000000000000000 and transfered number is: 1000000000
So, the problem is caused by JavaScript itself. One suggestion is that we can give a warning message if the amount is bigger than 16 digits , and suggest divide the transaction into small ones . Another suggestion is limiting the maximum transaction amount in the first place.
When sending a payment transaction 1,000,000,000.00000001 coins from a cold wallet address, the confirmation dialog loses the fractional 0.00000001 in the payment amount.