From 586eddfd09558bfd71f23c2e50c270d2ca665d49 Mon Sep 17 00:00:00 2001 From: Péter Szilágyi Date: Thu, 28 Apr 2016 12:00:11 +0300 Subject: release, all: integrate the release service into geth --- eth/api.go | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'eth/api.go') diff --git a/eth/api.go b/eth/api.go index 2c84cf471..bd8179962 100644 --- a/eth/api.go +++ b/eth/api.go @@ -52,14 +52,14 @@ import ( "golang.org/x/net/context" ) -// ErrNoCode is returned by call and transact operations for which the requested +// errNoCode is returned by call and transact operations for which the requested // recipient contract to operate on does not exist in the state db or does not // have any code associated with it (i.e. suicided). // // Please note, this error string is part of the RPC API and is expected by the // native contract bindings to signal this particular error. Do not change this // as it will break all dependent code! -var ErrNoCode = errors.New("no contract code at given address") +var errNoCode = errors.New("no contract code at given address") const defaultGas = uint64(90000) @@ -107,8 +107,11 @@ type PublicEthereumAPI struct { } // NewPublicEthereumAPI creates a new Ethereum protocol API. -func NewPublicEthereumAPI(e *Ethereum, gpo *GasPriceOracle) *PublicEthereumAPI { - return &PublicEthereumAPI{e, gpo} +func NewPublicEthereumAPI(e *Ethereum) *PublicEthereumAPI { + return &PublicEthereumAPI{ + e: e, + gpo: e.gpo, + } } // GasPrice returns a suggestion for a gas price. @@ -717,7 +720,7 @@ func (s *PublicBlockChainAPI) doCall(args CallArgs, blockNr rpc.BlockNumber) (st // If there's no code to interact with, respond with an appropriate error if args.To != nil { if code := stateDb.GetCode(*args.To); len(code) == 0 { - return "0x", nil, ErrNoCode + return "0x", nil, errNoCode } } // Retrieve the account state object to interact with @@ -914,18 +917,17 @@ type PublicTransactionPoolAPI struct { } // NewPublicTransactionPoolAPI creates a new RPC service with methods specific for the transaction pool. -func NewPublicTransactionPoolAPI(e *Ethereum, gpo *GasPriceOracle) *PublicTransactionPoolAPI { +func NewPublicTransactionPoolAPI(e *Ethereum) *PublicTransactionPoolAPI { api := &PublicTransactionPoolAPI{ - eventMux: e.EventMux(), - gpo: gpo, - chainDb: e.ChainDb(), - bc: e.BlockChain(), - am: e.AccountManager(), - txPool: e.TxPool(), - miner: e.Miner(), + eventMux: e.eventMux, + gpo: e.gpo, + chainDb: e.chainDb, + bc: e.blockchain, + am: e.accountManager, + txPool: e.txPool, + miner: e.miner, pendingTxSubs: make(map[string]rpc.Subscription), } - go api.subscriptionLoop() return api -- cgit