btc: refactor verify error.
This commit is contained in:
parent
ef1eb23ea3
commit
2f543ea465
@ -39,25 +39,21 @@ function VerifyError(msg, code, reason, score) {
|
||||
|
||||
this.type = 'VerifyError';
|
||||
|
||||
assert(typeof code === 'string');
|
||||
asssert(typeof reason === 'string');
|
||||
assert(score >= 0);
|
||||
|
||||
this.hash = msg.hash();
|
||||
this.height = msg.height;
|
||||
|
||||
if (msg.getCoinbaseHeight && this.height === -1)
|
||||
this.height = msg.getCoinbaseHeight();
|
||||
|
||||
if (score == null)
|
||||
score = -1;
|
||||
this.malleated = false;
|
||||
|
||||
this.code = code;
|
||||
this.reason = score === -1 ? null : reason;
|
||||
this.reason = reason;
|
||||
this.score = score;
|
||||
this.malleated = false;
|
||||
this.message = 'Verification failure: '
|
||||
+ reason
|
||||
+ ' (code=' + code
|
||||
+ ', score=' + score
|
||||
+ ', height=' + this.height
|
||||
+ ', hash=' + util.revHex(this.hash.toString('hex')) + ')';
|
||||
|
||||
this.message = 'Verification failure: ' + reason
|
||||
+ ' (code=' + code + ', score=' + score
|
||||
+ ', hash=' + util.revHex(this.hash.toString('hex'))
|
||||
+ ')';
|
||||
}
|
||||
|
||||
util.inherits(VerifyError, Error);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user