MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / TestReactorCreatesBlockWhenEmptyBlocksFalse

Function TestReactorCreatesBlockWhenEmptyBlocksFalse

consensus/reactor_test.go:238–257  ·  view source on GitHub ↗

------------------------------------ Ensure a testnet makes blocks when there are txs

(t *testing.T)

Source from the content-addressed store, hash-verified

236
237// Ensure a testnet makes blocks when there are txs
238func TestReactorCreatesBlockWhenEmptyBlocksFalse(t *testing.T) {
239 N := 4
240 css, cleanup := randConsensusNet(N, "consensus_reactor_test", newMockTickerFunc(true), newCounter,
241 func(c *cfg.Config) {
242 c.Consensus.CreateEmptyBlocks = false
243 })
244 defer cleanup()
245 reactors, blocksSubs, eventBuses := startConsensusNet(t, css, N)
246 defer stopConsensusNet(log.TestingLogger(), reactors, eventBuses)
247
248 // send a tx
249 if err := assertMempool(css[3].txNotifier).CheckTx([]byte{1, 2, 3}, nil, mempl.TxInfo{}); err != nil {
250 t.Error(err)
251 }
252
253 // wait till everyone makes the first new block
254 timeoutWaitGroup(t, N, func(j int) {
255 <-blocksSubs[j].Out()
256 }, css)
257}
258
259func TestLegacyReactorReceiveBasicIfAddPeerHasntBeenCalledYet(t *testing.T) {
260 N := 1

Callers

nothing calls this directly

Calls 11

TestingLoggerFunction · 0.92
randConsensusNetFunction · 0.85
newMockTickerFuncFunction · 0.85
cleanupFunction · 0.85
startConsensusNetFunction · 0.85
stopConsensusNetFunction · 0.85
assertMempoolFunction · 0.85
timeoutWaitGroupFunction · 0.85
CheckTxMethod · 0.65
ErrorMethod · 0.65
OutMethod · 0.65

Tested by

no test coverage detected