cmd, eth, node, rpc, xeth: use single-instance services
This commit is contained in:
@ -68,7 +68,7 @@ type testjethre struct {
|
||||
|
||||
func (self *testjethre) UnlockAccount(acc []byte) bool {
|
||||
var ethereum *eth.Ethereum
|
||||
self.stack.SingletonService(ðereum)
|
||||
self.stack.Service(ðereum)
|
||||
|
||||
err := ethereum.AccountManager().Unlock(common.BytesToAddress(acc), "")
|
||||
if err != nil {
|
||||
@ -79,7 +79,7 @@ func (self *testjethre) UnlockAccount(acc []byte) bool {
|
||||
|
||||
func (self *testjethre) ConfirmTransaction(tx string) bool {
|
||||
var ethereum *eth.Ethereum
|
||||
self.stack.SingletonService(ðereum)
|
||||
self.stack.Service(ðereum)
|
||||
|
||||
if ethereum.NatSpec {
|
||||
self.lastConfirm = natspec.GetNotice(self.xeth, tx, self.client)
|
||||
@ -118,7 +118,7 @@ func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *nod
|
||||
if config != nil {
|
||||
config(ethConf)
|
||||
}
|
||||
if err := stack.Register("ethereum", func(ctx *node.ServiceContext) (node.Service, error) { return eth.New(ctx, ethConf) }); err != nil {
|
||||
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { return eth.New(ctx, ethConf) }); err != nil {
|
||||
t.Fatalf("failed to register ethereum protocol: %v", err)
|
||||
}
|
||||
// Initialize all the keys for testing
|
||||
@ -138,7 +138,7 @@ func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *nod
|
||||
t.Fatalf("failed to start test stack: %v", err)
|
||||
}
|
||||
var ethereum *eth.Ethereum
|
||||
stack.SingletonService(ðereum)
|
||||
stack.Service(ðereum)
|
||||
|
||||
assetPath := filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "cmd", "mist", "assets", "ext")
|
||||
client := comms.NewInProcClient(codec.JSON)
|
||||
@ -202,7 +202,7 @@ func TestBlockChain(t *testing.T) {
|
||||
tmpfileq := strconv.Quote(tmpfile)
|
||||
|
||||
var ethereum *eth.Ethereum
|
||||
node.SingletonService(ðereum)
|
||||
node.Service(ðereum)
|
||||
ethereum.BlockChain().Reset()
|
||||
|
||||
checkEvalJSON(t, repl, `admin.exportChain(`+tmpfileq+`)`, `true`)
|
||||
@ -436,7 +436,7 @@ multiply7 = Multiply7.at(contractaddress);
|
||||
|
||||
func pendingTransactions(repl *testjethre, t *testing.T) (txc int64, err error) {
|
||||
var ethereum *eth.Ethereum
|
||||
repl.stack.SingletonService(ðereum)
|
||||
repl.stack.Service(ðereum)
|
||||
|
||||
txs := ethereum.TxPool().GetTransactions()
|
||||
return int64(len(txs)), nil
|
||||
@ -464,7 +464,7 @@ func processTxs(repl *testjethre, t *testing.T, expTxc int) bool {
|
||||
return false
|
||||
}
|
||||
var ethereum *eth.Ethereum
|
||||
repl.stack.SingletonService(ðereum)
|
||||
repl.stack.Service(ðereum)
|
||||
|
||||
err = ethereum.StartMining(runtime.NumCPU(), "")
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user