The recently added test, TestXMRTakerCancelOrRefundAfterKeyExchange, is flaky. The problem is this code:
count, err := ec.PendingTransactionCount(ctx) //nolint:govet
if err != nil {
t.Errorf("failed to get pending tx count: %s", err)
return
}
if count > 0 {
// the newSwap tx is in the mempool, shut down the nodes
cancel()
t.Log("cancelling context of Alice's and Bob's servers")
return
}
Multiple packages are being tested concurrently and the pending transaction that is found is sometimes an unrelated transaction that happens before the newSwap transaction that it is looking for is created. Then the newSwap transaction never gets created because the context is cancelled first. The swap ends up with the status of aborted.
The recently added test,
TestXMRTakerCancelOrRefundAfterKeyExchange
, is flaky. The problem is this code:Multiple packages are being tested concurrently and the pending transaction that is found is sometimes an unrelated transaction that happens before the
newSwap
transaction that it is looking for is created. Then thenewSwap
transaction never gets created because the context is cancelled first. The swap ends up with the status ofaborted
.