committed by
Felföldi Zsolt
parent
4aee0d1994
commit
2ed729d38e
14
les/api.go
14
les/api.go
@@ -30,15 +30,11 @@ var (
|
||||
// PrivateLightAPI provides an API to access the LES light server or light client.
|
||||
type PrivateLightAPI struct {
|
||||
backend *lesCommons
|
||||
reg *checkpointOracle
|
||||
}
|
||||
|
||||
// NewPrivateLightAPI creates a new LES service API.
|
||||
func NewPrivateLightAPI(backend *lesCommons, reg *checkpointOracle) *PrivateLightAPI {
|
||||
return &PrivateLightAPI{
|
||||
backend: backend,
|
||||
reg: reg,
|
||||
}
|
||||
func NewPrivateLightAPI(backend *lesCommons) *PrivateLightAPI {
|
||||
return &PrivateLightAPI{backend: backend}
|
||||
}
|
||||
|
||||
// LatestCheckpoint returns the latest local checkpoint package.
|
||||
@@ -67,7 +63,7 @@ func (api *PrivateLightAPI) LatestCheckpoint() ([4]string, error) {
|
||||
// result[2], 32 bytes hex encoded latest section bloom trie root hash
|
||||
func (api *PrivateLightAPI) GetCheckpoint(index uint64) ([3]string, error) {
|
||||
var res [3]string
|
||||
cp := api.backend.getLocalCheckpoint(index)
|
||||
cp := api.backend.localCheckpoint(index)
|
||||
if cp.Empty() {
|
||||
return res, errNoCheckpoint
|
||||
}
|
||||
@@ -77,8 +73,8 @@ func (api *PrivateLightAPI) GetCheckpoint(index uint64) ([3]string, error) {
|
||||
|
||||
// GetCheckpointContractAddress returns the contract contract address in hex format.
|
||||
func (api *PrivateLightAPI) GetCheckpointContractAddress() (string, error) {
|
||||
if api.reg == nil {
|
||||
if api.backend.oracle == nil {
|
||||
return "", errNotActivated
|
||||
}
|
||||
return api.reg.config.Address.Hex(), nil
|
||||
return api.backend.oracle.config.Address.Hex(), nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user