Typo fixes
This commit is contained in:
parent
b90435308c
commit
9757fd20f6
|
@ -223,7 +223,7 @@ Address.fromRandom = function(opts) {
|
|||
|
||||
// FIXME(Kagami): This function is rather slow in browsers so
|
||||
// generation of ripelen=18 currently is disabled (see `test.js`). It
|
||||
// should be heavilty profiled to determine the bottleneck.
|
||||
// should be heavily profiled to determine the bottleneck.
|
||||
// TODO(Kagami): We may want to run this in the web worker to speedup
|
||||
// the search. Currently WebCryptoAPI is not available in Firefox in
|
||||
// web workers (see
|
||||
|
@ -239,8 +239,8 @@ Address.fromRandom = function(opts) {
|
|||
(strictripelen && len === ripelen) ||
|
||||
(!strictripelen && len <= ripelen && checkripelen(ripelen, version))
|
||||
) {
|
||||
// XXX(Kagami): Do we need to put all these properties or
|
||||
// compute them manually via ECMA5 getters/setters instead?
|
||||
// TODO(Kagami): Do we need to put all these properties or compute
|
||||
// them manually via ECMA5 getters/setters instead?
|
||||
resolve(new Address(Object.assign({
|
||||
signPrivateKey: signPrivateKey,
|
||||
signPublicKey: signPublicKey,
|
||||
|
|
|
@ -20,8 +20,8 @@ var var_int = exports.var_int = {
|
|||
* Decoded var_int structure.
|
||||
*/
|
||||
decode: function(buf) {
|
||||
assert(buf.length > 0, "Empty buffer");
|
||||
var value, length;
|
||||
assert(buf.length > 0, "Empty buffer");
|
||||
switch (buf[0]) {
|
||||
case 253:
|
||||
value = buf.readUInt16BE(1);
|
||||
|
@ -38,14 +38,14 @@ var var_int = exports.var_int = {
|
|||
assert(hi !== 0, "Impractical var_int");
|
||||
// Max safe number = 2^53 - 1 =
|
||||
// 0b0000000000011111111111111111111111111111111111111111111111111111
|
||||
// = 2097151*(2^32) + (2^32 - 1)
|
||||
// = 2097151*(2^32) + (2^32 - 1).
|
||||
// So it's safe until hi <= 2097151. See
|
||||
// <http://mdn.io/issafeinteger>,
|
||||
// <https://stackoverflow.com/q/307179> for details.
|
||||
// TODO(Kagami): We may want to return raw Buffer for
|
||||
// 2^53 <= value <= 2^64 - 1 range. Possible using the optional
|
||||
// argument because most of the code expect to get number from
|
||||
// `var_int.decode`.
|
||||
// 2^53 <= value <= 2^64 - 1 range. Possibly using the optional
|
||||
// argument because most of the code expect to get a number when
|
||||
// calling `var_int.decode`.
|
||||
assert(hi <= 2097151, "Unsafe integer");
|
||||
var lo = buf.readUInt32BE(5);
|
||||
value = hi * 4294967296 + lo;
|
||||
|
@ -86,7 +86,7 @@ var var_int = exports.var_int = {
|
|||
buf.writeUInt32BE(value % 4294967296, 5); // low32
|
||||
}
|
||||
} else if (Buffer.isBuffer(value)) {
|
||||
assert(value.length <= 8, "Buffer too big");
|
||||
assert(value.length <= 8, "Buffer is too big");
|
||||
buf = new Buffer(9);
|
||||
buf.fill(0);
|
||||
buf[0] = 255;
|
||||
|
|
Loading…
Reference in New Issue
Block a user