From 3e512fd4c19b0c5f28c7fe7edd1fd074d922fb9f Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Thu, 28 Apr 2022 20:49:02 +0200 Subject: [PATCH] Cleanup from Simon's comments --- x/wasm/ioutils/utils.go | 2 +- x/wasm/keeper/snapshotter.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/x/wasm/ioutils/utils.go b/x/wasm/ioutils/utils.go index 0a2fea8c73..92e4e0d408 100644 --- a/x/wasm/ioutils/utils.go +++ b/x/wasm/ioutils/utils.go @@ -5,7 +5,7 @@ import ( "compress/gzip" ) -var ( +const ( // magic bytes to identify gzip. // See https://www.ietf.org/rfc/rfc1952.txt // and https://github.com/golang/go/blob/master/src/net/http/sniff.go#L186 diff --git a/x/wasm/keeper/snapshotter.go b/x/wasm/keeper/snapshotter.go index 2a3b255eb0..1479716bd9 100644 --- a/x/wasm/keeper/snapshotter.go +++ b/x/wasm/keeper/snapshotter.go @@ -89,17 +89,17 @@ func (ws *WasmSnapshotter) Snapshot(height uint64, protoWriter protoio.Writer) e cacheMS := ws.cms.CacheMultiStore() ctx := sdk.NewContext(cacheMS, tmproto.Header{}, false, log.NewNopLogger()) - uniqueHashes := make(map[string]bool) + seenBefore := make(map[string]bool) var rerr error ws.wasm.IterateCodeInfos(ctx, func(id uint64, info types.CodeInfo) bool { // Many code ids may point to the same code hash... only sync it once hexHash := hex.EncodeToString(info.CodeHash) - // if uniqueHashes, just skip this one and move to the next - if uniqueHashes[hexHash] { + // if seenBefore, just skip this one and move to the next + if seenBefore[hexHash] { return false } - uniqueHashes[hexHash] = true + seenBefore[hexHash] = true // load code and abort on error wasmBytes, err := ws.wasm.GetByteCode(ctx, id)