mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-13 13:43:30 +00:00
Fix RPC error and change log statement
Former-commit-id: 54da8e259e6abae30c61dc6301cbfeeb0ede8570 [formerly 31f207fb38d4a1699dc60c294cf99a1673b54ab7] Former-commit-id: c70fc84a836a6b03bcaf07b5fe7a9eb5c116e0da
This commit is contained in:
parent
394adb4750
commit
9614c81228
@ -79,30 +79,28 @@ func MakeClient(ctx *cli.Context) *ShardingClient {
|
||||
// Start the sharding client.
|
||||
// * Connects to Geth node.
|
||||
// * Verifies or deploys the sharding manager contract.
|
||||
func (c *ShardingClient) Start() error {
|
||||
log.Info("Starting collator client")
|
||||
func (c *ShardingClient) Start() (*rpc.Client, error) {
|
||||
rpcClient, err := dialRPC(c.endpoint)
|
||||
if err != nil {
|
||||
return err
|
||||
return nil, fmt.Errorf("cannot start rpc client. %v", err)
|
||||
}
|
||||
c.client = ethclient.NewClient(rpcClient)
|
||||
defer rpcClient.Close()
|
||||
|
||||
// Check account existence and unlock account before starting collator client
|
||||
accounts := c.keystore.Accounts()
|
||||
if len(accounts) == 0 {
|
||||
return fmt.Errorf("no accounts found")
|
||||
return nil, fmt.Errorf("no accounts found")
|
||||
}
|
||||
|
||||
if err := c.unlockAccount(accounts[0]); err != nil {
|
||||
return fmt.Errorf("cannot unlock account. %v", err)
|
||||
return nil, fmt.Errorf("cannot unlock account. %v", err)
|
||||
}
|
||||
|
||||
if err := initSMC(c); err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nil
|
||||
return rpcClient, nil
|
||||
}
|
||||
|
||||
// Wait until collator client is shutdown.
|
||||
|
@ -2,6 +2,7 @@ package collator
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/sharding/client"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
cli "gopkg.in/urfave/cli.v1"
|
||||
)
|
||||
|
||||
@ -12,7 +13,12 @@ func NewCollatorClient(ctx *cli.Context) *client.ShardingClient {
|
||||
}
|
||||
|
||||
func CollatorStart(sclient *client.ShardingClient) error {
|
||||
sclient.Start()
|
||||
log.Info("Starting collator client")
|
||||
rpcClient, err := sclient.Start()
|
||||
defer rpcClient.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := joinCollatorPool(sclient); err != nil {
|
||||
return err
|
||||
|
@ -2,6 +2,7 @@ package proposer
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/sharding/client"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
cli "gopkg.in/urfave/cli.v1"
|
||||
)
|
||||
|
||||
@ -12,6 +13,7 @@ func NewProposerClient(ctx *cli.Context) *client.ShardingClient {
|
||||
}
|
||||
|
||||
func ProposerStart(sclient *client.ShardingClient) error {
|
||||
log.Info("Starting proposer client")
|
||||
sclient.Start()
|
||||
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user