forked from cerc-io/plugeth
Added psudoCreateEngine function to test CreateEngine call
This commit is contained in:
parent
e591342994
commit
892f98ad6a
@ -17,6 +17,7 @@ var (
|
||||
backend restricted.Backend
|
||||
log core.Logger
|
||||
events core.Feed
|
||||
createEngineCalled bool
|
||||
)
|
||||
|
||||
var httpApiFlagName = "http.api"
|
||||
@ -107,6 +108,7 @@ func (e *engine) Close() error {
|
||||
}
|
||||
|
||||
func CreateEngine(chainConfig *params.ChainConfig, db restricted.Database) consensus.Engine {
|
||||
createEngineCalled = true
|
||||
return &engine{}
|
||||
}
|
||||
|
||||
|
@ -187,6 +187,17 @@ func OpCodeSelect() []int {
|
||||
return nil
|
||||
}
|
||||
|
||||
// eth/ethconfig
|
||||
|
||||
func pseudoCreateEngine() {
|
||||
if createEngineCalled {
|
||||
m := map[string]struct{}{
|
||||
"CreateEngine":struct{}{},
|
||||
}
|
||||
hookChan <- m
|
||||
}
|
||||
}
|
||||
|
||||
// rpc/
|
||||
|
||||
|
||||
@ -239,6 +250,7 @@ func Is160(num *big.Int) bool {
|
||||
}
|
||||
|
||||
var plugins map[string]struct{} = map[string]struct{}{
|
||||
"CreateEngine":struct{}{},
|
||||
"OnShutdown": struct{}{},
|
||||
"SetTrieFlushIntervalClone":struct{}{},
|
||||
"StateUpdate": struct{}{},
|
||||
|
@ -53,6 +53,8 @@ func BlockChain() {
|
||||
var ok bool
|
||||
f := func(key string) bool {_, ok = m[key]; return ok}
|
||||
switch {
|
||||
case f("CreateEngine"):
|
||||
delete(plugins, "CreateEngine")
|
||||
case f("OnShutdown"):
|
||||
delete(plugins, "OnShutdown")
|
||||
case f("StateUpdate"):
|
||||
@ -139,6 +141,7 @@ func BlockChain() {
|
||||
}
|
||||
}()
|
||||
|
||||
pseudoCreateEngine()
|
||||
txFactory()
|
||||
txTracer()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user