mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +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/cmd/utils"
|
||||||
"github.com/XinFinOrg/XDPoSChain/common"
|
"github.com/XinFinOrg/XDPoSChain/common"
|
||||||
|
"github.com/XinFinOrg/XDPoSChain/common/lru"
|
||||||
"github.com/XinFinOrg/XDPoSChain/core"
|
"github.com/XinFinOrg/XDPoSChain/core"
|
||||||
"github.com/XinFinOrg/XDPoSChain/core/rawdb"
|
"github.com/XinFinOrg/XDPoSChain/core/rawdb"
|
||||||
"github.com/XinFinOrg/XDPoSChain/core/state"
|
"github.com/XinFinOrg/XDPoSChain/core/state"
|
||||||
|
|
@ -20,7 +21,6 @@ import (
|
||||||
"github.com/XinFinOrg/XDPoSChain/ethdb/leveldb"
|
"github.com/XinFinOrg/XDPoSChain/ethdb/leveldb"
|
||||||
"github.com/XinFinOrg/XDPoSChain/rlp"
|
"github.com/XinFinOrg/XDPoSChain/rlp"
|
||||||
"github.com/XinFinOrg/XDPoSChain/trie"
|
"github.com/XinFinOrg/XDPoSChain/trie"
|
||||||
"github.com/XinFinOrg/XDPoSChain/common/lru"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -170,7 +170,7 @@ func getAllChilds(n StateNode, db *leveldb.Database) ([17]*StateNode, error) {
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
childs[i] = &StateNode{node: childNode, path: append(n.path, byte(i))}
|
childs[i] = &StateNode{node: childNode, path: append(n.path, byte(i))}
|
||||||
} else if err != nil {
|
} else {
|
||||||
_, ok := err.(*trie.MissingNodeError)
|
_, ok := err.(*trie.MissingNodeError)
|
||||||
if !ok {
|
if !ok {
|
||||||
return childs, err
|
return childs, err
|
||||||
|
|
@ -187,7 +187,7 @@ func getAllChilds(n StateNode, db *leveldb.Database) ([17]*StateNode, error) {
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
childs[0] = &StateNode{node: childNode, path: append(n.path, node.Key...)}
|
childs[0] = &StateNode{node: childNode, path: append(n.path, node.Key...)}
|
||||||
} else if err != nil {
|
} else {
|
||||||
_, ok := err.(*trie.MissingNodeError)
|
_, ok := err.(*trie.MissingNodeError)
|
||||||
if !ok {
|
if !ok {
|
||||||
return childs, err
|
return childs, err
|
||||||
|
|
|
||||||
|
|
@ -1659,7 +1659,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//check
|
//check
|
||||||
if tradingState != nil && tradingService != nil {
|
if tradingState != nil {
|
||||||
gotRoot := tradingState.IntermediateRoot()
|
gotRoot := tradingState.IntermediateRoot()
|
||||||
expectRoot, _ := tradingService.GetTradingStateRoot(block, author)
|
expectRoot, _ := tradingService.GetTradingStateRoot(block, author)
|
||||||
parentRoot, _ := tradingService.GetTradingStateRoot(parent, parentAuthor)
|
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()
|
gotRoot := tradingState.IntermediateRoot()
|
||||||
expectRoot, _ := tradingService.GetTradingStateRoot(block, author)
|
expectRoot, _ := tradingService.GetTradingStateRoot(block, author)
|
||||||
parentRoot, _ := tradingService.GetTradingStateRoot(parent, parentAuthor)
|
parentRoot, _ := tradingService.GetTradingStateRoot(parent, parentAuthor)
|
||||||
|
|
|
||||||
|
|
@ -285,10 +285,8 @@ func (pm *ProtocolManager) removePeer(id string) {
|
||||||
log.Debug("Peer removal failed", "peer", id, "err", err)
|
log.Debug("Peer removal failed", "peer", id, "err", err)
|
||||||
}
|
}
|
||||||
// Hard disconnect at the networking layer
|
// 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) {
|
func (pm *ProtocolManager) Start(maxPeers int) {
|
||||||
pm.maxPeers = maxPeers
|
pm.maxPeers = maxPeers
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue