mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-21 06:04:33 +00:00
Merge pull request #399 from XinFinOrg/xdp-01
fix: remove unnecessary assignment
This commit is contained in:
commit
ddac0a6af7
2 changed files with 15 additions and 6 deletions
17
XDCx/XDCx.go
17
XDCx/XDCx.go
|
|
@ -95,8 +95,14 @@ func NewMongoDBEngine(cfg *Config) *XDCxDAO.MongoDatabase {
|
|||
}
|
||||
|
||||
func New(cfg *Config) *XDCX {
|
||||
tokenDecimalCache, _ := lru.New(defaultCacheLimit)
|
||||
orderCache, _ := lru.New(tradingstate.OrderCacheLimit)
|
||||
tokenDecimalCache, err := lru.New(defaultCacheLimit)
|
||||
if err != nil {
|
||||
log.Warn("[XDCx-New] fail to create new lru for token decimal", "error", err)
|
||||
}
|
||||
orderCache, err := lru.New(tradingstate.OrderCacheLimit)
|
||||
if err != nil {
|
||||
log.Warn("[XDCx-New] fail to create new lru for order", "error", err)
|
||||
}
|
||||
XDCX := &XDCX{
|
||||
orderNonce: make(map[common.Address]*big.Int),
|
||||
Triegc: prque.New(),
|
||||
|
|
@ -121,7 +127,10 @@ func New(cfg *Config) *XDCX {
|
|||
|
||||
// Overflow returns an indication if the message queue is full.
|
||||
func (XDCx *XDCX) Overflow() bool {
|
||||
val, _ := XDCx.settings.Load(overflowIdx)
|
||||
val, ok := XDCx.settings.Load(overflowIdx)
|
||||
if !ok {
|
||||
log.Warn("[XDCx-Overflow] fail to load overflow index")
|
||||
}
|
||||
return val.(bool)
|
||||
}
|
||||
|
||||
|
|
@ -639,7 +648,7 @@ func (XDCx *XDCX) RollbackReorgTxMatch(txhash common.Hash) error {
|
|||
continue
|
||||
}
|
||||
orderCacheAtTxHash := c.(map[common.Hash]tradingstate.OrderHistoryItem)
|
||||
orderHistoryItem, _ := orderCacheAtTxHash[tradingstate.GetOrderHistoryKey(order.BaseToken, order.QuoteToken, order.Hash)]
|
||||
orderHistoryItem := orderCacheAtTxHash[tradingstate.GetOrderHistoryKey(order.BaseToken, order.QuoteToken, order.Hash)]
|
||||
if (orderHistoryItem == tradingstate.OrderHistoryItem{}) {
|
||||
log.Debug("XDCx reorg: remove order due to empty orderHistory", "order", tradingstate.ToJSON(order))
|
||||
if err := db.DeleteObject(order.Hash, &tradingstate.OrderItem{}); err != nil {
|
||||
|
|
|
|||
|
|
@ -764,7 +764,7 @@ func (l *Lending) RollbackLendingData(txhash common.Hash) error {
|
|||
continue
|
||||
}
|
||||
cacheAtTxHash := c.(map[common.Hash]lendingstate.LendingItemHistoryItem)
|
||||
lendingItemHistory, _ := cacheAtTxHash[lendingstate.GetLendingItemHistoryKey(item.LendingToken, item.CollateralToken, item.Hash)]
|
||||
lendingItemHistory := cacheAtTxHash[lendingstate.GetLendingItemHistoryKey(item.LendingToken, item.CollateralToken, item.Hash)]
|
||||
if (lendingItemHistory == lendingstate.LendingItemHistoryItem{}) {
|
||||
log.Debug("XDCxlending reorg: remove item due to empty lendingItemHistory", "item", lendingstate.ToJSON(item))
|
||||
if err := db.DeleteObject(item.Hash, &lendingstate.LendingItem{}); err != nil {
|
||||
|
|
@ -797,7 +797,7 @@ func (l *Lending) RollbackLendingData(txhash common.Hash) error {
|
|||
continue
|
||||
}
|
||||
cacheAtTxHash := c.(map[common.Hash]lendingstate.LendingTradeHistoryItem)
|
||||
lendingTradeHistoryItem, _ := cacheAtTxHash[trade.Hash]
|
||||
lendingTradeHistoryItem := cacheAtTxHash[trade.Hash]
|
||||
if (lendingTradeHistoryItem == lendingstate.LendingTradeHistoryItem{}) {
|
||||
log.Debug("XDCxlending reorg: remove trade due to empty LendingTradeHistory", "trade", lendingstate.ToJSON(trade))
|
||||
if err := db.DeleteObject(trade.Hash, &lendingstate.LendingTrade{}); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue