Fix BlockchainReactor bug w/ mismatched state.LastBlockHeight vs store.Height
This is due to a non-atomic saves of state.State vs blockchain.Store. This is a simple hack.
This commit is contained in:
parent
12c7f00c44
commit
3da76496b0
|
@ -56,8 +56,10 @@ type BlockchainReactor struct {
|
|||
}
|
||||
|
||||
func NewBlockchainReactor(state *sm.State, proxyAppCtx proxy.AppContext, store *BlockStore, sync bool) *BlockchainReactor {
|
||||
if state.LastBlockHeight != store.Height() &&
|
||||
state.LastBlockHeight != store.Height()-1 { // XXX double check this logic.
|
||||
if state.LastBlockHeight == store.Height()-1 {
|
||||
store.height -= 1 // XXX HACK, make this better
|
||||
}
|
||||
if state.LastBlockHeight != store.Height() {
|
||||
PanicSanity(Fmt("state (%v) and store (%v) height mismatch", state.LastBlockHeight, store.Height()))
|
||||
}
|
||||
requestsCh := make(chan BlockRequest, defaultChannelCapacity)
|
||||
|
|
Loading…
Reference in New Issue