From 75445bb106e5177b59b27823c8b1653f88a5ce8f Mon Sep 17 00:00:00 2001 From: cryyl Date: Thu, 21 Jul 2022 19:24:08 +0800 Subject: [PATCH 1/2] fix cache read and write concurrency issue of empty block Signed-off-by: cryyl --- core/remote_state_verifier.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/remote_state_verifier.go b/core/remote_state_verifier.go index cb8d2366bb..bf43f6de81 100644 --- a/core/remote_state_verifier.go +++ b/core/remote_state_verifier.go @@ -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 } From 287677a4bea898c55dca9b6eb0e34f1958b9cd92 Mon Sep 17 00:00:00 2001 From: zjubfd <296179868@qq.com> Date: Fri, 22 Jul 2022 14:38:57 +0800 Subject: [PATCH 2/2] fix: limit the size of chainHeadChanSize --- core/tx_pool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tx_pool.go b/core/tx_pool.go index 12dc2799a4..21fb5e5d0c 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -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