Added first etc hook into test plugin

This commit is contained in:
philip-morlier 2023-09-28 12:34:38 -07:00
parent 399cbbc8fd
commit 5be3014e0b
3 changed files with 28 additions and 20 deletions

View File

@ -95,12 +95,6 @@ var (
Value: flags.DirectoryString(filepath.Join("<datadir>", "plugins")),
Category: flags.EthCategory,
}
// ClassicFlag = &cli.BoolFlag{
// Name: "Classic",
// Usage: "Sepolia network: pre-configured proof-of-work test network",
// Category: flags.EthCategory,
// }
//end PluGeth code injection
DataDirFlag = &flags.DirectoryFlag{
Name: "datadir",
@ -1671,11 +1665,13 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
if pluginNetworkId := pluginNetworkId(); pluginNetworkId != nil {
cfg.NetworkId = *pluginNetworkId
}
if pluginETHDiscoveryURLs := pluginETHDiscoveryURLs(); pluginETHDiscoveryURLs != nil {
cfg.EthDiscoveryURLs = pluginETHDiscoveryURLs
}
if pluginSnapDiscoveryURLs := pluginSnapDiscoveryURLs(); pluginSnapDiscoveryURLs != nil {
cfg.SnapDiscoveryURLs = pluginSnapDiscoveryURLs
if cfg.EthDiscoveryURLs == nil {
var lightMode bool
if cfg.SyncMode == downloader.LightSync {
lightMode = true
}
cfg.EthDiscoveryURLs := pluginETHDiscoveryURLs(lightMode) {
cfg.SnapDiscoveryURLs := pluginSnapDiscoveryURLs()
}
//end PluGeth injection

View File

@ -41,6 +41,15 @@ func GetAPIs(stack core.Node, backend core.Backend) []core.API {
// this injection is covered by another test in this package. See documentation for details.
// }
// cmd/utils/
func SetSnapDiscoveryURLs() {
m := map[string]struct{}{
"SetSnapDiscoveryURLs":struct{}{},
}
hookChan <- m
}
// core/
@ -176,12 +185,13 @@ var plugins map[string]struct{} = map[string]struct{}{
"LivePostProcessBlock": struct{}{},
"LiveCaptureStart": struct{}{},
"LiveCaptureState": struct{}{},
"LiveCaptureEnd": struct{}{},
"PreTrieCommit": struct{}{},
"PostTrieCommit": struct{}{},
// "LiveCaptureFault": struct{}{},
// "LiveCaptureEnter": struct{}{},
// "LiveCaptureExit": struct{}{},
// "LiveTracerResult": struct{}{},
"LiveCaptureEnd": struct{}{},
"PreTrieCommit": struct{}{},
"PostTrieCommit": struct{}{},
"SetSnapDiscoveryURLs": struct{}{},
}

View File

@ -101,6 +101,12 @@ func BlockChain() {
delete(plugins, "LiveCaptureStart")
case f("LiveCaptureState"):
delete(plugins, "LiveCaptureState")
case f("LiveCaptureEnd"):
delete(plugins, "LiveCaptureEnd")
case f("PreTrieCommit"):
delete(plugins, "PreTrieCommit")
case f("PostTrieCommit"):
delete(plugins, "PostTrieCommit")
// These methods are not covered by tests at this time
// case f("LiveCaptureFault"):
// delete(plugins, "LiveCaptureFault")
@ -110,12 +116,8 @@ func BlockChain() {
// delete(plugins, "LiveCaptureExit")
// case f("LiveTracerResult"):
// delete(plugins, "LiveTracerResult")
case f("LiveCaptureEnd"):
delete(plugins, "LiveCaptureEnd")
case f("PreTrieCommit"):
delete(plugins, "PreTrieCommit")
case f("PostTrieCommit"):
delete(plugins, "PostTrieCommit")
case f("SetSnapDiscoveryURLs"):
delete(plugins, "SetSnapDiscoveryURLs")
}
}
}