fix: race in paych manager test
This commit is contained in:
parent
28985c8bcf
commit
63bb09553a
@ -71,17 +71,24 @@ func (pchapi *mockPaychAPI) receiveMsgResponse(mcid cid.Cid, receipt types.Messa
|
|||||||
if call, ok := pchapi.waitingCalls[mcid]; ok {
|
if call, ok := pchapi.waitingCalls[mcid]; ok {
|
||||||
delete(pchapi.waitingCalls, mcid)
|
delete(pchapi.waitingCalls, mcid)
|
||||||
call.response <- receipt
|
call.response <- receipt
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
pchapi.responses[mcid] = receipt
|
pchapi.responses[mcid] = receipt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send success response for any waiting calls
|
||||||
func (pchapi *mockPaychAPI) close() {
|
func (pchapi *mockPaychAPI) close() {
|
||||||
for mcid := range pchapi.waitingCalls {
|
pchapi.lk.Lock()
|
||||||
pchapi.receiveMsgResponse(mcid, types.MessageReceipt{
|
defer pchapi.lk.Unlock()
|
||||||
ExitCode: 0,
|
|
||||||
Return: []byte{},
|
success := types.MessageReceipt{
|
||||||
})
|
ExitCode: 0,
|
||||||
|
Return: []byte{},
|
||||||
|
}
|
||||||
|
for mcid, call := range pchapi.waitingCalls {
|
||||||
|
delete(pchapi.waitingCalls, mcid)
|
||||||
|
call.response <- success
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user