diff --git a/app/store.go b/app/store.go index ee933fab91..c70adf9b0e 100644 --- a/app/store.go +++ b/app/store.go @@ -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). diff --git a/state/merkle.go b/state/merkle.go index f23be1cc7e..14ad530024 100644 --- a/state/merkle.go +++ b/state/merkle.go @@ -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 {