Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

making the timestamp available to the rms on commits #488

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,12 @@ func (app *BaseApp) Commit() (res abci.ResponseCommit) {
// The write to the DeliverTx state writes all state transitions to the root
// MultiStore (app.cms) so when Commit() is called is persists those values.
app.deliverState.ms.Write()

rms, ok := app.cms.(*rootmulti.Store)
if ok {
rms.SetCommitHeader(header)
}

commitID := app.cms.Commit()

// Reset the Check state to the latest committed.
Expand Down
10 changes: 9 additions & 1 deletion store/rootmulti/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package rootmulti

import (
"fmt"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"io"
"math"
"sort"
Expand Down Expand Up @@ -69,7 +70,8 @@ type Store struct {

interBlockCache types.MultiStorePersistentCache

listeners map[types.StoreKey][]types.WriteListener
listeners map[types.StoreKey][]types.WriteListener
commitHeader tmproto.Header
}

var (
Expand Down Expand Up @@ -418,6 +420,7 @@ func (rs *Store) Commit() types.CommitID {
}

newCommitInfo := rs.commitStores(version, rs.stores)
newCommitInfo.Timestamp = rs.commitHeader.Time
rs.updateLatestCommitInfo(newCommitInfo, version)

err := rs.handlePruning(version)
Expand All @@ -436,6 +439,11 @@ func (rs *Store) Commit() types.CommitID {
}
}

// SetCommitHeader sets the commit block header of the store.
func (rs *Store) SetCommitHeader(h tmproto.Header) {
rs.commitHeader = h
}

// CacheWrap implements CacheWrapper/Store/CommitStore.
func (rs *Store) CacheWrap() types.CacheWrap {
return rs.CacheMultiStore().(types.CacheWrap)
Expand Down
Loading