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

Commit

Permalink
Merge pull request #97 from 0xProject/fake-tx-include-signature-by-de…
Browse files Browse the repository at this point in the history
…fault

Include signature by default in FakeTransaction.hash
  • Loading branch information
holgerd77 authored Jun 22, 2018
2 parents a73cc66 + 29d1153 commit 9d2302d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fake.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)])
Expand Down
4 changes: 2 additions & 2 deletions test/fake.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
})

0 comments on commit 9d2302d

Please sign in to comment.