clef: more tests for signer

This commit is contained in:
Martin Holst Swende 2019-02-12 12:17:49 +01:00
parent 1b84db0169
commit a9e2b0f77e
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0

View file

@ -28,7 +28,15 @@ init()
function testTx(){
if( accts && accts.length > 0) {
var a = accts[0]
eth.signTransaction({from: a, to: a, value: 1, nonce: 1, gas: 1, gasPrice: 1})
var txdata = eth.signTransaction({from: a, to: a, value: 1, nonce: 1, gas: 1, gasPrice: 1})
var v = parseInt(txdata.tx.v)
console.log("V value: ", v)
if (v == 37 || v == 38){
console.log("Mainnet 155-protected chainid was used")
}
if (v == 27 || v == 28){
throw new Error("Mainnet chainid was used, but without replay protection!")
}
}
}
function testSignText(){