diff --git a/cmd/gc/main.go b/cmd/gc/main.go index d0532e3f0d..4d1ba3a141 100644 --- a/cmd/gc/main.go +++ b/cmd/gc/main.go @@ -12,6 +12,7 @@ import ( "github.com/XinFinOrg/XDPoSChain/cmd/utils" "github.com/XinFinOrg/XDPoSChain/common" + "github.com/XinFinOrg/XDPoSChain/common/lru" "github.com/XinFinOrg/XDPoSChain/core" "github.com/XinFinOrg/XDPoSChain/core/rawdb" "github.com/XinFinOrg/XDPoSChain/core/state" @@ -20,7 +21,6 @@ import ( "github.com/XinFinOrg/XDPoSChain/ethdb/leveldb" "github.com/XinFinOrg/XDPoSChain/rlp" "github.com/XinFinOrg/XDPoSChain/trie" - "github.com/XinFinOrg/XDPoSChain/common/lru" ) var ( @@ -170,7 +170,7 @@ func getAllChilds(n StateNode, db *leveldb.Database) ([17]*StateNode, error) { } if err == nil { childs[i] = &StateNode{node: childNode, path: append(n.path, byte(i))} - } else if err != nil { + } else { _, ok := err.(*trie.MissingNodeError) if !ok { return childs, err @@ -187,7 +187,7 @@ func getAllChilds(n StateNode, db *leveldb.Database) ([17]*StateNode, error) { } if err == nil { childs[0] = &StateNode{node: childNode, path: append(n.path, node.Key...)} - } else if err != nil { + } else { _, ok := err.(*trie.MissingNodeError) if !ok { return childs, err diff --git a/core/blockchain.go b/core/blockchain.go index 8d9dbf573d..48a7e69b5e 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1659,7 +1659,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, [] } } //check - if tradingState != nil && tradingService != nil { + if tradingState != nil { gotRoot := tradingState.IntermediateRoot() expectRoot, _ := tradingService.GetTradingStateRoot(block, author) parentRoot, _ := tradingService.GetTradingStateRoot(parent, parentAuthor) @@ -1938,7 +1938,7 @@ func (bc *BlockChain) getResultBlock(block *types.Block, verifiedM2 bool) (*Resu } } } - if tradingState != nil && tradingService != nil { + if tradingState != nil { gotRoot := tradingState.IntermediateRoot() expectRoot, _ := tradingService.GetTradingStateRoot(block, author) parentRoot, _ := tradingService.GetTradingStateRoot(parent, parentAuthor) diff --git a/eth/handler.go b/eth/handler.go index 913d7f07b3..5cdb4876a8 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -285,9 +285,7 @@ func (pm *ProtocolManager) removePeer(id string) { log.Debug("Peer removal failed", "peer", id, "err", err) } // Hard disconnect at the networking layer - if peer != nil { - peer.Peer.Disconnect(p2p.DiscUselessPeer) - } + peer.Peer.Disconnect(p2p.DiscUselessPeer) } func (pm *ProtocolManager) Start(maxPeers int) {