mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
Use network id from command line
Former-commit-id: 78c94954b281ba8b12802e7b54c0d1ceeda36a30 [formerly 907fdb09efcd3b4cc31aee5d9a2e354dfb84e093] Former-commit-id: a9e66d5a14df26edbb4e2eedc1416e29284677cc
This commit is contained in:
parent
1061ade1f8
commit
9ba9274ea5
@ -13,7 +13,7 @@ var (
|
||||
Name: "shard",
|
||||
Usage: "Start a sharding client",
|
||||
ArgsUsage: "[endpoint]",
|
||||
Flags: append(append(consoleFlags, utils.DataDirFlag), utils.PasswordFileFlag),
|
||||
Flags: []cli.Flag{utils.DataDirFlag, utils.PasswordFileFlag, utils.NetworkIdFlag},
|
||||
Category: "SHARDING COMMANDS",
|
||||
Description: "TODO(prestonvanloon)- Add sharding client description",
|
||||
}
|
||||
|
@ -19,10 +19,11 @@ const (
|
||||
|
||||
// Client for sharding. Communicates to geth node via JSON RPC.
|
||||
type Client struct {
|
||||
endpoint string // Endpoint to JSON RPC
|
||||
client *ethclient.Client // Ethereum RPC client.
|
||||
keystore *keystore.KeyStore // Keystore containing the single signer
|
||||
ctx *cli.Context // Command line context
|
||||
endpoint string // Endpoint to JSON RPC
|
||||
client *ethclient.Client // Ethereum RPC client.
|
||||
keystore *keystore.KeyStore // Keystore containing the single signer
|
||||
ctx *cli.Context // Command line context
|
||||
networkID uint64 // Ethereum network ID
|
||||
}
|
||||
|
||||
// MakeShardingClient for interfacing with geth full node.
|
||||
@ -40,13 +41,18 @@ func MakeShardingClient(ctx *cli.Context) *Client {
|
||||
if err != nil {
|
||||
panic(err) // TODO(prestonvanloon): handle this
|
||||
}
|
||||
|
||||
ks := keystore.NewKeyStore(keydir, scryptN, scryptP)
|
||||
|
||||
networkID := uint64(1)
|
||||
if ctx.GlobalIsSet(utils.NetworkIdFlag.Name) {
|
||||
networkID = ctx.GlobalUint64(utils.NetworkIdFlag.Name)
|
||||
}
|
||||
|
||||
return &Client{
|
||||
endpoint: endpoint,
|
||||
keystore: ks,
|
||||
ctx: ctx,
|
||||
endpoint: endpoint,
|
||||
keystore: ks,
|
||||
ctx: ctx,
|
||||
networkID: networkID,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
cli "gopkg.in/urfave/cli.v1"
|
||||
)
|
||||
|
||||
// FakeEthService based on implementation of internal/ethapi
|
||||
// FakeEthService based on implementation of internal/ethapi.Client
|
||||
type FakeEthService struct {
|
||||
mu sync.Mutex
|
||||
|
||||
|
@ -81,7 +81,7 @@ func (c *Client) deployVMC() (*common.Address, error) {
|
||||
}
|
||||
|
||||
tx := types.NewContractCreation(nonce, new(big.Int).SetInt64(0) /*amount*/, contractGasLimit, suggestedGasPrice, abiBytecode)
|
||||
signed, err := c.keystore.SignTx(accounts[0], tx, new(big.Int).SetInt64(1000) /*chainId*/) // TODO(prestonvanloon): reference chain ID from flag
|
||||
signed, err := c.keystore.SignTx(accounts[0], tx, new(big.Int).SetUint64(c.networkID))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to sign transaction: %v", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user