Skip to content

Commit e0f169e

Browse files
committed
revert unnecessary change
1 parent f74ae7d commit e0f169e

4 files changed

Lines changed: 1 addition & 66 deletions

File tree

CHANGELOG.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
6262
* (client) [#19870](https://github.com/cosmos/cosmos-sdk/pull/19870) Add new query command `wait-tx`. Alias `event-query-tx-for` to `wait-tx` for backward compatibility.
6363
* (crypto/keyring) [#20212](https://github.com/cosmos/cosmos-sdk/pull/20212) Expose the db keyring used in the keystore.
6464
* (genutil) [#19971](https://github.com/cosmos/cosmos-sdk/pull/19971) Allow manually setting the consensus key type in genesis
65-
<<<<<<< HEAD
66-
* (store) [#20862](https://github.com/cosmos/cosmos-sdk/pull/20862) Add `Copy()` method for `CacheMultiStore` and `cachekv.Store`.
67-
=======
6865
* (client/tx) [#20870](https://github.com/cosmos/cosmos-sdk/pull/20870) Add `timeout-timestamp` field for tx body defines time based timeout.Add `WithTimeoutTimestamp` to tx factory. Increased gas cost for processing newly added timeout timestamp field in tx body.
69-
>>>>>>> upstream/main
7066

7167
### Improvements
7268

store/cachekv/store.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -161,38 +161,6 @@ func (store *Store) Write() {
161161
}
162162
}
163163

164-
// Copy creates a deep copy of the Store object
165-
func (store *Store) Copy() types.CacheKVStore {
166-
store.mtx.Lock()
167-
defer store.mtx.Unlock()
168-
169-
// Copy cache
170-
cacheCopy := make(map[string]*cValue, len(store.cache))
171-
for key, val := range store.cache {
172-
newVal := *val // Create a copy of the cValue
173-
cacheCopy[key] = &newVal
174-
}
175-
176-
// Copy unsortedCache
177-
unsortedCacheCopy := make(map[string]struct{}, len(store.unsortedCache))
178-
for key := range store.unsortedCache {
179-
unsortedCacheCopy[key] = struct{}{}
180-
}
181-
182-
// Copy sortedCache
183-
sortedCacheCopy := store.sortedCache.Copy()
184-
185-
// Create new Store with copied values
186-
newStore := &Store{
187-
cache: cacheCopy,
188-
unsortedCache: unsortedCacheCopy,
189-
sortedCache: sortedCacheCopy,
190-
parent: store.parent,
191-
}
192-
193-
return newStore
194-
}
195-
196164
// CacheWrap implements CacheWrapper.
197165
func (store *Store) CacheWrap() types.CacheWrap {
198166
return NewStore(store)

store/cachemulti/store.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -127,32 +127,6 @@ func (cms Store) Write() {
127127
}
128128
}
129129

130-
// Copy creates a deep copy of the Store object
131-
func (cms Store) Copy() types.CacheMultiStore {
132-
// Deep copy the db field
133-
newDB := cms.db.Copy()
134-
135-
// Deep copy the cachekv stores map
136-
newStores := make(map[types.StoreKey]types.CacheWrap, len(cms.stores))
137-
for key, store := range cms.stores {
138-
store, ok := store.(*cachekv.Store)
139-
if ok {
140-
newStores[key] = store.Copy()
141-
}
142-
}
143-
144-
// Create new Store with copied values
145-
newStore := Store{
146-
db: newDB,
147-
stores: newStores,
148-
keys: cms.keys,
149-
traceWriter: cms.traceWriter,
150-
traceContext: cms.traceContext,
151-
}
152-
153-
return newStore
154-
}
155-
156130
// Implements CacheWrapper.
157131
func (cms Store) CacheWrap() types.CacheWrap {
158132
return cms.CacheMultiStore().(types.CacheWrap)

store/types/store.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ type MultiStore interface {
167167
// CacheMultiStore is from MultiStore.CacheMultiStore()....
168168
type CacheMultiStore interface {
169169
MultiStore
170-
Write() // Writes operations to underlying KVStore
171-
Copy() CacheMultiStore // Returns a deep copy of the CacheMultiStore
170+
Write() // Writes operations to underlying KVStore
172171
}
173172

174173
// CommitMultiStore is an interface for a MultiStore without cache capabilities.
@@ -287,8 +286,6 @@ type CacheKVStore interface {
287286

288287
// Write writes operations to underlying KVStore
289288
Write()
290-
// Copy creates a deep copy of the Store object
291-
Copy() CacheKVStore
292289
}
293290

294291
// CommitKVStore is an interface for MultiStore.

0 commit comments

Comments
 (0)