Skip to content

Commit

Permalink
add pluginPeerEval injection to eth/downloader/queue.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Akohjesse committed Nov 1, 2024
1 parent 9a37cee commit f0ef135
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
4 changes: 4 additions & 0 deletions eth/downloader/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,10 @@ func (q *queue) DeliverHeaders(id string, headers []*types.Header, hashes []comm
q.lock.Lock()
defer q.lock.Unlock()

//begin PluGeth code injection
pluginPeerEval(id, headers, hashes)
//end PluGeth code injection

var logger log.Logger
if len(id) < 16 {
// Tests use short IDs, don't choke on them
Expand Down
14 changes: 14 additions & 0 deletions eth/downloader/xplugeth_hooks.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package downloader

import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/openrelayxyz/xplugeth"
"github.com/openrelayxyz/xplugeth/hooks/blockchain"
)

func pluginPeerEval(id string, headers []*types.Header, hashes []common.Hash) {
for _, m := range xplugeth.GetModules[blockchain.PeerEvalPlugin]() {
m.PeerEval(id, headers, hashes)
}
}
6 changes: 2 additions & 4 deletions internal/cli/server/xplugeth_imports.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package server

// +build example_plugin

import (
_ "github.com/openrelayxyz/xplugeth/plugins/example"
)
_ "github.com/openrelayxyz/xplugeth/plugins/peerEval"
)

0 comments on commit f0ef135

Please sign in to comment.