diff --git a/store/go.mod b/store/go.mod index d19146546b02..e0d79564a665 100644 --- a/store/go.mod +++ b/store/go.mod @@ -11,7 +11,7 @@ require ( github.com/confio/ics23/go v0.9.0 github.com/cosmos/cosmos-db v1.0.0-rc.1 github.com/cosmos/gogoproto v1.4.6 - github.com/cosmos/iavl v0.21.0-alpha.1 + github.com/cosmos/iavl v0.21.0-beta.1 github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.3 // indirect github.com/hashicorp/go-hclog v1.4.0 diff --git a/store/go.sum b/store/go.sum index fc26f7a300e6..1ff5dcedf22a 100644 --- a/store/go.sum +++ b/store/go.sum @@ -67,8 +67,8 @@ github.com/cosmos/cosmos-db v1.0.0-rc.1 h1:SjnT8B6WKMW9WEIX32qMhnEEKcI7ZP0+G1Sa9 github.com/cosmos/cosmos-db v1.0.0-rc.1/go.mod h1:Dnmk3flSf5lkwCqvvjNpoxjpXzhxnCAFzKHlbaForso= github.com/cosmos/gogoproto v1.4.6 h1:Ee7z15dWJaGlgM2rWrK8N2IX7PQcuccu8oG68jp5RL4= github.com/cosmos/gogoproto v1.4.6/go.mod h1:VS/ASYmPgv6zkPKLjR9EB91lwbLHOzaGCirmKKhncfI= -github.com/cosmos/iavl v0.21.0-alpha.1 h1:ul5oRSJgl053YX18XxS9PlPBI9zcdCO/auSxVeyj69Q= -github.com/cosmos/iavl v0.21.0-alpha.1/go.mod h1:25YJYzilTErJ2mKfNB3xyWL9IsCwEQdNzdIutg2mh3U= +github.com/cosmos/iavl v0.21.0-beta.1 h1:fBQeBc8HLZ14plJNcmGfaOXSSMLVEHvEQXiTXSD76m0= +github.com/cosmos/iavl v0.21.0-beta.1/go.mod h1:25YJYzilTErJ2mKfNB3xyWL9IsCwEQdNzdIutg2mh3U= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/store/iavl/store.go b/store/iavl/store.go index 09ff361bdac0..aae3eeaa410f 100644 --- a/store/iavl/store.go +++ b/store/iavl/store.go @@ -389,6 +389,11 @@ func (st *Store) Query(req abci.RequestQuery) (res abci.ResponseQuery) { return res } +// TraverseStateChanges traverses the state changes between two versions and calls the given function. +func (st *Store) TraverseStateChanges(startVersion, endVersion int64, fn func(version int64, changeSet *iavl.ChangeSet) error) error { + return st.tree.TraverseStateChanges(startVersion, endVersion, fn) +} + // Takes a MutableTree, a key, and a flag for creating existence or absence proof and returns the // appropriate merkle.Proof. Since this must be called after querying for the value, this function should never error // Thus, it will panic on error rather than returning it diff --git a/store/iavl/tree.go b/store/iavl/tree.go index 319b01dd0f19..77762e1dfbd0 100644 --- a/store/iavl/tree.go +++ b/store/iavl/tree.go @@ -35,6 +35,7 @@ type ( AvailableVersions() []int LoadVersionForOverwriting(targetVersion int64) (int64, error) LazyLoadVersionForOverwriting(targetVersion int64) (int64, error) + TraverseStateChanges(startVersion, endVersion int64, fn func(version int64, changeSet *iavl.ChangeSet) error) error } // immutableTree is a simple wrapper around a reference to an iavl.ImmutableTree