mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
last rebase-1.3.1 commit
This commit is contained in:
parent
aa2920f879
commit
9514a34050
6 changed files with 5 additions and 186 deletions
0
build/flags.sh
Normal file → Executable file
0
build/flags.sh
Normal file → Executable file
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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), "/")
|
||||
}
|
||||
}
|
||||
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue