github.com/aaa256/atlantis@v0.0.0-20210707112435-42ee889287a2/core/helper_test.go (about) 1 // Copyright 2014 The go-athereum Authors 2 // This file is part of the go-athereum library. 3 // 4 // The go-athereum library is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Lesser General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // The go-athereum library is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Lesser General Public License for more details. 13 // 14 // You should have received a copy of the GNU Lesser General Public License 15 // along with the go-athereum library. If not, see <http://www.gnu.org/licenses/>. 16 17 package core 18 19 import ( 20 "container/list" 21 22 "github.com/athereum/go-athereum/core/types" 23 "github.com/athereum/go-athereum/athdb" 24 "github.com/athereum/go-athereum/event" 25 ) 26 27 // Implement our EthTest Manager 28 type TestManager struct { 29 // stateManager *StateManager 30 eventMux *event.TypeMux 31 32 db athdb.Database 33 txPool *TxPool 34 blockChain *BlockChain 35 Blocks []*types.Block 36 } 37 38 func (tm *TestManager) IsListening() bool { 39 return false 40 } 41 42 func (tm *TestManager) IsMining() bool { 43 return false 44 } 45 46 func (tm *TestManager) PeerCount() int { 47 return 0 48 } 49 50 func (tm *TestManager) Peers() *list.List { 51 return list.New() 52 } 53 54 func (tm *TestManager) BlockChain() *BlockChain { 55 return tm.blockChain 56 } 57 58 func (tm *TestManager) TxPool() *TxPool { 59 return tm.txPool 60 } 61 62 // func (tm *TestManager) StateManager() *StateManager { 63 // return tm.stateManager 64 // } 65 66 func (tm *TestManager) EventMux() *event.TypeMux { 67 return tm.eventMux 68 } 69 70 // func (tm *TestManager) KeyManager() *crypto.KeyManager { 71 // return nil 72 // } 73 74 func (tm *TestManager) Db() athdb.Database { 75 return tm.db 76 } 77 78 func NewTestManager() *TestManager { 79 testManager := &TestManager{} 80 testManager.eventMux = new(event.TypeMux) 81 testManager.db = athdb.NewMemDatabase() 82 // testManager.txPool = NewTxPool(testManager) 83 // testManager.blockChain = NewBlockChain(testManager) 84 // testManager.stateManager = NewStateManager(testManager) 85 return testManager 86 }