This commit is contained in:
Ethan Frey 2017-10-10 13:55:17 +02:00
parent e0604baad5
commit 1e6d9bcac6
2 changed files with 12 additions and 2 deletions

View File

@ -84,12 +84,14 @@ func NewStore(dbName string, cacheSize int, logger log.Logger) (*Store, error) {
return res, nil
}
// Height gets the last height stored in the database
func (s *Store) Height() uint64 {
return s.State.Committed().Tree.LatestVersion()
return s.State.LatestHeight()
}
// Hash gets the last hash stored in the database
func (s *Store) Hash() []byte {
return s.State.Committed().Tree.Hash()
return s.State.LatestHash()
}
// Info implements abci.Application. It returns the height, hash and size (in the data).

View File

@ -37,6 +37,14 @@ func (s State) Check() SimpleDB {
return s.checkTx
}
func (s State) LatestHeight() uint64 {
return s.committed.Tree.LatestVersion()
}
func (s State) LatestHash() []byte {
return s.committed.Tree.Hash()
}
// BatchSet is used for some weird magic in storing the new height
func (s *State) BatchSet(key, value []byte) {
if s.persistent {