MCPcopy Create free account
hub / github.com/CPChain/chain / newTester

Function newTester

protocols/cpc/fetcher/fetcher_test.go:80–90  ·  view source on GitHub ↗

newTester creates a new fetcher test mocker.

()

Source from the content-addressed store, hash-verified

78
79// newTester creates a new fetcher test mocker.
80func newTester() *fetcherTester {
81 tester := &fetcherTester{
82 hashes: []common.Hash{genesis.Hash()},
83 blocks: map[common.Hash]*types.Block{genesis.Hash(): genesis},
84 drops: make(map[string]bool),
85 }
86 tester.fetcher = New(tester.getBlock, tester.verifyHeader, tester.broadcastBlock, tester.chainHeight, tester.insertChain, tester.dropPeer)
87 tester.fetcher.Start()
88
89 return tester
90}
91
92// getBlock retrieves a block from the tester's block chain.
93func (f *fetcherTester) getBlock(hash common.Hash) *types.Block {

Calls 3

NewFunction · 0.70
HashMethod · 0.65
StartMethod · 0.65

Tested by

no test coverage detected