diff options
author | zsfelfoldi <zsfelfoldi@gmail.com> | 2016-01-14 02:35:48 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2016-11-09 09:12:53 +0800 |
commit | 7db7109a5b53c339f00e9c05ac826b3dbd1f98e1 (patch) | |
tree | c447d9816c4490e71cb2a8d2420d82f938d8757a /contracts/release | |
parent | 9f8d192991c4f68fa14c91366722bbca601da117 (diff) | |
download | go-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/release')
-rw-r--r-- | contracts/release/release.go | 16 |
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(ðereum); err != nil { - return nil, err + if err := ctx.Service(ðereum); err == nil { + apiBackend = ethereum.ApiBackend + } else { + var ethereum *les.LightEthereum + if err := ctx.Service(ðereum); 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 } |