From 4e4fa3ef3049154905c4cc87cee0a12855874510 Mon Sep 17 00:00:00 2001 From: tak Date: Wed, 6 Nov 2024 12:29:35 +0800 Subject: [PATCH] respond review by ironbeer part1 --- core/blockchain.go | 5 ++++- core/txpool/blobpool/blobpool.go | 6 +----- params/config.go | 10 +++++----- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index 474709179..de0775383 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -2071,7 +2071,10 @@ func (bc *BlockChain) insertSideChain(block *types.Block, it *insertIterator) (i for i := len(hashes) - 1; i >= 0; i-- { // Append the next block to our batch block := bc.GetBlock(hashes[i], numbers[i]) - if block != nil && bc.chainConfig.IsCancun(block.Number(), block.Time()) { + if block == nil { + log.Crit("Importing heavy sidechain block is nil", "hash", hashes[i], "number", numbers[i]) + } + if bc.chainConfig.IsCancun(block.Number(), block.Time()) { block = block.WithSidecars(bc.GetSidecarsByHash(hashes[i])) } diff --git a/core/txpool/blobpool/blobpool.go b/core/txpool/blobpool/blobpool.go index 705207dbb..ac34dc4f1 100644 --- a/core/txpool/blobpool/blobpool.go +++ b/core/txpool/blobpool/blobpool.go @@ -1135,12 +1135,8 @@ func (p *BlobPool) validateTx(tx *types.Transaction) error { next = p.state.GetNonce(from) ) if uint64(len(p.index[from])) > tx.Nonce()-next { - prev := p.index[from][int(tx.Nonce()-next)] - // Ensure the transaction is different than the one tracked locally - if prev.hash == tx.Hash() { - return txpool.ErrAlreadyKnown - } // Account can support the replacement, but the price bump must also be met + prev := p.index[from][int(tx.Nonce()-next)] switch { case tx.GasFeeCapIntCmp(prev.execFeeCap.ToBig()) <= 0: return fmt.Errorf("%w: new tx gas fee cap %v <= %v queued", txpool.ErrReplaceUnderpriced, tx.GasFeeCap(), prev.execFeeCap) diff --git a/params/config.go b/params/config.go index a81cbd612..3ef4d9e8b 100644 --- a/params/config.go +++ b/params/config.go @@ -1049,7 +1049,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules chainID = new(big.Int) } // disallow setting Merge out of order - isMerge = isMerge && c.IsLondon(num) + isMerge = c.IsLondon(num) return Rules{ ChainID: new(big.Int).Set(chainID), IsHomestead: c.IsHomestead(num), @@ -1063,9 +1063,9 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules IsBerlin: c.IsBerlin(num), IsLondon: c.IsLondon(num), IsMerge: isMerge, - IsShanghai: isMerge && c.IsShanghai(num, timestamp), - IsCancun: isMerge && c.IsCancun(num, timestamp), - IsPrague: isMerge && c.IsPrague(num, timestamp), - IsVerkle: isMerge && c.IsVerkle(num, timestamp), + IsShanghai: c.IsShanghai(num, timestamp), + IsCancun: c.IsCancun(num, timestamp), + IsPrague: c.IsPrague(num, timestamp), + IsVerkle: c.IsVerkle(num, timestamp), } }