Skip to content

Commit

Permalink
core, eth: announce based transaction propagation (ethereum#20234)
Browse files Browse the repository at this point in the history
  • Loading branch information
karalabe authored and wanwiset25 committed Jun 28, 2024
1 parent ae52ca6 commit 93b2a23
Show file tree
Hide file tree
Showing 132 changed files with 3,944 additions and 432 deletions.
4 changes: 2 additions & 2 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ func New(ctx *node.ServiceContext, config *ethconfig.Config, XDCXServ *XDCx.XDCX
return block, false, nil
}

eth.protocolManager.fetcher.SetSignHook(signHook)
eth.protocolManager.fetcher.SetAppendM2HeaderHook(appendM2HeaderHook)
eth.protocolManager.blockFetcher.SetSignHook(signHook)
eth.protocolManager.blockFetcher.SetAppendM2HeaderHook(appendM2HeaderHook)

/*
XDPoS1.0 Specific hooks
Expand Down
223 changes: 141 additions & 82 deletions eth/fetcher/fetcher.go → eth/fetcher/block_fetcher.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func makeChain(n int, seed byte, parent *types.Block) ([]common.Hash, map[common

// fetcherTester is a test simulator for mocking out local block chain.
type fetcherTester struct {
fetcher *Fetcher
fetcher *BlockFetcher

hashes []common.Hash // Hash chain belonging to the tester
blocks map[common.Hash]*types.Block // Blocks belonging to the tester
Expand All @@ -93,7 +93,7 @@ func newTester() *fetcherTester {
blocks: map[common.Hash]*types.Block{genesis.Hash(): genesis},
drops: make(map[string]bool),
}
tester.fetcher = New(tester.getBlock, tester.verifyHeader, tester.handleProposedBlock, tester.broadcastBlock, tester.chainHeight, tester.insertBlock, tester.prepareBlock, tester.dropPeer)
tester.fetcher = NewBlockFetcher(tester.getBlock, tester.verifyHeader, tester.handleProposedBlock, tester.broadcastBlock, tester.chainHeight, tester.insertChain, tester.prepareBlock, tester.dropPeer)
tester.fetcher.Start()

return tester
Expand Down Expand Up @@ -556,9 +556,9 @@ func testImportDeduplication(t *testing.T, protocol int) {
bodyFetcher := tester.makeBodyFetcher("valid", blocks, 0)

counter := uint32(0)
tester.fetcher.insertBlock = func(block *types.Block) error {
tester.fetcher.insertChain = func(blocks types.Blocks) (int, error) {
atomic.AddUint32(&counter, uint32(1))
return tester.insertBlock(block)
return tester.insertChain(blocks)
}
// Instrument the fetching and imported events
fetching := make(chan []common.Hash)
Expand Down
43 changes: 0 additions & 43 deletions eth/fetcher/metrics.go

This file was deleted.

Loading

0 comments on commit 93b2a23

Please sign in to comment.