index: Don't commit a best block before indexing it during sync
index: Don't commit a best block before indexing it during sync

Committing a block prior to indexing would leave the index database
in an inconsistent state until it is indexed, which could corrupt the
index in case of a unclean shutdown. Thus commit its predecessor.

Co-authored-by: Luke Dashjr <d0b35c280567a6e00291dab426e321dcd3a56fd2@utopios.org>

jambolo/bitcoin,Xekyo/bitcoin,mruddy/bitcoin,bitcoin/bitcoin,domob1812/bitcoin,fujicoin/fujicoin,AkioNak/bitcoin,lateminer/bitcoin,GroestlCoin/bitcoin,andreaskern/bitcoin,particl/particl-core,AkioNak/bitcoin,fanquake/bitcoin,AkioNak/bitcoin,sstone/bitcoin,sipsorcery/bitcoin,namecoin/namecoin-core,namecoin/namecoin-core,tecnovert/particl-core,GroestlCoin/bitcoin,bitcoin/bitcoin,GroestlCoin/bitcoin,jamesob/bitcoin,particl/particl-core,tecnovert/particl-core,sipsorcery/bitcoin,particl/particl-core,jamesob/bitcoin,fujicoin/fujicoin,andreaskern/bitcoin,tecnovert/particl-core,bitcoinsSG/bitcoin,fanquake/bitcoin,jamesob/bitcoin,domob1812/bitcoin,sipsorcery/bitcoin,bitcoinsSG/bitcoin,bitcoinsSG/bitcoin,sipsorcery/bitcoin,particl/particl-core,ajtowns/bitcoin,jambolo/bitcoin,instagibbs/bitcoin,jambolo/bitcoin,Xekyo/bitcoin,sstone/bitcoin,Xekyo/bitcoin,domob1812/bitcoin,tecnovert/particl-core,ajtowns/bitcoin,GroestlCoin/bitcoin,jambolo/bitcoin,fujicoin/fujicoin,namecoin/namecore,GroestlCoin/GroestlCoin,fanquake/bitcoin,sstone/bitcoin,sstone/bitcoin,instagibbs/bitcoin,lateminer/bitcoin,fanquake/bitcoin,namecoin/namecoin-core,namecoin/namecore,lateminer/bitcoin,namecoin/namecoin-core,AkioNak/bitcoin,sipsorcery/bitcoin,jamesob/bitcoin,sipsorcery/bitcoin,fanquake/bitcoin,lateminer/bitcoin,andreaskern/bitcoin,fujicoin/fujicoin,instagibbs/bitcoin,mruddy/bitcoin,fanquake/bitcoin,lateminer/bitcoin,kallewoof/bitcoin,sstone/bitcoin,tecnovert/particl-core,mruddy/bitcoin,andreaskern/bitcoin,GroestlCoin/bitcoin,Xekyo/bitcoin,bitcoin/bitcoin,kallewoof/bitcoin,domob1812/bitcoin,bitcoin/bitcoin,AkioNak/bitcoin,sstone/bitcoin,jambolo/bitcoin,GroestlCoin/GroestlCoin,namecoin/namecoin-core,ajtowns/bitcoin,kallewoof/bitcoin,ajtowns/bitcoin,jambolo/bitcoin,ajtowns/bitcoin,mruddy/bitcoin,instagibbs/bitcoin,AkioNak/bitcoin,bitcoinsSG/bitcoin,jamesob/bitcoin,particl/particl-core,lateminer/bitcoin,namecoin/namecoin-core,andreaskern/bitcoin,Xekyo/bitcoin,GroestlCoin/GroestlCoin,domob1812/bitcoin,GroestlCoin/GroestlCoin,bitcoin/bitcoin,fujicoin/fujicoin,bitcoinsSG/bitcoin,ajtowns/bitcoin,GroestlCoin/GroestlCoin,kallewoof/bitcoin,andreaskern/bitcoin,namecoin/namecore,bitcoinsSG/bitcoin,mruddy/bitcoin,jamesob/bitcoin,Xekyo/bitcoin,GroestlCoin/bitcoin,mruddy/bitcoin,namecoin/namecore,kallewoof/bitcoin,domob1812/bitcoin,instagibbs/bitcoin,particl/particl-core,kallewoof/bitcoin,GroestlCoin/GroestlCoin,instagibbs/bitcoin,namecoin/namecore,namecoin/namecore,bitcoin/bitcoin,tecnovert/particl-core,fujicoin/fujicoin