refactor: minor.
This commit is contained in:
parent
6357795fd9
commit
1906034106
@ -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 {
|
||||
|
||||
@ -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;
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user