forked from cerc-io/plugeth
core: infer blobGasUsed in chain maker (#28212)
Same way that the gasUsed in header is updated when a tx is added we should update blob gas used instead of requiring caller to set it manually.
This commit is contained in:
parent
1f6e63900d
commit
0ded110b80
@ -88,11 +88,6 @@ func (b *BlockGen) SetPoS() {
|
|||||||
b.header.Difficulty = new(big.Int)
|
b.header.Difficulty = new(big.Int)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetBlobGas sets the data gas used by the blob in the generated block.
|
|
||||||
func (b *BlockGen) SetBlobGas(blobGasUsed uint64) {
|
|
||||||
b.header.BlobGasUsed = &blobGasUsed
|
|
||||||
}
|
|
||||||
|
|
||||||
// addTx adds a transaction to the generated block. If no coinbase has
|
// addTx adds a transaction to the generated block. If no coinbase has
|
||||||
// been set, the block's coinbase is set to the zero address.
|
// been set, the block's coinbase is set to the zero address.
|
||||||
//
|
//
|
||||||
@ -111,6 +106,9 @@ func (b *BlockGen) addTx(bc *BlockChain, vmConfig vm.Config, tx *types.Transacti
|
|||||||
}
|
}
|
||||||
b.txs = append(b.txs, tx)
|
b.txs = append(b.txs, tx)
|
||||||
b.receipts = append(b.receipts, receipt)
|
b.receipts = append(b.receipts, receipt)
|
||||||
|
if b.header.BlobGasUsed != nil {
|
||||||
|
*b.header.BlobGasUsed += receipt.BlobGasUsed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddTx adds a transaction to the generated block. If no coinbase has
|
// AddTx adds a transaction to the generated block. If no coinbase has
|
||||||
|
@ -1448,9 +1448,6 @@ func setupReceiptBackend(t *testing.T, genBlocks int) (*testBackend, []common.Ha
|
|||||||
b.AddTx(tx)
|
b.AddTx(tx)
|
||||||
txHashes[i] = tx.Hash()
|
txHashes[i] = tx.Hash()
|
||||||
}
|
}
|
||||||
if i == 5 {
|
|
||||||
b.SetBlobGas(params.BlobTxBlobGasPerBlob)
|
|
||||||
}
|
|
||||||
b.SetPoS()
|
b.SetPoS()
|
||||||
})
|
})
|
||||||
return backend, txHashes
|
return backend, txHashes
|
||||||
|
Loading…
Reference in New Issue
Block a user