btc: refactor verify error.

This commit is contained in:
Christopher Jeffrey 2016-12-13 17:53:29 -08:00
parent ef1eb23ea3
commit 2f543ea465
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -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);