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) {
|
Chain.prototype.add = co(function* add(block) {
|
||||||
var unlock = yield this.locker.lock(block);
|
var unlock = yield this.locker.lock(block);
|
||||||
|
|
||||||
|
assert(!this.currentBlock);
|
||||||
|
|
||||||
this.currentBlock = block.hash('hex');
|
this.currentBlock = block.hash('hex');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -547,25 +547,23 @@ Mempool.prototype.hasReject = function hasReject(hash) {
|
|||||||
|
|
||||||
Mempool.prototype.addTX = co(function* addTX(tx) {
|
Mempool.prototype.addTX = co(function* addTX(tx) {
|
||||||
var unlock = yield this.locker.lock(tx);
|
var unlock = yield this.locker.lock(tx);
|
||||||
var missing;
|
|
||||||
|
assert(!this.currentTX);
|
||||||
|
|
||||||
this.currentTX = tx.hash('hex');
|
this.currentTX = tx.hash('hex');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
missing = yield this._addTX(tx);
|
return yield this._addTX(tx);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.type === 'VerifyError') {
|
if (err.type === 'VerifyError') {
|
||||||
if (!tx.hasWitness() && !err.malleated)
|
if (!tx.hasWitness() && !err.malleated)
|
||||||
this.rejects.add(tx.hash());
|
this.rejects.add(tx.hash());
|
||||||
}
|
}
|
||||||
|
throw err;
|
||||||
|
} finally {
|
||||||
this.currentTX = null;
|
this.currentTX = null;
|
||||||
unlock();
|
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.type === 'VerifyError') {
|
||||||
if (err.score !== -1)
|
if (err.score !== -1)
|
||||||
peer.reject(tx, err.code, err.reason, err.score);
|
peer.reject(tx, err.code, err.reason, err.score);
|
||||||
throw err;
|
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user