Correctly update pindexBestHeader and pindexBestInvalid in InvalidateBlock (#2029)
Correctly update pindexBestHeader and pindexBestInvalid in InvalidateBlock (#2029)

Stale pindexBestHeader values cause invalid high-work chains to stay as
pindexBestHeader forever and causes initial syncing to fail.

Observed on testnet.
biblepay/biblepay,nmarley/dash,biblepay/biblepay,biblepay/biblepay,nmarley/dash,thelazier/dash,crowning-/dash,UdjinM6/dash,dashpay/dash,biblepay/biblepay,ionomy/ion,ivansib/sibcoin,UdjinM6/dash,UdjinM6/dash,dashpay/dash,biblepay/biblepay,nmarley/dash,ionomy/ion,thelazier/dash,crowning-/dash,thelazier/dash,thelazier/dash,ivansib/sibcoin,thelazier/dash,ionomy/ion,dashpay/dash,nmarley/dash,UdjinM6/dash,UdjinM6/dash,ionomy/ion,ionomy/ion,ivansib/sibcoin,dashpay/dash,nmarley/dash,ivansib/sibcoin,nmarley/dash,ivansib/sibcoin,biblepay/biblepay,dashpay/dash,ivansib/sibcoin,crowning-/dash,nmarley/dash,crowning-/dash,ionomy/ion,crowning-/dash,biblepay/biblepay,crowning-/dash,biblepay/biblepay