Commit 9fad87f0 authored by vipwzw's avatar vipwzw Committed by 33cn

fix testnode

parent 44deaf4c
...@@ -83,6 +83,10 @@ func NewWithConfig(cfg *types.Config, sub *types.ConfigSubModule, mockapi client ...@@ -83,6 +83,10 @@ func NewWithConfig(cfg *types.Config, sub *types.ConfigSubModule, mockapi client
func newWithConfig(cfg *types.Config, sub *types.ConfigSubModule, mockapi client.QueueProtocolAPI) *Chain33Mock { func newWithConfig(cfg *types.Config, sub *types.ConfigSubModule, mockapi client.QueueProtocolAPI) *Chain33Mock {
chain33globalLock.Lock() chain33globalLock.Lock()
return newWithConfigNoLock(cfg, sub, mockapi)
}
func newWithConfigNoLock(cfg *types.Config, sub *types.ConfigSubModule, mockapi client.QueueProtocolAPI) *Chain33Mock {
types.Init(cfg.Title, cfg) types.Init(cfg.Title, cfg)
q := queue.New("channel") q := queue.New("channel")
types.Debug = false types.Debug = false
...@@ -280,6 +284,11 @@ func (mock *Chain33Mock) GetCfg() *types.Config { ...@@ -280,6 +284,11 @@ func (mock *Chain33Mock) GetCfg() *types.Config {
//Close : //Close :
func (mock *Chain33Mock) Close() { func (mock *Chain33Mock) Close() {
mock.closeNoLock()
chain33globalLock.Unlock()
}
func (mock *Chain33Mock) closeNoLock() {
mock.chain.Close() mock.chain.Close()
mock.store.Close() mock.store.Close()
mock.mem.Close() mock.mem.Close()
...@@ -290,7 +299,6 @@ func (mock *Chain33Mock) Close() { ...@@ -290,7 +299,6 @@ func (mock *Chain33Mock) Close() {
mock.client.Close() mock.client.Close()
mock.rpc.Close() mock.rpc.Close()
os.RemoveAll(mock.datadir) os.RemoveAll(mock.datadir)
chain33globalLock.Unlock()
} }
//WaitHeight : //WaitHeight :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment