Skip to content

Commit

Permalink
Add hook and injection code for peer evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
Akohjesse committed Nov 22, 2024
1 parent f9d5d0b commit c44d923
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions eth/fetcher/block_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ func (f *BlockFetcher) loop() {
case res := <-resCh:
res.Done <- nil
f.FilterHeaders(peer, *res.Res.(*eth.BlockHeadersRequest), time.Now(), announcedAt)
log.Error("peer", "this is the peer id", peer)
pluginPeerEval(peer, *res.Res.(*eth.BlockHeadersRequest))

case <-timeout.C:
// The peer didn't respond in time. The request
Expand Down
13 changes: 13 additions & 0 deletions eth/fetcher/xplugeth_hooks.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package fetcher

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

func pluginPeerEval(id string, headers []*types.Header) {
for _, m := range xplugeth.GetModules[blockchain.PeerEvalPlugin]() {
m.PeerEval(id, headers)
}
}

0 comments on commit c44d923

Please sign in to comment.