mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
fix tautological condition: non-nil != nil
This commit is contained in:
parent
c688f4b24c
commit
371c3b6874
3 changed files with 6 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue