-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Using amountSatStr on output gives wrong results #522
Comments
The reason appears to be in this line 403 in TransactionBuilder:
Specifically this case:
bignum only accepts integers strings. |
I tried this with bignum 0.9.0:
|
See also |
Try in the browser with bitcore loaded there: var bignum = require('bitcore').bignum console.log(Number(bignum("990000"))) console.log(Number(bignum("990000.00000000"))) Prints: 990000 990000000000000 |
On the server-side, in Meteor, using bitcore 0.1.34:
=>
In my browser, Opera, it breaks the same way you said:
=>
The JS code should be the exact same, being pushed by Meteor to the client. Very strange, perhaps this is a bug in a parsing library beneath bignum? |
Perhaps the node and browser bignum implementations differ in some respects. If I understand correctly, the node library has content in C++. Also bitcore has the following file that appears to be used for the browser build: /lib/browser/Bignum.js. |
Good catch. Will write a test and see if it fails in node or in the browser |
oudated. Please use our new |
On outputs, specifying amountSatStr of "990000.00000000" gives a different result from "990000". The former appears to be interpreted as Bitcoins, while the latter satoshis. Not sure where this happens. And not sure if the scaling is a result of being interpreted as Bitcoins, or whether the scaling is a result of the eight fractional zeros.
(Sorry, don't have a means to create a test case at the moment. Will try to do so. For the moment, I just want to record the observation.)
The text was updated successfully, but these errors were encountered: