mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
core/types: maintain tx size cache in WithoutBlobTxSidecar
This commit is contained in:
parent
11f1b1f1da
commit
69fe54b2e5
1 changed files with 6 additions and 2 deletions
|
|
@ -449,14 +449,18 @@ func (tx *Transaction) BlobGasFeeCapIntCmp(other *big.Int) int {
|
|||
// WithoutBlobTxSidecar returns a copy of tx with the blob sidecar removed.
|
||||
func (tx *Transaction) WithoutBlobTxSidecar() *Transaction {
|
||||
blobtx, ok := tx.inner.(*BlobTx)
|
||||
if !ok {
|
||||
if !ok || blobtx.Sidecar == nil {
|
||||
return tx
|
||||
}
|
||||
cpy := &Transaction{
|
||||
inner: blobtx.withoutSidecar(),
|
||||
time: tx.time,
|
||||
}
|
||||
// Note: tx.size cache not carried over because the sidecar is included in size!
|
||||
if size := tx.size.Load(); size != 0 {
|
||||
// The tx had a sidecar before, so we need to subtract it from the size.
|
||||
scSize := rlp.ListSize(blobtx.Sidecar.encodedSize())
|
||||
cpy.size.Store(size - scSize)
|
||||
}
|
||||
if h := tx.hash.Load(); h != nil {
|
||||
cpy.hash.Store(h)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue