aboutsummaryrefslogtreecommitdiffstats
path: root/contracts
diff options
context:
space:
mode:
Diffstat (limited to 'contracts')
-rw-r--r--contracts/release/release.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/contracts/release/release.go b/contracts/release/release.go
index 5a6665dba..8d1710197 100644
--- a/contracts/release/release.go
+++ b/contracts/release/release.go
@@ -27,6 +27,8 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/eth"
+ "github.com/ethereum/go-ethereum/internal/ethapi"
+ "github.com/ethereum/go-ethereum/les"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/node"
@@ -60,12 +62,20 @@ type ReleaseService struct {
// releases and notify the user of such.
func NewReleaseService(ctx *node.ServiceContext, config Config) (node.Service, error) {
// Retrieve the Ethereum service dependency to access the blockchain
+ var apiBackend ethapi.Backend
var ethereum *eth.Ethereum
- if err := ctx.Service(&ethereum); err != nil {
- return nil, err
+ if err := ctx.Service(&ethereum); err == nil {
+ apiBackend = ethereum.ApiBackend
+ } else {
+ var ethereum *les.LightEthereum
+ if err := ctx.Service(&ethereum); err == nil {
+ apiBackend = ethereum.ApiBackend
+ } else {
+ return nil, err
+ }
}
// Construct the release service
- contract, err := NewReleaseOracle(config.Oracle, eth.NewContractBackend(ethereum))
+ contract, err := NewReleaseOracle(config.Oracle, eth.NewContractBackend(apiBackend))
if err != nil {
return nil, err
}