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

Commit

Permalink
Add additional signing + hashing api tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
danjm committed Apr 23, 2019
1 parent 1583bea commit eb7ae3c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,21 @@ tape('[Transaction]: Basic functions', function (t) {
st.equal(tx.getChainId(), 0x16b2)
st.end()
})

t.test('EIP155 hashing when singing', function (st) {
txFixtures.slice(0, 3).forEach(function (txData) {
const tx = new Transaction(txData.raw.slice(0, 6), {chain: 1})

var privKey = new Buffer(txData.privateKey, 'hex')
tx.sign(privKey)

st.equal(
tx.getSenderAddress().toString('hex'),
txData.sendersAddress,
'computed sender address should equal the fixture\'s one'
)
})

st.end()
})
})

0 comments on commit eb7ae3c

Please sign in to comment.