From 8bcfeca44e9a23852fc6eba7ef8bce374b5c5565 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 21 Jul 2016 08:10:44 -0700 Subject: [PATCH] constants: zero key. --- lib/bcoin/hd.js | 10 +++------- lib/bcoin/protocol/constants.js | 11 +++++++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/bcoin/hd.js b/lib/bcoin/hd.js index 38b45923..6c902ecf 100644 --- a/lib/bcoin/hd.js +++ b/lib/bcoin/hd.js @@ -94,11 +94,7 @@ var unorm; * Constants */ -var PUBLIC_KEY = new Buffer(33); -PUBLIC_KEY.fill(0); - -var FINGER_PRINT = new Buffer(4); -FINGER_PRINT.fill(0); +var FINGER_PRINT = new Buffer('00000000', 'hex'); /** * HD Mnemonic @@ -845,7 +841,7 @@ function HDPrivateKey(options) { this.chainCode = constants.ZERO_HASH; this.privateKey = constants.ZERO_HASH; - this.publicKey = PUBLIC_KEY; + this.publicKey = constants.ZERO_KEY; this.fingerPrint = null; this.mnemonic = null; @@ -1521,7 +1517,7 @@ function HDPublicKey(options) { this.parentFingerPrint = FINGER_PRINT; this.childIndex = 0; this.chainCode = constants.ZERO_HASH; - this.publicKey = PUBLIC_KEY; + this.publicKey = constants.ZERO_KEY; this.fingerPrint = null; diff --git a/lib/bcoin/protocol/constants.js b/lib/bcoin/protocol/constants.js index d21aee04..48f339a5 100644 --- a/lib/bcoin/protocol/constants.js +++ b/lib/bcoin/protocol/constants.js @@ -630,6 +630,17 @@ exports.ZERO_HASH160 = new Buffer( exports.NULL_HASH160 = '0000000000000000000000000000000000000000'; +/** + * A compressed pubkey of all zeroes. + * @const {Buffer} + * @default + */ + +exports.ZERO_KEY = new Buffer( + '000000000000000000000000000000000000000000000000000000000000000000', + 'hex' +); + /** * BCoin version. * @const {String}