PanicSanity is deprecated

This commit is contained in:
Anton Kaliaev
2018-03-04 14:58:43 +04:00
parent d86855ad7a
commit bcf54b0aa3
2 changed files with 10 additions and 8 deletions

View File

@@ -72,18 +72,20 @@ func NewBlockchainReactor(state sm.State, blockExec *sm.BlockExecutor, store *Bl
fastSync bool) *BlockchainReactor {
if state.LastBlockHeight != store.Height() {
cmn.PanicSanity(cmn.Fmt("state (%v) and store (%v) height mismatch", state.LastBlockHeight,
panic(fmt.Sprintf("state (%v) and store (%v) height mismatch", state.LastBlockHeight,
store.Height()))
}
const cap = 1000 // must be bigger than peers count
requestsCh := make(chan BlockRequest, cap)
errorsCh := make(chan peerError, cap) // so we don't block in #Receive#pool.AddBlock
pool := NewBlockPool(
store.Height()+1,
requestsCh,
errorsCh,
)
bcR := &BlockchainReactor{
params: state.ConsensusParams,
initialState: state,

View File

@@ -76,7 +76,7 @@ func (bs *BlockStore) LoadBlock(height int64) *types.Block {
}
blockMeta := wire.ReadBinary(&types.BlockMeta{}, r, 0, &n, &err).(*types.BlockMeta)
if err != nil {
cmn.PanicCrisis(cmn.Fmt("Error reading block meta: %v", err))
panic(fmt.Sprintf("Error reading block meta: %v", err))
}
bytez := []byte{}
for i := 0; i < blockMeta.BlockID.PartsHeader.Total; i++ {
@@ -85,7 +85,7 @@ func (bs *BlockStore) LoadBlock(height int64) *types.Block {
}
block := wire.ReadBinary(&types.Block{}, bytes.NewReader(bytez), 0, &n, &err).(*types.Block)
if err != nil {
cmn.PanicCrisis(cmn.Fmt("Error reading block: %v", err))
panic(fmt.Sprintf("Error reading block: %v", err))
}
return block
}
@@ -102,7 +102,7 @@ func (bs *BlockStore) LoadBlockPart(height int64, index int) *types.Part {
}
part := wire.ReadBinary(&types.Part{}, r, 0, &n, &err).(*types.Part)
if err != nil {
cmn.PanicCrisis(cmn.Fmt("Error reading block part: %v", err))
panic(fmt.Sprintf("Error reading block part: %v", err))
}
return part
}
@@ -118,7 +118,7 @@ func (bs *BlockStore) LoadBlockMeta(height int64) *types.BlockMeta {
}
blockMeta := wire.ReadBinary(&types.BlockMeta{}, r, 0, &n, &err).(*types.BlockMeta)
if err != nil {
cmn.PanicCrisis(cmn.Fmt("Error reading block meta: %v", err))
panic(fmt.Sprintf("Error reading block meta: %v", err))
}
return blockMeta
}
@@ -136,7 +136,7 @@ func (bs *BlockStore) LoadBlockCommit(height int64) *types.Commit {
}
commit := wire.ReadBinary(&types.Commit{}, r, 0, &n, &err).(*types.Commit)
if err != nil {
cmn.PanicCrisis(cmn.Fmt("Error reading commit: %v", err))
panic(fmt.Sprintf("Error reading commit: %v", err))
}
return commit
}
@@ -153,7 +153,7 @@ func (bs *BlockStore) LoadSeenCommit(height int64) *types.Commit {
}
commit := wire.ReadBinary(&types.Commit{}, r, 0, &n, &err).(*types.Commit)
if err != nil {
cmn.PanicCrisis(cmn.Fmt("Error reading commit: %v", err))
panic(fmt.Sprintf("Error reading commit: %v", err))
}
return commit
}
@@ -262,7 +262,7 @@ func LoadBlockStoreStateJSON(db dbm.DB) BlockStoreStateJSON {
bsj := BlockStoreStateJSON{}
err := json.Unmarshal(bytes, &bsj)
if err != nil {
cmn.PanicCrisis(cmn.Fmt("Could not unmarshal bytes: %X", bytes))
panic(fmt.Sprintf("Could not unmarshal bytes: %X", bytes))
}
return bsj
}