diff --git a/lib/transaction/transaction.js b/lib/transaction/transaction.js index 9766024..612d481 100644 --- a/lib/transaction/transaction.js +++ b/lib/transaction/transaction.js @@ -393,13 +393,13 @@ Transaction.prototype.fromObject = function fromObject(arg) { Transaction.prototype._checkConsistency = function(arg) { if (!_.isUndefined(this._changeIndex)) { - $.checkState(this._changeScript); - $.checkState(this.outputs[this._changeIndex]); + $.checkState(this._changeScript, 'Change script is expected.'); + $.checkState(this.outputs[this._changeIndex], 'Change index points to undefined output.'); $.checkState(this.outputs[this._changeIndex].script.toString() === - this._changeScript.toString()); + this._changeScript.toString(), 'Change output has an unexpected script.'); } if (arg && arg.hash) { - $.checkState(arg.hash === this.hash, 'Hash in object does not match transaction hash'); + $.checkState(arg.hash === this.hash, 'Hash in object does not match transaction hash.'); } }; @@ -1050,7 +1050,7 @@ Transaction.prototype.removeInput = function(txId, outputIndex) { * @return {Transaction} this, for chaining */ Transaction.prototype.sign = function(privateKey, sigtype) { - $.checkState(this.hasAllUtxoInfo()); + $.checkState(this.hasAllUtxoInfo(), 'Not all utxo information is available to sign the transaction.'); var self = this; if (_.isArray(privateKey)) { _.each(privateKey, function(privateKey) {