Fix hash & start moving to lifecycle
Fix typeddata has and start moving from the legacy geth services interfaces to the new Lifecycle interface
This commit is contained in:
parent
799bd93451
commit
d30df5a6fd
|
@ -8,8 +8,8 @@ import (
|
||||||
"github.com/status-im/status-go/eth-node/types"
|
"github.com/status-im/status-go/eth-node/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Make sure that NodeService implements node.Service interface.
|
// Make sure that NodeService implements node.Lifecycle interface.
|
||||||
var _ node.Service = (*NodeService)(nil)
|
var _ node.Lifecycle = (*NodeService)(nil)
|
||||||
|
|
||||||
type NodeService struct {
|
type NodeService struct {
|
||||||
Node types.Node
|
Node types.Node
|
||||||
|
@ -33,13 +33,13 @@ func (w *NodeService) APIs() []rpc.API {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start is run when a service is started.
|
// Start is run when a service is started.
|
||||||
// It does nothing in this case but is required by `node.Service` interface.
|
// It does nothing in this case but is required by `node.Lifecycle` interface.
|
||||||
func (w *NodeService) Start(server *p2p.Server) error {
|
func (w *NodeService) Start() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop is run when a service is stopped.
|
// Stop is run when a service is stopped.
|
||||||
// It does nothing in this case but is required by `node.Service` interface.
|
// It does nothing in this case but is required by `node.Lifecycle` interface.
|
||||||
func (w *NodeService) Stop() error {
|
func (w *NodeService) Stop() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"github.com/status-im/status-go/eth-node/types"
|
"github.com/status-im/status-go/eth-node/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Make sure that WakuService implements node.Service interface.
|
// Make sure that WakuService implements node.Lifecycle interface.
|
||||||
var _ node.Service = (*WakuService)(nil)
|
var _ node.Lifecycle = (*WakuService)(nil)
|
||||||
|
|
||||||
type WakuService struct {
|
type WakuService struct {
|
||||||
Waku types.Waku
|
Waku types.Waku
|
||||||
|
@ -33,8 +33,8 @@ func (w *WakuService) APIs() []rpc.API {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start is run when a service is started.
|
// Start is run when a service is started.
|
||||||
// It does nothing in this case but is required by `node.Service` interface.
|
// It does nothing in this case but is required by `node.Lifecycle` interface.
|
||||||
func (w *WakuService) Start(server *p2p.Server) error {
|
func (w *WakuService) Start() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
package nodebridge
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/ethereum/go-ethereum/node"
|
|
||||||
"github.com/ethereum/go-ethereum/p2p"
|
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
|
||||||
|
|
||||||
"github.com/status-im/status-go/eth-node/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Make sure that WhisperService implements node.Service interface.
|
|
||||||
var _ node.Service = (*WhisperService)(nil)
|
|
||||||
|
|
||||||
type WhisperService struct {
|
|
||||||
Whisper types.Whisper
|
|
||||||
}
|
|
||||||
|
|
||||||
// Protocols returns a new protocols list. In this case, there are none.
|
|
||||||
func (w *WhisperService) Protocols() []p2p.Protocol {
|
|
||||||
return []p2p.Protocol{}
|
|
||||||
}
|
|
||||||
|
|
||||||
// APIs returns a list of new APIs.
|
|
||||||
func (w *WhisperService) APIs() []rpc.API {
|
|
||||||
return []rpc.API{
|
|
||||||
{
|
|
||||||
Namespace: "status",
|
|
||||||
Version: "1.0",
|
|
||||||
Service: w.Whisper,
|
|
||||||
Public: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start is run when a service is started.
|
|
||||||
// It does nothing in this case but is required by `node.Service` interface.
|
|
||||||
func (w *WhisperService) Start(server *p2p.Server) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop is run when a service is stopped.
|
|
||||||
// It does nothing in this case but is required by `node.Service` interface.
|
|
||||||
func (w *WhisperService) Stop() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Make sure that Service implements node.Service interface.
|
// Make sure that Service implements node.Lifecycle interface.
|
||||||
var _ node.Service = (*Service)(nil)
|
var _ node.Lifecycle = (*Service)(nil)
|
||||||
|
|
||||||
// Discoverer manages peer discovery.
|
// Discoverer manages peer discovery.
|
||||||
type Discoverer interface {
|
type Discoverer interface {
|
||||||
|
@ -48,7 +48,7 @@ func (s *Service) SetDiscoverer(d Discoverer) {
|
||||||
|
|
||||||
// Start is run when a service is started.
|
// Start is run when a service is started.
|
||||||
// It does nothing in this case but is required by `node.Service` interface.
|
// It does nothing in this case but is required by `node.Service` interface.
|
||||||
func (s *Service) Start(server *p2p.Server) error {
|
func (s *Service) Start() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
bytes32Type, _ = abi.NewType("bytes32", nil)
|
bytes32Type, _ = abi.NewType("bytes32", "", nil)
|
||||||
int256Type, _ = abi.NewType("int256", nil)
|
int256Type, _ = abi.NewType("int256", "", nil)
|
||||||
|
|
||||||
errNotInteger = errors.New("not an integer")
|
errNotInteger = errors.New("not an integer")
|
||||||
)
|
)
|
||||||
|
@ -137,7 +137,7 @@ func toABITypeAndValue(f Field, data map[string]json.RawMessage, types Types) (v
|
||||||
}
|
}
|
||||||
|
|
||||||
func atomicType(f Field, data map[string]json.RawMessage) (val interface{}, typ abi.Type, err error) {
|
func atomicType(f Field, data map[string]json.RawMessage) (val interface{}, typ abi.Type, err error) {
|
||||||
typ, err = abi.NewType(f.Type, nil)
|
typ, err = abi.NewType(f.Type, "", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue