clef: rename networkid switch to chainid

This commit is contained in:
Martin Holst Swende 2019-02-06 15:41:42 +01:00
parent 65ab280e57
commit b248bc985f
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0
2 changed files with 13 additions and 5 deletions

View file

@ -44,6 +44,7 @@ import (
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/signer/core" "github.com/ethereum/go-ethereum/signer/core"
@ -83,6 +84,11 @@ var (
Value: DefaultConfigDir(), Value: DefaultConfigDir(),
Usage: "Directory for Clef configuration", Usage: "Directory for Clef configuration",
} }
chainIdFlag = cli.Int64Flag{
Name: "chainid",
Value: params.MainnetChainConfig.ChainID.Int64(),
Usage: "Chain id to use for signing (1=mainnet, 3=ropsten, 4=rinkeby, 5=Goerli)",
}
rpcPortFlag = cli.IntFlag{ rpcPortFlag = cli.IntFlag{
Name: "rpcport", Name: "rpcport",
Usage: "HTTP-RPC server listening port", Usage: "HTTP-RPC server listening port",
@ -178,7 +184,6 @@ func init() {
logLevelFlag, logLevelFlag,
keystoreFlag, keystoreFlag,
configdirFlag, configdirFlag,
utils.NetworkIdFlag,
utils.LightKDFFlag, utils.LightKDFFlag,
utils.NoUSBFlag, utils.NoUSBFlag,
utils.RPCListenAddrFlag, utils.RPCListenAddrFlag,
@ -402,9 +407,13 @@ func signer(c *cli.Context) error {
} }
} }
} }
log.Info("Starting signer", "chainid", c.GlobalInt64(chainIdFlag.Name),
"keystore", c.GlobalString(keystoreFlag.Name),
"light-kdf", c.GlobalBool(utils.LightKDFFlag.Name),
"advanced", c.GlobalBool(advancedMode.Name))
apiImpl := core.NewSignerAPI( apiImpl := core.NewSignerAPI(
c.GlobalInt64(utils.NetworkIdFlag.Name), c.GlobalInt64(chainIdFlag.Name),
c.GlobalString(keystoreFlag.Name), c.GlobalString(keystoreFlag.Name),
c.GlobalBool(utils.NoUSBFlag.Name), c.GlobalBool(utils.NoUSBFlag.Name),
ui, db, ui, db,

View file

@ -28,8 +28,7 @@ init()
function testTx(){ function testTx(){
if( accts && accts.length > 0) { if( accts && accts.length > 0) {
var a = accts[0] var a = accts[0]
var r = eth.signTransaction({from: a, to: a, value: 1, nonce: 1, gas: 1, gasPrice: 1}) eth.signTransaction({from: a, to: a, value: 1, nonce: 1, gas: 1, gasPrice: 1})
console.log("signing response", r)
} }
} }
function testSignText(){ function testSignText(){
@ -54,7 +53,7 @@ function test(){
var tests = [ var tests = [
testTx, testTx,
testSignText, testSignText,
testSignClique, testClique,
] ]
for( i in tests){ for( i in tests){
try{ try{