Browse Source

add updated validator set to node test

pull/8094/head
William Banfield 3 years ago
parent
commit
3a8bcf87b2
No known key found for this signature in database GPG Key ID: EFAD3442BF29E3AC
2 changed files with 9 additions and 2 deletions
  1. +1
    -0
      internal/state/store.go
  2. +8
    -2
      node/node_test.go

+ 1
- 0
internal/state/store.go View File

@ -159,6 +159,7 @@ func (store dbStore) save(state State, key []byte) error {
}
}
// Save next validators.
fmt.Println("saving validators for height ", nextHeight+1)
err := store.saveValidatorsInfo(nextHeight+1, state.LastHeightValidatorsChanged, state.NextValidators, batch)
if err != nil {
return err


+ 8
- 2
node/node_test.go View File

@ -442,7 +442,7 @@ func TestMaxProposalBlockSize(t *testing.T) {
require.NoError(t, err)
defer os.RemoveAll(cfg.RootDir)
logger := log.NewNopLogger()
logger := log.NewTestingLogger(t)
cc := abciclient.NewLocalClient(logger, kvstore.NewApplication())
proxyApp := proxy.New(cc, logger, proxy.NopMetrics())
@ -497,10 +497,16 @@ func TestMaxProposalBlockSize(t *testing.T) {
},
}
// save the updated validator set for use by the block executor.
state.LastBlockHeight = math.MaxInt64 - 3
state.LastHeightValidatorsChanged = math.MaxInt64 - 1
state.NextValidators = state.Validators.Copy()
require.NoError(t, stateStore.Save(state))
timestamp := time.Date(math.MaxInt64, 0, 0, 0, 0, 0, math.MaxInt64, time.UTC)
// change state in order to produce the largest accepted header
state.LastBlockID = blockID
state.LastBlockHeight = math.MaxInt64 - 1
state.LastBlockHeight = math.MaxInt64 - 2
state.LastBlockTime = timestamp
state.LastResultsHash = tmhash.Sum([]byte("last_results_hash"))
state.AppHash = tmhash.Sum([]byte("app_hash"))


Loading…
Cancel
Save