From 0a21cb4d21a254cc87c7ecc50462f8c2735a302f Mon Sep 17 00:00:00 2001 From: minh-bq <97180373+minh-bq@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:06:10 +0700 Subject: [PATCH] core/txpool/blobpool: use types.Sender instead of signer.Sender (#30473) Use types.Sender(signer, tx) to utilize the transaction's sender cache and avoid repeated address recover. --- core/txpool/blobpool/blobpool.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/txpool/blobpool/blobpool.go b/core/txpool/blobpool/blobpool.go index 745fc08fec06..82df09a4bfc1 100644 --- a/core/txpool/blobpool/blobpool.go +++ b/core/txpool/blobpool/blobpool.go @@ -478,7 +478,7 @@ func (p *BlobPool) parseTransaction(id uint64, size uint32, blob []byte) error { log.Error("Rejecting duplicate blob pool entry", "id", id, "hash", tx.Hash()) return errors.New("duplicate blob entry") } - sender, err := p.signer.Sender(tx) + sender, err := types.Sender(p.signer, tx) if err != nil { // This path is impossible unless the signature validity changes across // restarts. For that ever improbable case, recover gracefully by ignoring @@ -892,7 +892,7 @@ func (p *BlobPool) reorg(oldHead, newHead *types.Header) (map[common.Address][]* // and accumulate the transactors and transactions for rem.NumberU64() > add.NumberU64() { for _, tx := range rem.Transactions() { - from, _ := p.signer.Sender(tx) + from, _ := types.Sender(p.signer, tx) discarded[from] = append(discarded[from], tx) transactors[from] = struct{}{} @@ -904,7 +904,7 @@ func (p *BlobPool) reorg(oldHead, newHead *types.Header) (map[common.Address][]* } for add.NumberU64() > rem.NumberU64() { for _, tx := range add.Transactions() { - from, _ := p.signer.Sender(tx) + from, _ := types.Sender(p.signer, tx) included[from] = append(included[from], tx) inclusions[tx.Hash()] = add.NumberU64() @@ -917,7 +917,7 @@ func (p *BlobPool) reorg(oldHead, newHead *types.Header) (map[common.Address][]* } for rem.Hash() != add.Hash() { for _, tx := range rem.Transactions() { - from, _ := p.signer.Sender(tx) + from, _ := types.Sender(p.signer, tx) discarded[from] = append(discarded[from], tx) transactors[from] = struct{}{} @@ -927,7 +927,7 @@ func (p *BlobPool) reorg(oldHead, newHead *types.Header) (map[common.Address][]* return nil, nil } for _, tx := range add.Transactions() { - from, _ := p.signer.Sender(tx) + from, _ := types.Sender(p.signer, tx) included[from] = append(included[from], tx) inclusions[tx.Hash()] = add.NumberU64() @@ -1127,7 +1127,7 @@ func (p *BlobPool) validateTx(tx *types.Transaction) error { // If the transaction replaces an existing one, ensure that price bumps are // adhered to. var ( - from, _ = p.signer.Sender(tx) // already validated above + from, _ = types.Sender(p.signer, tx) // already validated above next = p.state.GetNonce(from) ) if uint64(len(p.index[from])) > tx.Nonce()-next {