@@ -30,6 +30,29 @@ var _ = Describe("DKG", func() {
30
30
outputs := executeDKG (players , step1Timeout )
31
31
checkOutputs (outputs , n , t , indices )
32
32
})
33
+
34
+ It ("should work after restting the state" , func () {
35
+ n := 10
36
+ t := 5
37
+
38
+ indices := sequentialIndices (n )
39
+ context := [32 ]byte {}
40
+ copy (context [:], []byte ("context" ))
41
+ step1Timeout := time .Duration (500 * time .Millisecond )
42
+
43
+ players := createDKGPlayers (indices , t , context )
44
+
45
+ outputs := executeDKG (players , step1Timeout )
46
+ checkOutputs (outputs , n , t , indices )
47
+
48
+ // Reset and run the simulation again.
49
+ for i := range players {
50
+ players [i ].reset ()
51
+ }
52
+
53
+ outputs = executeDKG (players , step1Timeout )
54
+ checkOutputs (outputs , n , t , indices )
55
+ })
33
56
})
34
57
35
58
Context ("all nodes honest and some offline" , func () {
@@ -142,6 +165,12 @@ func createDKGPlayers(indices []uint16, t int, context [32]byte) []dkgPlayer {
142
165
return players
143
166
}
144
167
168
+ func (player * dkgPlayer ) reset () {
169
+ player .state .Reset ()
170
+ player .online = true
171
+ player .aborted = false
172
+ }
173
+
145
174
type dkgSimOutput struct {
146
175
index uint16
147
176
output frost.DKGOutput
0 commit comments