mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-06 07:26:47 +00:00
stream/buffer: Improve orderbook verification conditions and fix TestUpdateByIDAndAction test (#1682)
* don't need to verify if checksum available; don't retroactively verify snapshots * glorious: nits + allow checksum/validation to be done on updateByIDAndAction * possible slice manipulation issue fix for test * thrasher: nit * this should fix it now * for subsystem usage disallow deploying a book twice * reverts strict policy using deploy, it's used in a bunch of tests I don't want to touch just yet, left a note * rm unused variable * glorious: nits --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
@@ -79,8 +79,7 @@ func (s *Service) Update(b *Base) error {
|
||||
return s.Mux.Publish(book, m1.ID)
|
||||
}
|
||||
|
||||
// DeployDepth used for subsystem deployment creates a depth item in the struct
|
||||
// then returns a ptr to that Depth item
|
||||
// DeployDepth used for subsystem deployment creates a depth item in the struct then returns a ptr to that Depth item
|
||||
func (s *Service) DeployDepth(exchange string, p currency.Pair, a asset.Item) (*Depth, error) {
|
||||
if exchange == "" {
|
||||
return nil, errExchangeNameUnset
|
||||
@@ -112,13 +111,15 @@ func (s *Service) DeployDepth(exchange string, p currency.Pair, a asset.Item) (*
|
||||
s.books[strings.ToLower(exchange)] = m1
|
||||
}
|
||||
book, ok := m1.m[mapKey]
|
||||
if !ok {
|
||||
book = NewDepth(m1.ID)
|
||||
book.exchange = exchange
|
||||
book.pair = p
|
||||
book.asset = a
|
||||
m1.m[mapKey] = book
|
||||
if ok {
|
||||
// Maybe in future we should return an error here and be more strict.
|
||||
return book, nil
|
||||
}
|
||||
book = NewDepth(m1.ID)
|
||||
book.exchange = exchange
|
||||
book.pair = p
|
||||
book.asset = a
|
||||
m1.m[mapKey] = book
|
||||
return book, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user