aboutsummaryrefslogtreecommitdiffstats
path: root/contracts
diff options
context:
space:
mode:
authorzsfelfoldi <zsfelfoldi@gmail.com>2016-01-14 02:35:48 +0800
committerFelix Lange <fjl@twurst.com>2016-11-09 09:12:53 +0800
commit7db7109a5b53c339f00e9c05ac826b3dbd1f98e1 (patch)
treec447d9816c4490e71cb2a8d2420d82f938d8757a /contracts
parent9f8d192991c4f68fa14c91366722bbca601da117 (diff)
downloadgo-tangerine-7db7109a5b53c339f00e9c05ac826b3dbd1f98e1.tar.gz
go-tangerine-7db7109a5b53c339f00e9c05ac826b3dbd1f98e1.tar.zst
go-tangerine-7db7109a5b53c339f00e9c05ac826b3dbd1f98e1.zip
cmd, eth: added light client and light server modes
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
}