@ -46,12 +46,22 @@ func TestRollback(t *testing.T) {
BlockID : initialState . LastBlockID ,
BlockID : initialState . LastBlockID ,
Header : types . Header {
Header : types . Header {
Height : initialState . LastBlockHeight ,
Height : initialState . LastBlockHeight ,
AppHash : initialState . AppHash ,
AppHash : factory . RandomHash ( ) ,
LastBlockID : factory . MakeBlockID ( ) ,
LastBlockID : factory . MakeBlockID ( ) ,
LastResultsHash : initialState . LastResultsHash ,
LastResultsHash : initialState . LastResultsHash ,
} ,
} ,
}
}
blockStore . On ( "LoadBlockMeta" , initialState . LastBlockHeight ) . Return ( block )
nextBlock := & types . BlockMeta {
BlockID : initialState . LastBlockID ,
Header : types . Header {
Height : nextState . LastBlockHeight ,
AppHash : initialState . AppHash ,
LastBlockID : block . BlockID ,
LastResultsHash : nextState . LastResultsHash ,
} ,
}
blockStore . On ( "LoadBlockMeta" , height ) . Return ( block )
blockStore . On ( "LoadBlockMeta" , nextHeight ) . Return ( nextBlock )
blockStore . On ( "Height" ) . Return ( nextHeight )
blockStore . On ( "Height" ) . Return ( nextHeight )
// rollback the state
// rollback the state
@ -81,6 +91,7 @@ func TestRollbackNoBlocks(t *testing.T) {
stateStore := setupStateStore ( t , height )
stateStore := setupStateStore ( t , height )
blockStore := & mocks . BlockStore { }
blockStore := & mocks . BlockStore { }
blockStore . On ( "Height" ) . Return ( height )
blockStore . On ( "Height" ) . Return ( height )
blockStore . On ( "LoadBlockMeta" , height ) . Return ( nil )
blockStore . On ( "LoadBlockMeta" , height - 1 ) . Return ( nil )
blockStore . On ( "LoadBlockMeta" , height - 1 ) . Return ( nil )
_ , _ , err := state . Rollback ( blockStore , stateStore )
_ , _ , err := state . Rollback ( blockStore , stateStore )