@@ -764,8 +764,9 @@ func (s *covenantlessService) SignVtxos(ctx context.Context, forfeitTxs []string
764
764
765
765
go func () {
766
766
s .currentRoundLock .Lock ()
767
- s . checkForfeitsAndBoardingSigsSent ( s . currentRound )
767
+ round := s . currentRound
768
768
s .currentRoundLock .Unlock ()
769
+ s .checkForfeitsAndBoardingSigsSent (round )
769
770
}()
770
771
771
772
return nil
@@ -785,8 +786,9 @@ func (s *covenantlessService) SignRoundTx(ctx context.Context, signedRoundTx str
785
786
786
787
go func () {
787
788
s .currentRoundLock .Lock ()
788
- s . checkForfeitsAndBoardingSigsSent ( s . currentRound )
789
+ round := s . currentRound
789
790
s .currentRoundLock .Unlock ()
791
+ s .checkForfeitsAndBoardingSigsSent (round )
790
792
}()
791
793
792
794
return nil
@@ -813,7 +815,6 @@ func (s *covenantlessService) checkForfeitsAndBoardingSigsSent(currentRound *dom
813
815
select {
814
816
case s .forfeitsBoardingSigsChan <- struct {}{}:
815
817
default :
816
- time .Sleep (time .Millisecond )
817
818
}
818
819
}
819
820
}
@@ -1168,16 +1169,21 @@ func (s *covenantlessService) startRound() {
1168
1169
//nolint:all
1169
1170
round .StartRegistration ()
1170
1171
s .currentRound = round
1172
+ close (s .forfeitsBoardingSigsChan )
1173
+ s .forfeitsBoardingSigsChan = make (chan struct {}, 1 )
1171
1174
1172
1175
defer func () {
1173
1176
roundEndTime := time .Now ().Add (time .Duration (s .roundInterval ) * time .Second )
1174
- time .Sleep (time .Duration (s .roundInterval / 6 ) * time .Second )
1177
+ sleepingTime := s .roundInterval / 6
1178
+ if sleepingTime < 1 {
1179
+ sleepingTime = 1
1180
+ }
1181
+ time .Sleep (time .Duration (sleepingTime ) * time .Second )
1175
1182
s .startFinalization (roundEndTime )
1176
1183
}()
1177
1184
1178
1185
log .Debugf ("started registration stage for new round: %s" , round .Id )
1179
1186
}
1180
-
1181
1187
func (s * covenantlessService ) startFinalization (roundEndTime time.Time ) {
1182
1188
log .Debugf ("started finalization stage for round: %s" , s .currentRound .Id )
1183
1189
ctx := context .Background ()
@@ -1447,7 +1453,9 @@ func (s *covenantlessService) finalizeRound(notes []note.Note, roundEndTime time
1447
1453
defer s .startRound ()
1448
1454
1449
1455
ctx := context .Background ()
1456
+ s .currentRoundLock .Lock ()
1450
1457
round := s .currentRound
1458
+ s .currentRoundLock .Unlock ()
1451
1459
if round .IsFailed () {
1452
1460
return
1453
1461
}
0 commit comments