aboutsummaryrefslogtreecommitdiffstats
path: root/eth/api.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-04-28 17:00:11 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-05-02 21:20:21 +0800
commit586eddfd09558bfd71f23c2e50c270d2ca665d49 (patch)
tree4015e542e0397c606d1f14ef23d15463881be554 /eth/api.go
parentd46da273c6731512b4114393856a96be06505797 (diff)
downloaddexon-586eddfd09558bfd71f23c2e50c270d2ca665d49.tar.gz
dexon-586eddfd09558bfd71f23c2e50c270d2ca665d49.tar.zst
dexon-586eddfd09558bfd71f23c2e50c270d2ca665d49.zip
release, all: integrate the release service into geth
Diffstat (limited to 'eth/api.go')
-rw-r--r--eth/api.go30
1 files changed, 16 insertions, 14 deletions
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