mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 21:38:05 -05:00
fix panic when the rpc client is not initialized (#11528)
Co-authored-by: Nishant Das <nishdas93@gmail.com> Co-authored-by: Your Name <you@example.com>
This commit is contained in:
committed by
GitHub
parent
f5efde5ccc
commit
c1446a35c5
@@ -112,6 +112,18 @@ type RPCClient interface {
|
||||
CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
|
||||
}
|
||||
|
||||
type RPCClientEmpty struct {
|
||||
}
|
||||
|
||||
func (RPCClientEmpty) Close() {}
|
||||
func (RPCClientEmpty) BatchCall([]gethRPC.BatchElem) error {
|
||||
return errors.New("rpc client is not initialized")
|
||||
}
|
||||
|
||||
func (RPCClientEmpty) CallContext(context.Context, interface{}, string, ...interface{}) error {
|
||||
return errors.New("rpc client is not initialized")
|
||||
}
|
||||
|
||||
// config defines a config struct for dependencies into the service.
|
||||
type config struct {
|
||||
depositContractAddr common.Address
|
||||
@@ -169,8 +181,9 @@ func NewService(ctx context.Context, opts ...Option) (*Service, error) {
|
||||
}
|
||||
|
||||
s := &Service{
|
||||
ctx: ctx,
|
||||
cancel: cancel,
|
||||
ctx: ctx,
|
||||
cancel: cancel,
|
||||
rpcClient: RPCClientEmpty{},
|
||||
cfg: &config{
|
||||
beaconNodeStatsUpdater: &NopBeaconNodeStatsUpdater{},
|
||||
eth1HeaderReqLimit: defaultEth1HeaderReqLimit,
|
||||
|
||||
Reference in New Issue
Block a user