refactor: minor.

This commit is contained in:
Christopher Jeffrey 2016-09-23 21:36:05 -07:00
parent 6357795fd9
commit 1906034106
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
3 changed files with 7 additions and 8 deletions

View File

@ -1009,6 +1009,8 @@ Chain.prototype.isBusy = function isBusy() {
Chain.prototype.add = co(function* add(block) {
var unlock = yield this.locker.lock(block);
assert(!this.currentBlock);
this.currentBlock = block.hash('hex');
try {

View File

@ -547,25 +547,23 @@ Mempool.prototype.hasReject = function hasReject(hash) {
Mempool.prototype.addTX = co(function* addTX(tx) {
var unlock = yield this.locker.lock(tx);
var missing;
assert(!this.currentTX);
this.currentTX = tx.hash('hex');
try {
missing = yield this._addTX(tx);
return yield this._addTX(tx);
} catch (err) {
if (err.type === 'VerifyError') {
if (!tx.hasWitness() && !err.malleated)
this.rejects.add(tx.hash());
}
throw err;
} finally {
this.currentTX = null;
unlock();
throw err;
}
this.currentTX = null;
unlock();
return missing;
});
/**

View File

@ -1360,7 +1360,6 @@ Pool.prototype._handleTX = co(function* _handleTX(tx, peer) {
if (err.type === 'VerifyError') {
if (err.score !== -1)
peer.reject(tx, err.code, err.reason, err.score);
throw err;
}
throw err;
}