diff --git a/build/flags.sh b/build/flags.sh old mode 100644 new mode 100755 diff --git a/cmd/gexp/js.go b/cmd/gexp/js.go index aeb48f9002..1e7d66e3cb 100644 --- a/cmd/gexp/js.go +++ b/cmd/gexp/js.go @@ -179,7 +179,7 @@ func newLightweightJSRE(docRoot string, client comms.ExpanseClient, datadir stri } -func newJSRE(expanse *exp.Expanse, libPath, corsDomain string, client comms.ExpanseClient, interactive bool, f xeth.Frontend) *jsre { +func newJSRE(expanse *exp.Expanse, docRoot, corsDomain string, client comms.ExpanseClient, interactive bool, f xeth.Frontend) *jsre { js := &jsre{expanse: expanse, ps1: "> "} // set default cors domain used by startRpc from CLI flag diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 3133a11e2c..44486a56e8 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -29,8 +29,6 @@ import ( "runtime" "strconv" - "github.com/expanse-project/go-expanse/metrics" - "github.com/codegangsta/cli" "github.com/expanse-project/ethash" "github.com/expanse-project/go-expanse/accounts" @@ -619,8 +617,8 @@ func StartIPC(exp *exp.Expanse, ctx *cli.Context) error { initializer := func(conn net.Conn) (comms.Stopper, shared.ExpanseApi, error) { fe := useragent.NewRemoteFrontend(conn, exp.AccountManager()) - xeth := xexp.New(exp, fe) - apis, err := api.ParseApiString(ctx.GlobalString(IPCApiFlag.Name), codec.JSON, xeth, eth) + xeth := xeth.New(exp, fe) + apis, err := api.ParseApiString(ctx.GlobalString(IPCApiFlag.Name), codec.JSON, xeth, exp) if err != nil { return nil, nil, err } @@ -637,7 +635,7 @@ func StartRPC(exp *exp.Expanse, ctx *cli.Context) error { CorsDomain: ctx.GlobalString(RPCCORSDomainFlag.Name), } - xeth := xexp.New(exp, nil) + xeth := xeth.New(exp, nil) codec := codec.JSON apis, err := api.ParseApiString(ctx.GlobalString(RpcApiFlag.Name), codec, xeth, exp) diff --git a/common/path_test.go b/common/path_test.go deleted file mode 100644 index 8b4bcbde56..0000000000 --- a/common/path_test.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2014 The go-ethereum Authors && Copyright 2015 go-expanse Authors -// This file is part of the go-expanse library. -// -// The go-expanse library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-expanse library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-expanse library. If not, see . - -package common - -import ( - "os" - // "testing" - - checker "gopkg.in/check.v1" -) - -type CommonSuite struct{} - -var _ = checker.Suite(&CommonSuite{}) - -func (s *CommonSuite) TestOS(c *checker.C) { - expwin := (os.PathSeparator == '\\' && os.PathListSeparator == ';') - res := IsWindows() - - if !expwin { - c.Assert(res, checker.Equals, expwin, checker.Commentf("IsWindows is", res, "but path is", os.PathSeparator)) - } else { - c.Assert(res, checker.Not(checker.Equals), expwin, checker.Commentf("IsWindows is", res, "but path is", os.PathSeparator)) - } -} - -func (s *CommonSuite) TestWindonziePath(c *checker.C) { - iswindowspath := os.PathSeparator == '\\' - path := "/opt/exp/test/file.ext" - res := WindonizePath(path) - ressep := string(res[0]) - - if !iswindowspath { - c.Assert(ressep, checker.Equals, "/") - } else { - c.Assert(ressep, checker.Not(checker.Equals), "/") - } -} diff --git a/event/filter/eth_filter.go b/event/filter/eth_filter.go deleted file mode 100644 index f992cee798..0000000000 --- a/event/filter/eth_filter.go +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2014 The go-ethereum Authors && Copyright 2015 go-expanse Authors -// This file is part of the go-expanse library. -// -// The go-expanse library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-expanse library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-expanse library. If not, see . - -package filter - -// TODO make use of the generic filtering system - -import ( - "sync" - - "github.com/expanse-project/go-expanse/core" - "github.com/expanse-project/go-expanse/core/state" - "github.com/expanse-project/go-expanse/event" -) - -type FilterManager struct { - eventMux *event.TypeMux - - filterMu sync.RWMutex - filterId int - filters map[int]*core.Filter - - quit chan struct{} -} - -func NewFilterManager(mux *event.TypeMux) *FilterManager { - return &FilterManager{ - eventMux: mux, - filters: make(map[int]*core.Filter), - } -} - -func (self *FilterManager) Start() { - go self.filterLoop() -} - -func (self *FilterManager) Stop() { - close(self.quit) -} - -func (self *FilterManager) InstallFilter(filter *core.Filter) (id int) { - self.filterMu.Lock() - defer self.filterMu.Unlock() - id = self.filterId - self.filters[id] = filter - self.filterId++ - - return id -} - -func (self *FilterManager) UninstallFilter(id int) { - self.filterMu.Lock() - defer self.filterMu.Unlock() - if _, ok := self.filters[id]; ok { - delete(self.filters, id) - } -} - -// GetFilter retrieves a filter installed using InstallFilter. -// The filter may not be modified. -func (self *FilterManager) GetFilter(id int) *core.Filter { - self.filterMu.RLock() - defer self.filterMu.RUnlock() - return self.filters[id] -} - -func (self *FilterManager) filterLoop() { - // Subscribe to events - events := self.eventMux.Subscribe( - //core.PendingBlockEvent{}, - core.ChainEvent{}, - core.TxPreEvent{}, - state.Logs(nil)) - -out: - for { - select { - case <-self.quit: - break out - case event := <-events.Chan(): - switch event := event.(type) { - case core.ChainEvent: - self.filterMu.RLock() - for _, filter := range self.filters { - if filter.BlockCallback != nil { - filter.BlockCallback(event.Block, event.Logs) - } - } - self.filterMu.RUnlock() - - case core.TxPreEvent: - self.filterMu.RLock() - for _, filter := range self.filters { - if filter.TransactionCallback != nil { - filter.TransactionCallback(event.Tx) - } - } - self.filterMu.RUnlock() - - case state.Logs: - self.filterMu.RLock() - for _, filter := range self.filters { - if filter.LogsCallback != nil { - msgs := filter.FilterLogs(event) - if len(msgs) > 0 { - filter.LogsCallback(msgs) - } - } - } - self.filterMu.RUnlock() - } - } - } -} diff --git a/exp/gasprice.go b/exp/gasprice.go index 120b0f112c..2bfe87b247 100644 --- a/exp/gasprice.go +++ b/exp/gasprice.go @@ -65,7 +65,7 @@ func NewGasPriceOracle(exp *Expanse) *GasPriceOracle { minbase = minbase.Div(minbase, big.NewInt(int64(exp.GpobaseCorrectionFactor))) } return &GasPriceOracle{ - eth: exp, + exp: exp, blocks: make(map[uint64]*blockPriceInfo), minBase: minbase, minPrice: minprice,