From 4d005a2c1d2929dc770acd3a2bfed59495c70557 Mon Sep 17 00:00:00 2001 From: zelig Date: Mon, 26 Oct 2015 22:24:09 +0100 Subject: rpc api: eth_getNatSpec * xeth, rpc: implement eth_getNatSpec for tx confirmations * rename silly docserver -> httpclient * eth/backend: httpclient now accessible via eth.Ethereum init-d via config.DocRoot * cmd: introduce separate CLI flag for DocRoot (defaults to homedir) * common/path: delete unused assetpath func, separate HomeDir func --- eth/backend.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'eth/backend.go') diff --git a/eth/backend.go b/eth/backend.go index 6ce0d0eb0..ee857e146 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -35,6 +35,7 @@ import ( "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/compiler" + "github.com/ethereum/go-ethereum/common/httpclient" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" @@ -106,6 +107,7 @@ type Config struct { LogJSON string VmDebug bool NatSpec bool + DocRoot string AutoDAG bool PowTest bool ExtraData []byte @@ -249,6 +251,8 @@ type Ethereum struct { GpobaseStepUp int GpobaseCorrectionFactor int + httpclient *httpclient.HTTPClient + net *p2p.Server eventMux *event.TypeMux miner *miner.Miner @@ -400,6 +404,7 @@ func New(config *Config) (*Ethereum, error) { GpobaseStepDown: config.GpobaseStepDown, GpobaseStepUp: config.GpobaseStepUp, GpobaseCorrectionFactor: config.GpobaseCorrectionFactor, + httpclient: httpclient.New(config.DocRoot), } if config.PowTest { @@ -702,6 +707,12 @@ func (self *Ethereum) StopAutoDAG() { glog.V(logger.Info).Infof("Automatic pregeneration of ethash DAG OFF (ethash dir: %s)", ethash.DefaultDir) } +// HTTPClient returns the light http client used for fetching offchain docs +// (natspec, source for verification) +func (self *Ethereum) HTTPClient() *httpclient.HTTPClient { + return self.httpclient +} + func (self *Ethereum) Solc() (*compiler.Solidity, error) { var err error if self.solc == nil { -- cgit v1.2.3