workers: refactor jobs.
This commit is contained in:
parent
18cc0a013c
commit
4eb3c2172d
@ -70,21 +70,18 @@ jobs.handle = function handle(p) {
|
|||||||
* @param {TX} tx
|
* @param {TX} tx
|
||||||
* @param {CoinView} view
|
* @param {CoinView} view
|
||||||
* @param {VerifyFlags} flags
|
* @param {VerifyFlags} flags
|
||||||
* @returns {Boolean}
|
* @returns {CheckResultPacket}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
jobs.check = function check(tx, view, flags) {
|
jobs.check = function check(tx, view, flags) {
|
||||||
let err = null;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
tx.check(view, flags);
|
tx.check(view, flags);
|
||||||
} catch (e) {
|
} catch (err) {
|
||||||
if (e.type !== 'ScriptError')
|
if (err.type === 'ScriptError')
|
||||||
throw e;
|
return new packets.CheckResultPacket(err);
|
||||||
err = e;
|
throw err;
|
||||||
}
|
}
|
||||||
|
return new packets.CheckResultPacket();
|
||||||
return new packets.CheckResultPacket(err);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,21 +91,18 @@ jobs.check = function check(tx, view, flags) {
|
|||||||
* @param {Number} index
|
* @param {Number} index
|
||||||
* @param {Output} coin
|
* @param {Output} coin
|
||||||
* @param {VerifyFlags} flags
|
* @param {VerifyFlags} flags
|
||||||
* @returns {Boolean}
|
* @returns {CheckInputResultPacket}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
jobs.checkInput = function checkInput(tx, index, coin, flags) {
|
jobs.checkInput = function checkInput(tx, index, coin, flags) {
|
||||||
let err = null;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
tx.checkInput(index, coin, flags);
|
tx.checkInput(index, coin, flags);
|
||||||
} catch (e) {
|
} catch (err) {
|
||||||
if (e.type !== 'ScriptError')
|
if (err.type === 'ScriptError')
|
||||||
throw e;
|
return new packets.CheckInputResultPacket(err);
|
||||||
err = e;
|
throw err;
|
||||||
}
|
}
|
||||||
|
return new packets.CheckInputResultPacket();
|
||||||
return new packets.CheckInputResultPacket(err);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user