misc: fixes.

This commit is contained in:
Christopher Jeffrey 2016-08-07 16:32:14 -07:00
parent 4a398517d9
commit b6417cf337
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
5 changed files with 9 additions and 15 deletions

View File

@ -17,7 +17,7 @@ var client = new Client(
);
client.on('error', function(err) {
bcoin.error(err);
;
});
function getID() {

View File

@ -122,7 +122,7 @@ ecdsa.verify = function verify(curve, msg, hashAlg, key, sig) {
ecdsa.sign = function sign(curve, msg, hashAlg, key) {
var hash = utils.hash(hashAlg, msg);
var ec = elliptic.ec(curve);
return ec.sign(hash, key);
return new Buffer(ec.sign(hash, key));
};
native.verify = function verify(alg, hash, msg, sig, key) {

View File

@ -99,11 +99,10 @@ utils.inherits(Chain, AsyncObject);
Chain.prototype._init = function _init() {
var self = this;
var i, keys, id;
var keys = Object.keys(this.network.deployments);
var i, id;
// Setup state caches.
keys = Object.keys(this.network.deployments);
for (i = 0; i < keys.length; i++) {
id = keys[i];
this.stateCache[id] = {};
@ -219,12 +218,6 @@ Chain.prototype._open = function open(callback) {
self.state = state;
if (state.hasCSV())
self.logger.info('CSV is active.');
if (state.hasWitness())
self.logger.info('Segwit is active.');
self.logger.memory();
self.emit('tip', tip);
@ -2140,9 +2133,10 @@ Chain.prototype.getState = function getState(prev, id, callback) {
Chain.prototype.computeBlockVersion = function computeBlockVersion(prev, callback) {
var self = this;
var keys = Object.keys(this.network.deployments);
var version = 0;
utils.forEachSerial(Object.keys(this.network.deployments), function(id, next) {
utils.forEachSerial(keys, function(id, next) {
var deployment = self.network.deployments[id];
self.getState(prev, id, function(err, state) {
if (err)

View File

@ -6,7 +6,7 @@
'use strict';
var bcoin = require('./env');
var Network = require('./network');
var utils = require('./utils');
var assert = utils.assert;
var fs;
@ -91,7 +91,7 @@ config.getPrefix = function getPrefix(data) {
if (!prefix)
prefix = utils.HOME + '/.bcoin';
network = bcoin.network.get(data.network).type;
network = Network.get(data.network).type;
prefix = utils.normalize(prefix);

View File

@ -453,7 +453,7 @@ crypto.buildMerkleTree = function buildMerkleTree(leaves) {
j += size;
}
if (!tree.length)
if (tree.length === 0)
return;
return tree;