diff --git a/lib/common.js b/lib/common.js index f274397..a176ce1 100644 --- a/lib/common.js +++ b/lib/common.js @@ -286,7 +286,7 @@ PaymentProtocol.prototype.get = function(key) { //protobuf supports longs, javascript naturally does not //convert longs (see long.js, e.g. require('long')) to Numbers if (typeof v.low !== 'undefined' && typeof v.high !== 'undefined') { - return v.toInt(); + return v.toNumber(); } if (typeof v.toBuffer !== 'undefined') { diff --git a/test/index.js b/test/index.js index 7326360..1616122 100644 --- a/test/index.js +++ b/test/index.js @@ -128,6 +128,13 @@ describe('PaymentProtocol', function() { output.message.get('amount').toInt().should.equal(20); }); + it('should be able to get and set amount >= 2^32 through "PaymentProtocol"', function () { + var paypro = new PaymentProtocol(); + paypro.makeOutput(); + paypro.set('amount', 4294967296); + paypro.get('amount').should.equal(4294967296); + }); + }); describe('#PaymentDetails', function() {