Skip to content

Commit 35a8262

Browse files
minh-bqqianhh
authored andcommitted
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.
1 parent 5fd7809 commit 35a8262

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

core/txpool/blobpool/blobpool.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ func (p *BlobPool) parseTransaction(id uint64, size uint32, blob []byte) error {
487487
log.Error("Rejecting duplicate blob pool entry", "id", id, "hash", tx.Hash())
488488
return errors.New("duplicate blob entry")
489489
}
490-
sender, err := p.signer.Sender(tx)
490+
sender, err := types.Sender(p.signer, tx)
491491
if err != nil {
492492
// This path is impossible unless the signature validity changes across
493493
// restarts. For that ever improbable case, recover gracefully by ignoring
@@ -901,7 +901,7 @@ func (p *BlobPool) reorg(oldHead, newHead *types.Header) (map[common.Address][]*
901901
// and accumulate the transactors and transactions
902902
for rem.NumberU64() > add.NumberU64() {
903903
for _, tx := range rem.Transactions() {
904-
from, _ := p.signer.Sender(tx)
904+
from, _ := types.Sender(p.signer, tx)
905905

906906
discarded[from] = append(discarded[from], tx)
907907
transactors[from] = struct{}{}
@@ -913,7 +913,7 @@ func (p *BlobPool) reorg(oldHead, newHead *types.Header) (map[common.Address][]*
913913
}
914914
for add.NumberU64() > rem.NumberU64() {
915915
for _, tx := range add.Transactions() {
916-
from, _ := p.signer.Sender(tx)
916+
from, _ := types.Sender(p.signer, tx)
917917

918918
included[from] = append(included[from], tx)
919919
inclusions[tx.Hash()] = add.NumberU64()
@@ -926,7 +926,7 @@ func (p *BlobPool) reorg(oldHead, newHead *types.Header) (map[common.Address][]*
926926
}
927927
for rem.Hash() != add.Hash() {
928928
for _, tx := range rem.Transactions() {
929-
from, _ := p.signer.Sender(tx)
929+
from, _ := types.Sender(p.signer, tx)
930930

931931
discarded[from] = append(discarded[from], tx)
932932
transactors[from] = struct{}{}
@@ -936,7 +936,7 @@ func (p *BlobPool) reorg(oldHead, newHead *types.Header) (map[common.Address][]*
936936
return nil, nil
937937
}
938938
for _, tx := range add.Transactions() {
939-
from, _ := p.signer.Sender(tx)
939+
from, _ := types.Sender(p.signer, tx)
940940

941941
included[from] = append(included[from], tx)
942942
inclusions[tx.Hash()] = add.NumberU64()
@@ -1136,7 +1136,7 @@ func (p *BlobPool) validateTx(tx *types.Transaction) error {
11361136
// If the transaction replaces an existing one, ensure that price bumps are
11371137
// adhered to.
11381138
var (
1139-
from, _ = p.signer.Sender(tx) // already validated above
1139+
from, _ = types.Sender(p.signer, tx) // already validated above
11401140
next = p.state.GetNonce(from)
11411141
)
11421142
if uint64(len(p.index[from])) > tx.Nonce()-next {

0 commit comments

Comments
 (0)