bitcore-payment-protocol icon indicating copy to clipboard operation
bitcore-payment-protocol copied to clipboard

Fix parsing uint64 fields with values >= 2^32

Open gabmontes opened this issue 8 years ago • 0 comments

The amount field in an Output message is 64 bits long and is represented in the JavaScript side using a Long object. When its value is get through the PaymentProtocol interface, it is parsed using the toInt(). toInt() interprets the Long object as 32 bit so amounts larger than 2^32 will be incorrectly parsed i.e. when an output has an amount larger than 42.9 BTC.

The same issue applies to the PaymentDetails/PaymentRequest messages as time and expires fields are uint64 too. If time or expires are larger than 2^32, get operations on those fields will return incorrect values.

gabmontes avatar Jun 08 '17 19:06 gabmontes