diff --git a/lib/bcoin/protocol/constants.js b/lib/bcoin/protocol/constants.js index 185a8e9a..8b1e2320 100644 --- a/lib/bcoin/protocol/constants.js +++ b/lib/bcoin/protocol/constants.js @@ -181,6 +181,15 @@ exports.rejectByVal = Object.keys(exports.reject).reduce(function(out, name) { return out; }, {}); +exports.hd = { + hardened: 0x80000000, + maxIndex: 2 * 0x80000000, + minEntropy: 128 / 8, + maxEntropy: 512 / 8, + parentFingerPrintSize: 4, + pathRoots: ['m', 'M', 'm\'', 'M\''] +}; + exports.locktimeThreshold = 500000000; // Tue Nov 5 00:53:20 1985 UTC exports.oneHash = utils.toArray( @@ -193,11 +202,5 @@ exports.zeroHash = utils.toArray( 'hex' ); -exports.hd = { - hardened: 0x80000000, - maxIndex: 2 * 0x80000000, - minEntropy: 128 / 8, - maxEntropy: 512 / 8, - parentFingerPrintSize: 4, - pathRoots: ['m', 'M', 'm\'', 'M\''] -}; +exports.userVersion = require('../../../package.json').version; +exports.userAgent = '/bcoin:' + exports.userVersion + '/'; diff --git a/lib/bcoin/protocol/framer.js b/lib/bcoin/protocol/framer.js index c86c4e72..953d001b 100644 --- a/lib/bcoin/protocol/framer.js +++ b/lib/bcoin/protocol/framer.js @@ -9,7 +9,6 @@ var network = require('./network'); var constants = require('./constants'); var utils = bcoin.utils; var assert = utils.assert; -var version = require('../../../package.json').version; var writeU32 = utils.writeU32; var writeAscii = utils.writeAscii; @@ -26,7 +25,7 @@ function Framer(options) { this.options = options; - this.agent = utils.toArray(options.agent || '/bcoin:' + version + '/'); + this.agent = utils.toArray(options.userAgent || constants.userAgent); this.agent = this.agent.slice(0, 0xfc); }