Skip to content
This repository was archived by the owner on Apr 6, 2020. It is now read-only.

Commit 9d2302d

Browse files
authored
Merge pull request #97 from 0xProject/fake-tx-include-signature-by-default
Include signature by default in FakeTransaction.hash
2 parents a73cc66 + 29d1153 commit 9d2302d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

fake.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ module.exports = class FakeTransaction extends Transaction {
5858
* @param {Boolean} [includeSignature=true] whether or not to inculde the signature
5959
* @return {Buffer}
6060
*/
61-
hash (includeSignature) {
61+
hash (includeSignature = true) {
6262
if (includeSignature) {
6363
// include a fake signature using the from address as a private key
6464
let fakeKey = Buffer.concat([this._from, this._from.slice(0, 12)])

test/fake.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ tape('[FakeTransaction]: Basic functions', function (t) {
1616
var modifiedFromFieldTxData = Object.assign({}, baseTxData, { from: '0x2222222222222222222222222222222222222222' })
1717
var baseTx = new FakeTransaction(baseTxData)
1818
var modifiedFromFieldTx = new FakeTransaction(modifiedFromFieldTxData)
19-
var baseTxHash = utils.bufferToHex(baseTx.hash(true))
20-
var modifiedFromFieldTxHash = utils.bufferToHex(modifiedFromFieldTx.hash(true))
19+
var baseTxHash = utils.bufferToHex(baseTx.hash())
20+
var modifiedFromFieldTxHash = utils.bufferToHex(modifiedFromFieldTx.hash())
2121
st.notEqual(baseTxHash, modifiedFromFieldTxHash, 'FakeTransactions with different `from` addresses but otherwise identical data should have different hashes')
2222
})
2323
})

0 commit comments

Comments
 (0)