- bp := newBlockProcessor(mockChain, s, nil)
- downloadNotifyCh := make(chan struct{}, 1)
- ProcessStopCh := make(chan struct{})
- var wg sync.WaitGroup
- go func() {
- time.Sleep(1 * time.Second)
- close(downloadNotifyCh)
- }()
- wg.Add(1)
- bp.process(downloadNotifyCh, ProcessStopCh, uint64(blockNum/2), &wg)
- if bp.chain.BestBlockHeight() != uint64(blockNum) {
- t.Fatalf("TestBlockProcess fail: got %d want %d", bp.chain.BestBlockHeight(), blockNum)
+ bp.process(downloadNotifyCh, ProcessStopCh, c.startHeight, &wg)
+ if bp.chain.BestBlockHeight() != c.stopHeight {
+ t.Fatalf("TestBlockProcess index: %d fail: got %d want %d", i, bp.chain.BestBlockHeight(), c.stopHeight)
+ }