From 522d4f642a0eacca56c5f92a88dc8f22e9d8b6fb Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Sun, 3 Mar 2013 22:35:00 -0800 Subject: [PATCH] JS: Rename ADDRESS_ to ACCOUNT_ to be consistent with C++. --- src/js/uint.js | 4 ++-- src/js/uint160.js | 4 ++-- src/js/uint256.js | 3 --- test/amount-test.js | 6 +++--- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/js/uint.js b/src/js/uint.js index d95ccb51f..457e3e959 100644 --- a/src/js/uint.js +++ b/src/js/uint.js @@ -106,14 +106,14 @@ UInt.prototype.parse_generic = function (j) { case undefined: case "0": case this.constructor.STR_ZERO: - case this.constructor.ADDRESS_ZERO: + case this.constructor.ACCOUNT_ZERO: case this.constructor.HEX_ZERO: this._value = nbi(); break; case "1": case this.constructor.STR_ONE: - case this.constructor.ADDRESS_ONE: + case this.constructor.ACCOUNT_ONE: case this.constructor.HEX_ONE: this._value = new BigInteger([1]); diff --git a/src/js/uint160.js b/src/js/uint160.js index 12c7ff04c..66c980ec0 100644 --- a/src/js/uint160.js +++ b/src/js/uint160.js @@ -24,8 +24,8 @@ UInt160.width = 20; UInt160.prototype = extend({}, UInt.prototype); UInt160.prototype.constructor = UInt160; -var ADDRESS_ZERO = UInt160.ADDRESS_ZERO = "rrrrrrrrrrrrrrrrrrrrrhoLvTp"; -var ADDRESS_ONE = UInt160.ADDRESS_ONE = "rrrrrrrrrrrrrrrrrrrrBZbvji"; +var ACCOUNT_ZERO = UInt160.ACCOUNT_ZERO = "rrrrrrrrrrrrrrrrrrrrrhoLvTp"; +var ACCOUNT_ONE = UInt160.ACCOUNT_ONE = "rrrrrrrrrrrrrrrrrrrrBZbvji"; var HEX_ZERO = UInt160.HEX_ZERO = "0000000000000000000000000000000000000000"; var HEX_ONE = UInt160.HEX_ONE = "0000000000000000000000000000000000000001"; var STR_ZERO = UInt160.STR_ZERO = utils.hexToString(HEX_ZERO); diff --git a/src/js/uint256.js b/src/js/uint256.js index ab5b6f70b..42b01504a 100644 --- a/src/js/uint256.js +++ b/src/js/uint256.js @@ -24,9 +24,6 @@ UInt256.width = 32; UInt256.prototype = extend({}, UInt.prototype); UInt256.prototype.constructor = UInt256; -// XXX Generate these constants (or remove them) -var ADDRESS_ZERO = UInt256.ADDRESS_ZERO = "XXX"; -var ADDRESS_ONE = UInt256.ADDRESS_ONE = "XXX"; var HEX_ZERO = UInt256.HEX_ZERO = "00000000000000000000000000000000" + "00000000000000000000000000000000"; var HEX_ONE = UInt256.HEX_ONE = "00000000000000000000000000000000" + diff --git a/test/amount-test.js b/test/amount-test.js index 31fa7ba08..6a62aff24 100644 --- a/test/amount-test.js +++ b/test/amount-test.js @@ -17,16 +17,16 @@ buster.testCase("Amount", { buster.assert.equals(nbi(), UInt160.from_generic("0")._value); }, "Parse 0 export" : function () { - buster.assert.equals(UInt160.ADDRESS_ZERO, UInt160.from_generic("0").to_json()); + buster.assert.equals(UInt160.ACCOUNT_ZERO, UInt160.from_generic("0").to_json()); }, "Parse 1" : function () { buster.assert.equals(new BigInteger([1]), UInt160.from_generic("1")._value); }, "Parse rrrrrrrrrrrrrrrrrrrrrhoLvTp export" : function () { - buster.assert.equals(UInt160.ADDRESS_ZERO, UInt160.from_json("rrrrrrrrrrrrrrrrrrrrrhoLvTp").to_json()); + buster.assert.equals(UInt160.ACCOUNT_ZERO, UInt160.from_json("rrrrrrrrrrrrrrrrrrrrrhoLvTp").to_json()); }, "Parse rrrrrrrrrrrrrrrrrrrrBZbvji export" : function () { - buster.assert.equals(UInt160.ADDRESS_ONE, UInt160.from_json("rrrrrrrrrrrrrrrrrrrrBZbvji").to_json()); + buster.assert.equals(UInt160.ACCOUNT_ONE, UInt160.from_json("rrrrrrrrrrrrrrrrrrrrBZbvji").to_json()); }, "Parse mtgox export" : function () { buster.assert.equals(config.accounts["mtgox"].account, UInt160.from_json("mtgox").to_json());