@@ -135,13 +135,13 @@ type blobTxMeta struct {
135135// newBlobTxMeta retrieves the indexed metadata fields from a blob transaction
136136// and assembles a helper struct to track in memory.
137137// Requires the transaction to have a sidecar (or that we introduce a special version tag for no-sidecar).
138- func newBlobTxMeta (id uint64 , size uint64 , storageSize uint32 , tx * types.Transaction ) * blobTxMeta {
138+ func newBlobTxMeta (id uint64 , size uint64 , storageSize uint32 , tx * types.Transaction , hash common. Hash ) * blobTxMeta {
139139 if tx .BlobTxSidecar () == nil {
140140 // This should never happen, as the pool only admits blob transactions with a sidecar
141141 panic ("missing blob tx sidecar" )
142142 }
143143 meta := & blobTxMeta {
144- hash : tx . Hash () ,
144+ hash : hash ,
145145 vhashes : tx .BlobHashes (),
146146 version : tx .BlobTxSidecar ().Version ,
147147 id : id ,
@@ -518,25 +518,26 @@ func (p *BlobPool) parseTransaction(id uint64, size uint32, blob []byte) error {
518518 log .Error ("Failed to decode blob pool entry" , "id" , id , "err" , err )
519519 return err
520520 }
521+ hash := tx .Hash ()
521522 if tx .BlobTxSidecar () == nil {
522- log .Error ("Missing sidecar in blob pool entry" , "id" , id , "hash" , tx . Hash () )
523+ log .Error ("Missing sidecar in blob pool entry" , "id" , id , "hash" , hash )
523524 return errors .New ("missing blob sidecar" )
524525 }
525526
526- meta := newBlobTxMeta (id , tx .Size (), size , tx )
527+ meta := newBlobTxMeta (id , tx .Size (), size , tx , hash )
527528 if p .lookup .exists (meta .hash ) {
528529 // This path is only possible after a crash, where deleted items are not
529530 // removed via the normal shutdown-startup procedure and thus may get
530531 // partially resurrected.
531- log .Error ("Rejecting duplicate blob pool entry" , "id" , id , "hash" , tx . Hash () )
532+ log .Error ("Rejecting duplicate blob pool entry" , "id" , id , "hash" , hash )
532533 return errors .New ("duplicate blob entry" )
533534 }
534535 sender , err := types .Sender (p .signer , tx )
535536 if err != nil {
536537 // This path is impossible unless the signature validity changes across
537538 // restarts. For that ever improbable case, recover gracefully by ignoring
538539 // this data entry.
539- log .Error ("Failed to recover blob tx sender" , "id" , id , "hash" , tx . Hash () , "err" , err )
540+ log .Error ("Failed to recover blob tx sender" , "id" , id , "hash" , hash , "err" , err )
540541 return err
541542 }
542543 if _ , ok := p .index [sender ]; ! ok {
@@ -1125,7 +1126,8 @@ func (p *BlobPool) reorg(oldHead, newHead *types.Header) (map[common.Address][]*
11251126 from , _ := types .Sender (p .signer , tx )
11261127
11271128 included [from ] = append (included [from ], tx )
1128- inclusions [tx .Hash ()] = add .NumberU64 ()
1129+ hash := tx .Hash ()
1130+ inclusions [hash ] = add .NumberU64 ()
11291131 transactors [from ] = struct {}{}
11301132 }
11311133 if add = p .chain .GetBlock (add .ParentHash (), add .NumberU64 ()- 1 ); add == nil {
@@ -1148,7 +1150,8 @@ func (p *BlobPool) reorg(oldHead, newHead *types.Header) (map[common.Address][]*
11481150 from , _ := types .Sender (p .signer , tx )
11491151
11501152 included [from ] = append (included [from ], tx )
1151- inclusions [tx .Hash ()] = add .NumberU64 ()
1153+ hash := tx .Hash ()
1154+ inclusions [hash ] = add .NumberU64 ()
11521155 transactors [from ] = struct {}{}
11531156 }
11541157 if add = p .chain .GetBlock (add .ParentHash (), add .NumberU64 ()- 1 ); add == nil {
@@ -1172,7 +1175,8 @@ func (p *BlobPool) reorg(oldHead, newHead *types.Header) (map[common.Address][]*
11721175 // Update the set that was already reincluded to track the blocks in limbo
11731176 for _ , tx := range types .TxDifference (included [addr ], discarded [addr ]) {
11741177 if p .Filter (tx ) {
1175- p .limbo .update (tx .Hash (), inclusions [tx .Hash ()])
1178+ hash := tx .Hash ()
1179+ p .limbo .update (hash , inclusions [hash ])
11761180 }
11771181 }
11781182 }
@@ -1205,31 +1209,32 @@ func (p *BlobPool) reinject(addr common.Address, txhash common.Hash) error {
12051209 // 9 legacy blob transactions are allowed in a block pre-Osaka, an adversary
12061210 // could theoretically halt a Geth node for ~1.2s by reorging per block. However,
12071211 // this attack is financially inefficient to execute.
1212+ hash := tx .Hash ()
12081213 head := p .head .Load ()
12091214 if p .chain .Config ().IsOsaka (head .Number , head .Time ) && tx .BlobTxSidecar ().Version == types .BlobSidecarVersion0 {
12101215 if err := tx .BlobTxSidecar ().ToV1 (); err != nil {
12111216 log .Error ("Failed to convert the legacy sidecar" , "err" , err )
12121217 return err
12131218 }
1214- log .Info ("Legacy blob transaction is reorged" , "hash" , tx . Hash () )
1219+ log .Info ("Legacy blob transaction is reorged" , "hash" , hash )
12151220 }
12161221 // Serialize the transaction back into the primary datastore.
12171222 blob , err := rlp .EncodeToBytes (tx )
12181223 if err != nil {
1219- log .Error ("Failed to encode transaction for storage" , "hash" , tx . Hash () , "err" , err )
1224+ log .Error ("Failed to encode transaction for storage" , "hash" , hash , "err" , err )
12201225 return err
12211226 }
12221227 id , err := p .store .Put (blob )
12231228 if err != nil {
1224- log .Error ("Failed to write transaction into storage" , "hash" , tx . Hash () , "err" , err )
1229+ log .Error ("Failed to write transaction into storage" , "hash" , hash , "err" , err )
12251230 return err
12261231 }
12271232
12281233 // Update the indices and metrics
1229- meta := newBlobTxMeta (id , tx .Size (), p .store .Size (id ), tx )
1234+ meta := newBlobTxMeta (id , tx .Size (), p .store .Size (id ), tx , hash )
12301235 if _ , ok := p .index [addr ]; ! ok {
12311236 if err := p .reserver .Hold (addr ); err != nil {
1232- log .Warn ("Failed to reserve account for blob pool" , "tx" , tx . Hash () , "from" , addr , "err" , err )
1237+ log .Warn ("Failed to reserve account for blob pool" , "tx" , hash , "from" , addr , "err" , err )
12331238 return err
12341239 }
12351240 p .index [addr ] = []* blobTxMeta {meta }
@@ -1718,9 +1723,10 @@ func (p *BlobPool) add(tx *types.Transaction) (err error) {
17181723 addtimeHist .Update (time .Since (start ).Nanoseconds ())
17191724 }(time .Now ())
17201725
1726+ hash := tx .Hash ()
17211727 // Ensure the transaction is valid from all perspectives
17221728 if err := p .validateTx (tx ); err != nil {
1723- log .Trace ("Transaction validation failed" , "hash" , tx . Hash () , "err" , err )
1729+ log .Trace ("Transaction validation failed" , "hash" , hash , "err" , err )
17241730 switch {
17251731 case errors .Is (err , txpool .ErrUnderpriced ):
17261732 addUnderpricedMeter .Mark (1 )
@@ -1765,14 +1771,14 @@ func (p *BlobPool) add(tx *types.Transaction) (err error) {
17651771 // insert it into the database and update the indices
17661772 blob , err := rlp .EncodeToBytes (tx )
17671773 if err != nil {
1768- log .Error ("Failed to encode transaction for storage" , "hash" , tx . Hash () , "err" , err )
1774+ log .Error ("Failed to encode transaction for storage" , "hash" , hash , "err" , err )
17691775 return err
17701776 }
17711777 id , err := p .store .Put (blob )
17721778 if err != nil {
17731779 return err
17741780 }
1775- meta := newBlobTxMeta (id , tx .Size (), p .store .Size (id ), tx )
1781+ meta := newBlobTxMeta (id , tx .Size (), p .store .Size (id ), tx , hash )
17761782
17771783 var (
17781784 next = p .state .GetNonce (from )
0 commit comments