txdb: lint.

This commit is contained in:
Christopher Jeffrey 2016-08-12 02:25:06 -07:00
parent e50cbc911c
commit edb8a50c63
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -288,16 +288,13 @@ TXDB.prototype.getTable = function getTable(address, callback) {
*/ */
TXDB.prototype._addOrphan = function _addOrphan(key, outpoint, callback) { TXDB.prototype._addOrphan = function _addOrphan(key, outpoint, callback) {
var self = this;
var batch = this.batch(); var batch = this.batch();
var p; var p = new BufferWriter();
this.db.get('o/' + key, function(err, data) { this.db.get('o/' + key, function(err, data) {
if (err) if (err)
return callback(err); return callback(err);
p = new BufferWriter();
if (data) if (data)
p.writeBytes(data); p.writeBytes(data);
@ -611,7 +608,6 @@ TXDB.prototype._resolveOrphans = function _resolveOrphans(tx, index, callback) {
var self = this; var self = this;
var batch = this.batch(); var batch = this.batch();
var hash = tx.hash('hex'); var hash = tx.hash('hex');
var output = tx.outputs[index];
var key = hash + '/' + index; var key = hash + '/' + index;
var coin; var coin;
@ -650,7 +646,7 @@ TXDB.prototype._resolveOrphans = function _resolveOrphans(tx, index, callback) {
self._lazyRemove(orphan, next); self._lazyRemove(orphan, next);
}, function(err) { }, function(err) {
if (err) if (err)
return next(err); return callback(err);
return callback(null, false); return callback(null, false);
}); });
@ -1067,7 +1063,6 @@ TXDB.prototype._confirm = function _confirm(tx, info, callback) {
*/ */
TXDB.prototype.remove = function remove(hash, callback, force) { TXDB.prototype.remove = function remove(hash, callback, force) {
var self = this;
var unlock = this._lock(remove, [hash, callback], force); var unlock = this._lock(remove, [hash, callback], force);
if (!unlock) if (!unlock)
@ -1211,16 +1206,13 @@ TXDB.prototype._remove = function remove(tx, info, callback) {
TXDB.prototype.unconfirm = function unconfirm(hash, callback, force) { TXDB.prototype.unconfirm = function unconfirm(hash, callback, force) {
var self = this; var self = this;
var unlock = this._lock(unconfirm, [tx, callback], force); var unlock = this._lock(unconfirm, [hash, callback], force);
if (!unlock) if (!unlock)
return; return;
callback = utils.wrap(callback, unlock); callback = utils.wrap(callback, unlock);
if (hash.hash)
hash = hash.hash('hex');
this.getTX(hash, function(err, tx) { this.getTX(hash, function(err, tx) {
if (err) if (err)
return callback(err); return callback(err);
@ -1237,15 +1229,16 @@ TXDB.prototype.unconfirm = function unconfirm(hash, callback, force) {
self.start(); self.start();
self._unconfirm(tx, info, function(err, res1, res2) { self._unconfirm(tx, info, function(err, result, info) {
if (err) { if (err) {
self.drop(); self.drop();
return callback(err); return callback(err);
} }
self.commit(function(err) { self.commit(function(err) {
if (err) if (err)
return callback(err); return callback(err);
callback(null, res1, res2); return callback(null, result, info);
}); });
}); });
}); });
@ -1697,7 +1690,6 @@ TXDB.prototype.getCoins = function getCoins(id, callback) {
*/ */
TXDB.prototype.fillHistory = function fillHistory(tx, callback) { TXDB.prototype.fillHistory = function fillHistory(tx, callback) {
var self = this;
var hash, index, coin, input; var hash, index, coin, input;
if (tx.isCoinbase()) { if (tx.isCoinbase()) {
@ -1876,7 +1868,7 @@ TXDB.prototype.getCoin = function getCoin(hash, index, callback) {
} }
this.db.fetch('c/' + key, function(data) { this.db.fetch('c/' + key, function(data) {
var coin = bcoin.coin.fromRaw(data); coin = bcoin.coin.fromRaw(data);
coin.hash = hash; coin.hash = hash;
coin.index = index; coin.index = index;
self.coinCache.set(key, data); self.coinCache.set(key, data);