HuobiRDCenter / huobi_Golang

Go SDK for Huobi Spot API
https://www.htx.com/zh-cn/opend/newApiPages/
Apache License 2.0
176 stars 86 forks source link

Fix sha256 race condition panic #9

Closed shaodan closed 3 years ago

shaodan commented 4 years ago

Create new hmac instance as needed since it is not goroutine safe

eynzhang commented 4 years ago

@shaodan , I tried your test code first, I expect it should cause panic but it didn’t. Can you double check that?

And can you explain how you reproduce the issue https://github.com/HuobiRDCenter/huobi_Golang/issues/8 ?

shaodan commented 4 years ago

@eynzhang I've fix the panic, so the test should pass. If you want to reproduce that, you need to revert my change of internal/requestbuilder/signer.go

eynzhang commented 4 years ago

@shaodan , I didn’t use your code for test. I used your method TestSigner_Sign_RaceCondition to test against the master branch, and it passed.

shaodan commented 4 years ago

@eynzhang https://play.golang.org/p/h9_pLX0jieW

filinvadim commented 4 years ago

@shaodan @eynzhang Hi folks! Issue was closed but nothing was actually fixed.

eynzhang commented 3 years ago

@shaodan thanks for your contribution, your request is merged. I am not sure why I can’t reproduce this issue last time.