From 0a82f8b353466a616ed330f76ed222069088555a Mon Sep 17 00:00:00 2001 From: tycho garen Date: Fri, 18 Mar 2022 09:07:33 -0400 Subject: [PATCH] cleanup more --- internal/consensus/common_test.go | 7 +++++-- internal/consensus/wal_generator.go | 12 +++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/internal/consensus/common_test.go b/internal/consensus/common_test.go index 23327a7dd..18a6310c3 100644 --- a/internal/consensus/common_test.go +++ b/internal/consensus/common_test.go @@ -885,8 +885,11 @@ func randConsensusNetWithPeers( app := appFunc(logger, filepath.Join(cfg.DBDir(), fmt.Sprintf("%s_%d", testName, i))) vals := types.TM2PB.ValidatorUpdates(state.Validators) - if _, ok := app.(*kvstore.PersistentKVStoreApplication); ok { - // simulate handshake, receive app version. If don't do this, replay test will fail + switch app.(type) { + // simulate handshake, receive app version. If don't do this, replay test will fail + case *kvstore.PersistentKVStoreApplication: + state.Version.Consensus.App = kvstore.ProtocolVersion + case *kvstore.Application: state.Version.Consensus.App = kvstore.ProtocolVersion } app.InitChain(abci.RequestInitChain{Validators: vals}) diff --git a/internal/consensus/wal_generator.go b/internal/consensus/wal_generator.go index e99c054c0..b2e2e7131 100644 --- a/internal/consensus/wal_generator.go +++ b/internal/consensus/wal_generator.go @@ -7,7 +7,6 @@ import ( "fmt" "io" mrand "math/rand" - "path/filepath" "testing" "time" @@ -26,18 +25,17 @@ import ( "github.com/tendermint/tendermint/types" ) -// WALGenerateNBlocks generates a consensus WAL. It does this by spinning up a -// stripped down version of node (proxy app, event bus, consensus state) with a -// persistent kvstore application and special consensus wal instance -// (byteBufferWAL) and waits until numBlocks are created. +// WALGenerateNBlocks generates a consensus WAL. It does this by +// spinning up a stripped down version of node (proxy app, event bus, +// consensus state) with a kvstore application and special consensus +// wal instance (byteBufferWAL) and waits until numBlocks are created. // If the node fails to produce given numBlocks, it fails the test. func WALGenerateNBlocks(ctx context.Context, t *testing.T, logger log.Logger, wr io.Writer, numBlocks int) { t.Helper() cfg := getConfig(t) - app := kvstore.NewPersistentKVStoreApplication(logger, filepath.Join(cfg.DBDir(), "wal_generator")) - t.Cleanup(func() { require.NoError(t, app.Close()) }) + app := kvstore.NewApplication() logger.Info("generating WAL (last height msg excluded)", "numBlocks", numBlocks)