Skip to content

Commit

Permalink
[R4R]fix: resolve the concurrent cache read and write issue for fast …
Browse files Browse the repository at this point in the history
…node (#1009)

* fix cache read and write concurrency issue of empty block

Signed-off-by: cryyl <yl.on.the.way@gmail.com>

* fix: limit the size of chainHeadChanSize

Co-authored-by: zjubfd <296179868@qq.com>
  • Loading branch information
kyrie-yl and unclezoro authored Jul 22, 2022
1 parent 21c4ece commit 015c527
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions core/remote_state_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,9 @@ func (vm *remoteVerifyManager) cacheBlockVerified(hash common.Hash) {
func (vm *remoteVerifyManager) AncestorVerified(header *types.Header) bool {
// find header of H-11 block.
header = vm.bc.GetHeaderByNumber(header.Number.Uint64() - maxForkHeight)
// If start from genesis block, there has not a H-11 block.
if header == nil {
// If start from genesis block, there has not a H-11 block,return true.
// Either if the block is an empty block, return true.
if header == nil || header.TxHash == types.EmptyRootHash {
return true
}

Expand Down
2 changes: 1 addition & 1 deletion core/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (

const (
// chainHeadChanSize is the size of channel listening to ChainHeadEvent.
chainHeadChanSize = 10
chainHeadChanSize = 9

// txSlotSize is used to calculate how many data slots a single transaction
// takes up based on its size. The slots are used as DoS protection, ensuring
Expand Down

0 comments on commit 015c527

Please sign in to comment.