This commit is contained in:
Christopher Jeffrey 2016-05-31 04:43:44 -07:00
parent 60d33ce9db
commit b16a8ed1c4
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
10 changed files with 6 additions and 29 deletions

View File

@ -8,7 +8,6 @@
var bcoin = require('./env');
var utils = bcoin.utils;
var assert = utils.assert;
var constants = bcoin.protocol.constants;
var BufferReader = require('./reader');
var BufferWriter = require('./writer');
@ -26,8 +25,6 @@ var BufferWriter = require('./writer');
*/
function Coins(options) {
var i, coin;
if (!(this instanceof Coins))
return new Coins(options);
@ -280,7 +277,7 @@ Coins.parseRaw = function parseRaw(data, hash) {
Coins.parseCoin = function parseCoin(data, hash, index) {
var p = new BufferReader(data);
var i = 0;
var mask, prefix, version, height, coinbase, spent, script, value;
var mask, prefix, version, height, coinbase, script, value;
version = p.readVarint();
height = p.readU32();

View File

@ -8,7 +8,6 @@
var bcoin = require('./env');
var utils = bcoin.utils;
var assert = utils.assert;
var constants = bcoin.protocol.constants;
/**
* A collections of {@link Coins} objects.

View File

@ -948,8 +948,6 @@ HDPrivateKey.fromRaw = function fromRaw(raw) {
HDPrivateKey.prototype.toJSON = function toJSON(passphrase) {
var json = {
v: 1,
name: 'hdkey',
network: this.network,
encrypted: false
};
@ -984,9 +982,6 @@ HDPrivateKey.prototype.toJSON = function toJSON(passphrase) {
HDPrivateKey.parseJSON = function parseJSON(json, passphrase) {
var data = {};
// assert.equal(json.v, 1);
// assert.equal(json.name, 'hdkey');
if (json.encrypted && !passphrase)
throw new Error('Cannot decrypt address');

View File

@ -521,8 +521,6 @@ KeyRing.prototype.__defineGetter__('address', function() {
KeyRing.prototype.toJSON = function toJSON() {
return {
v: 1,
name: 'address',
network: this.network.type,
type: this.type,
m: this.m,
@ -546,8 +544,6 @@ KeyRing.prototype.toJSON = function toJSON() {
*/
KeyRing.fromJSON = function fromJSON(json) {
assert.equal(json.v, 1);
assert.equal(json.name, 'address');
return new KeyRing({
nework: json.network,
type: json.type,

View File

@ -273,7 +273,6 @@ Peer.prototype._init = function init() {
*/
Peer.prototype.createSocket = function createSocket(port, host) {
var self = this;
var hostname = IP.hostname(host, port);
var socket, net;

View File

@ -2142,7 +2142,7 @@ Pool.prototype.getIP = function getIP(callback) {
ip = body.trim();
if (IP.version(ip) == -1)
if (IP.version(ip) === -1)
return self.getIP2(callback);
return callback(null, IP.normalize(ip));

View File

@ -128,7 +128,7 @@ TXDB.prototype._testFilter = function _testFilter(addresses) {
*/
TXDB.prototype.getMap = function getMap(tx, callback) {
var i, input, output, address, addresses, table, map;
var i, input, output, address, addresses, map;
input = tx.getInputHashes();
output = tx.getOutputHashes();

View File

@ -16,7 +16,6 @@ var utils = exports;
var assert = require('assert');
var bn = require('bn.js');
var util = require('util');
var IP = require('../../vendor/ip');
var crypto, supersha, hash, aes;
/**

View File

@ -9,7 +9,6 @@ var bcoin = require('./env');
var EventEmitter = require('events').EventEmitter;
var utils = require('./utils');
var assert = utils.assert;
var constants = bcoin.protocol.constants;
var BufferReader = require('./reader');
var BufferWriter = require('./writer');
@ -110,7 +109,7 @@ Wallet.prototype.open = function open(callback) {
this.db.register(this);
} catch (e) {
this.emit('error', e);
return callback(err);
return callback(e);
}
this.init(function(err) {
@ -146,7 +145,7 @@ Wallet.prototype.destroy = function destroy(callback) {
this.db.unregister(this);
} catch (e) {
this.emit('error', e);
return callback(err);
return callback(e);
}
this.loaded = false;
@ -588,7 +587,6 @@ Wallet.prototype.createTX = function createTX(options, outputs, callback) {
Wallet.prototype.deriveInputs = function deriveInputs(tx, callback) {
var self = this;
var addresses = [];
var i;
this.getInputPaths(tx, function(err, paths) {
if (err)
@ -634,7 +632,6 @@ Wallet.prototype.getPath = function getPath(address, callback) {
Wallet.prototype.getInputPaths = function getInputPaths(tx, callback) {
var self = this;
var paths = [];
var i, input, address, path;
if (tx instanceof bcoin.input) {
if (!tx.coin)
@ -682,7 +679,6 @@ Wallet.prototype.getInputPaths = function getInputPaths(tx, callback) {
Wallet.prototype.getOutputPaths = function getOutputPaths(tx, callback) {
var self = this;
var paths = [];
var i, input, address, path;
if (tx instanceof bcoin.output) {
return this.getPath(tx.getHash(), function(err, path) {
@ -708,7 +704,7 @@ Wallet.prototype.getOutputPaths = function getOutputPaths(tx, callback) {
});
}, function(err) {
if (err)
return next(err);
return callback(err);
return callback(null, utils.uniq(paths));
});
};
@ -898,7 +894,6 @@ Wallet.prototype.scan = function scan(getByAddress, callback) {
*/
Wallet.prototype.scriptInputs = function scriptInputs(tx, callback) {
var self = this;
var total = 0;
var i;
@ -1377,7 +1372,6 @@ Wallet.parseJSON = function parseJSON(json) {
Wallet.prototype.toRaw = function toRaw(writer) {
var p = new BufferWriter(writer);
var i;
p.writeU32(this.network.magic);
p.writeVarString(this.id, 'utf8');
@ -1900,7 +1894,6 @@ Account.prototype.deriveChange = function deriveChange(index) {
*/
Account.prototype.deriveAddress = function deriveAddress(change, index) {
var self = this;
var i, key, options;
assert(this.initialized);

View File

@ -252,7 +252,6 @@ WalletDB.prototype.register = function register(wallet) {
WalletDB.prototype.unregister = function unregister(wallet) {
var id = wallet.id;
var watcher = this.watchers[id];
var i;
if (!watcher)
return;