Reject headers that build on an invalid parent

Noticed by @gmaxwell: a node keeps downloading blocks after a local error that caused it to treat one block as invalid.