-
Notifications
You must be signed in to change notification settings - Fork 219
Open
Description
nonce: uint64(time.Now().Unix()) * 1000,
// time.now.second x 1000 != millisecond
// I think it mean
nonce: uint64(time.Now().UnixNano()) / 10e5,
if I new the client obj every time , the nonce will be same of same "second" , the conn obj init nonce will be same ...
so I think just use nano second be nonce will fix this
type CustomNonceGenerator struct {
}
func (u *CustomNonceGenerator) GetNonce() string {
return strconv.FormatUint(uint64(time.Now().UnixNano()), 10)
// or same code : millisecond
// return strconv.FormatUint(uint64(time.Now().UnixNano()) / 10e5, 10)
}
// ...
func{
conn := bitfinexRest.NewClientWithURLNonce("https://api.bitfinex.com/v2/", &CustomNonceGenerator{}).Credentials(...)
}
or just fix source code , init conn nonce be nano second
nonce: uint64(time.Now().UnixNano()),
but multi conn obj will be nonce collision ...
or use a global var + lock to increase it?
Metadata
Metadata
Assignees
Labels
No labels