testConnectBlocks uses looser limits

This commit is contained in:
Jakub Matys 2018-10-17 13:37:42 +02:00
parent d477ed7249
commit 9588d3510c

View File

@ -27,20 +27,17 @@ func testConnectBlocks(t *testing.T, h *TestHandler) {
} }
}, true) }, true)
if err != nil { if err != nil {
if err.Error() != fmt.Sprintf("connectBlocks interrupted at height %d", rng.Upper) { if !strings.HasPrefix(err.Error(), "connectBlocks interrupted at height") {
t.Fatal(err) t.Fatal(err)
} }
} }
height, hash, err := d.GetBestBlock() height, _, err := d.GetBestBlock()
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
if height != rng.Upper { if height < rng.Upper {
t.Fatalf("Upper block height mismatch: %d != %d", height, rng.Upper) t.Fatalf("Best block height mismatch: %d < %d", height, rng.Upper)
}
if hash != upperHash {
t.Fatalf("Upper block hash mismatch: %s != %s", hash, upperHash)
} }
t.Run("verifyBlockInfo", func(t *testing.T) { verifyBlockInfo(t, d, h, rng) }) t.Run("verifyBlockInfo", func(t *testing.T) { verifyBlockInfo(t, d, h, rng) })
@ -68,10 +65,10 @@ func testConnectBlocksParallel(t *testing.T, h *TestHandler) {
t.Fatal(err) t.Fatal(err)
} }
if height != rng.Upper { if height != rng.Upper {
t.Fatalf("Upper block height mismatch: %d != %d", height, rng.Upper) t.Fatalf("Best block height mismatch: %d != %d", height, rng.Upper)
} }
if hash != upperHash { if hash != upperHash {
t.Fatalf("Upper block hash mismatch: %s != %s", hash, upperHash) t.Fatalf("Best block hash mismatch: %s != %s", hash, upperHash)
} }
t.Run("verifyBlockInfo", func(t *testing.T) { verifyBlockInfo(t, d, h, rng) }) t.Run("verifyBlockInfo", func(t *testing.T) { verifyBlockInfo(t, d, h, rng) })