Skip to content

Commit 6326a0c

Browse files
committed
reduce runtime of unit test: TestKeyregValidityPeriod
1 parent 4ba3d33 commit 6326a0c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

data/account/participation_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,17 @@ func TestKeyregValidityPeriod(t *testing.T) {
497497
partitiontest.PartitionTest(t)
498498
a := require.New(t)
499499

500+
// Patch the global consensus variable since FillDBWithParticipationKeys uses is to check the validity period
501+
// this allows us to reduce the runtime of the test while checking the logic of FillDBWithParticipationKeys
502+
version := config.Consensus[protocol.ConsensusCurrentVersion]
503+
oldValue := config.Consensus[protocol.ConsensusCurrentVersion].MaxKeyregValidPeriod
504+
version.MaxKeyregValidPeriod = 256*(1<<4) - 1
505+
config.Consensus[protocol.ConsensusCurrentVersion] = version
506+
defer func() {
507+
version.MaxKeyregValidPeriod = oldValue
508+
config.Consensus[protocol.ConsensusCurrentVersion] = version
509+
}()
510+
500511
maxValidPeriod := config.Consensus[protocol.ConsensusCurrentVersion].MaxKeyregValidPeriod
501512
dilution := config.Consensus[protocol.ConsensusCurrentVersion].DefaultKeyDilution
502513

0 commit comments

Comments
 (0)