@@ -95,8 +95,14 @@ func NewMongoDBEngine(cfg *Config) *XDCxDAO.MongoDatabase {
9595}
9696
9797func New (cfg * Config ) * XDCX {
98- tokenDecimalCache , _ := lru .New (defaultCacheLimit )
99- orderCache , _ := lru .New (tradingstate .OrderCacheLimit )
98+ tokenDecimalCache , err := lru .New (defaultCacheLimit )
99+ if err != nil {
100+ log .Warn ("[XDCx-New] fail to create new lru for token decimal" , "error" , err )
101+ }
102+ orderCache , err := lru .New (tradingstate .OrderCacheLimit )
103+ if err != nil {
104+ log .Warn ("[XDCx-New] fail to create new lru for order" , "error" , err )
105+ }
100106 XDCX := & XDCX {
101107 orderNonce : make (map [common.Address ]* big.Int ),
102108 Triegc : prque .New (),
@@ -121,7 +127,10 @@ func New(cfg *Config) *XDCX {
121127
122128// Overflow returns an indication if the message queue is full.
123129func (XDCx * XDCX ) Overflow () bool {
124- val , _ := XDCx .settings .Load (overflowIdx )
130+ val , ok := XDCx .settings .Load (overflowIdx )
131+ if ! ok {
132+ log .Warn ("[XDCx-Overflow] fail to load overflow index" )
133+ }
125134 return val .(bool )
126135}
127136
@@ -639,7 +648,7 @@ func (XDCx *XDCX) RollbackReorgTxMatch(txhash common.Hash) error {
639648 continue
640649 }
641650 orderCacheAtTxHash := c .(map [common.Hash ]tradingstate.OrderHistoryItem )
642- orderHistoryItem , _ := orderCacheAtTxHash [tradingstate .GetOrderHistoryKey (order .BaseToken , order .QuoteToken , order .Hash )]
651+ orderHistoryItem := orderCacheAtTxHash [tradingstate .GetOrderHistoryKey (order .BaseToken , order .QuoteToken , order .Hash )]
643652 if (orderHistoryItem == tradingstate.OrderHistoryItem {}) {
644653 log .Debug ("XDCx reorg: remove order due to empty orderHistory" , "order" , tradingstate .ToJSON (order ))
645654 if err := db .DeleteObject (order .Hash , & tradingstate.OrderItem {}); err != nil {
0 commit comments