From a9e2b0f77e79c083f55f2d0a1bb448a546a9753d Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Tue, 12 Feb 2019 12:17:49 +0100 Subject: [PATCH] clef: more tests for signer --- cmd/clef/tests/testsigner.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/clef/tests/testsigner.js b/cmd/clef/tests/testsigner.js index d2f25da31c..86b2c45395 100644 --- a/cmd/clef/tests/testsigner.js +++ b/cmd/clef/tests/testsigner.js @@ -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(){