Merge pull request #239 from nguyenbatam/fix_dv_validate_block_detail_before_broadcast

fix double validation : m2 validate block detail before broadcast
This commit is contained in:
Tuna 2018-10-26 10:40:06 +07:00 committed by GitHub
commit c058a3d72e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -665,8 +665,8 @@ func (f *Fetcher) insert(peer string, block *types.Block) {
return
}
}
go f.broadcastBlock(block, true)
if newBlock.Hash() == block.Hash() {
go f.broadcastBlock(block, true)
return
}
block = newBlock
@ -693,6 +693,7 @@ func (f *Fetcher) insert(peer string, block *types.Block) {
// If import succeeded, broadcast the block
propAnnounceOutTimer.UpdateSince(block.ReceivedAt)
go f.broadcastBlock(block, true)
go f.broadcastBlock(block, false)
}()