disallow infinite loop, since in testing this only runs once

This commit is contained in:
Mikers 2023-03-28 08:11:23 +00:00
parent ad81cd18c2
commit e9d2223025

View File

@ -770,8 +770,9 @@ func (mp *MessagePool) Add(ctx context.Context, m *types.SignedMessage) error {
_, _ = mp.api.GetActorAfter(m.Message.From, tmpCurTs)
_, _ = mp.getStateNonce(ctx, m.Message.From, tmpCurTs)
cacheSecondTime := true
//if the newly acquired Ts is not the one we just cached, let go of the lock, cache it and open the lock again and repeat....
for {
for cacheSecondTime {
mp.curTsLk.Lock()
writeCurTs := mp.curTs
@ -782,6 +783,7 @@ func (mp *MessagePool) Add(ctx context.Context, m *types.SignedMessage) error {
tmpCurTs = writeCurTs
_, _ = mp.api.GetActorAfter(m.Message.From, tmpCurTs)
_, _ = mp.getStateNonce(ctx, m.Message.From, tmpCurTs)
cacheSecondTime = false
}