diff --git a/fake.js b/fake.js index 36be1f8..b3fca2b 100644 --- a/fake.js +++ b/fake.js @@ -58,7 +58,7 @@ module.exports = class FakeTransaction extends Transaction { * @param {Boolean} [includeSignature=true] whether or not to inculde the signature * @return {Buffer} */ - hash (includeSignature) { + hash (includeSignature = true) { if (includeSignature) { // include a fake signature using the from address as a private key let fakeKey = Buffer.concat([this._from, this._from.slice(0, 12)]) diff --git a/test/fake.js b/test/fake.js index 196a6d2..b41cd7a 100644 --- a/test/fake.js +++ b/test/fake.js @@ -16,8 +16,8 @@ tape('[FakeTransaction]: Basic functions', function (t) { var modifiedFromFieldTxData = Object.assign({}, baseTxData, { from: '0x2222222222222222222222222222222222222222' }) var baseTx = new FakeTransaction(baseTxData) var modifiedFromFieldTx = new FakeTransaction(modifiedFromFieldTxData) - var baseTxHash = utils.bufferToHex(baseTx.hash(true)) - var modifiedFromFieldTxHash = utils.bufferToHex(modifiedFromFieldTx.hash(true)) + var baseTxHash = utils.bufferToHex(baseTx.hash()) + var modifiedFromFieldTxHash = utils.bufferToHex(modifiedFromFieldTx.hash()) st.notEqual(baseTxHash, modifiedFromFieldTxHash, 'FakeTransactions with different `from` addresses but otherwise identical data should have different hashes') }) })