We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ec1bead commit 31a4b73Copy full SHA for 31a4b73
blockchain/process.go
@@ -137,10 +137,9 @@ func (chain *BlockChain) blockExists(hash []byte) bool {
137
if blockheader == nil || err != nil {
138
return false
139
}
140
- //block存在数据库中时,需要进一步确认是否在主链上。不在主链上返回false
141
- //因为maybeAccept会存header,但是如果还没connect执行就重启了,也不能认为存在,需要执行此区块
142
- _, err = chain.blockStore.GetBlockHashByHeight(blockheader.Height)
143
- return err == nil
+ //assert block hash(not equal for side chain)
+ storeHash, err := chain.blockStore.GetBlockHashByHeight(blockheader.Height)
+ return err == nil && bytes.Equal(storeHash, hash)
144
145
146
// 尝试接受此block
0 commit comments