Tests that chains missing links do not get accepted by the processor.
(t *testing.T)
| 281 | |
| 282 | // Tests that chains missing links do not get accepted by the processor. |
| 283 | func TestBrokenBlockChain(t *testing.T) { |
| 284 | t.Skip("===TestBrokenBlockChain broken block chain not reported") |
| 285 | db := database.NewMemDatabase() |
| 286 | blockchain, err := newCanonical(fakeDpor(db), 10, db) |
| 287 | // Make chain starting from genesis |
| 288 | if err != nil { |
| 289 | t.Fatalf("failed to make new canonical chain: %v", err) |
| 290 | } |
| 291 | defer blockchain.Stop() |
| 292 | |
| 293 | // Create a forked chain, and try to insert with a missing link |
| 294 | chain := makeBlockChain(blockchain.CurrentBlock(), 5, fakeDpor(db), db, forkSeed)[1:] |
| 295 | if err := testBlockChainImport(chain, blockchain); err == nil { |
| 296 | t.Errorf("broken block chain not reported") |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | // Tests that reorganising a long difficult chain after a short easy one |
| 301 | // overwrites the canonical numbers and links in the database. |
nothing calls this directly
no test coverage detected