diff --git a/lib/btc/errors.js b/lib/btc/errors.js index 7ef0ec6e..7426180e 100644 --- a/lib/btc/errors.js +++ b/lib/btc/errors.js @@ -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);