Skip to content

Commit

Permalink
fix race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
anatollupacescu committed May 6, 2021
1 parent e0b0a72 commit 022d8ee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/p2p/libp2p/libp2p_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ func (sb *SwapBackend) add(tx common.Hash, ethAddr common.Address) {
sb.m.Lock()
defer sb.m.Unlock()

mockSwapBackend.addrs[tx] = ethAddr
sb.addrs[tx] = ethAddr
}

func (sb *SwapBackend) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) {
mockSwapBackend.m.RLock()
defer mockSwapBackend.m.RUnlock()
sb.m.RLock()
defer sb.m.RUnlock()

return &types.Receipt{
ContractAddress: mockSwapBackend.addrs[txHash],
ContractAddress: sb.addrs[txHash],
}, nil
}

0 comments on commit 022d8ee

Please sign in to comment.