mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-05 19:43:47 +00:00
* fix(taiko_worker): fix a `maxBytesPerTxList` check issue * feat(taiko_miner): add `BuildTransactionsListsWithMinTip` method * update
70 lines
1.8 KiB
Go
70 lines
1.8 KiB
Go
package miner
|
|
|
|
import (
|
|
"math/big"
|
|
|
|
"github.com/ethereum/go-ethereum/beacon/engine"
|
|
"github.com/ethereum/go-ethereum/common"
|
|
"github.com/ethereum/go-ethereum/core/types"
|
|
)
|
|
|
|
// PreBuiltTxList is a pre-built transaction list based on the latest chain state,
|
|
// with estimated gas used / bytes.
|
|
type PreBuiltTxList struct {
|
|
TxList types.Transactions
|
|
EstimatedGasUsed uint64
|
|
BytesLength uint64
|
|
}
|
|
|
|
// SealBlockWith mines and seals a block without changing the canonical chain.
|
|
func (miner *Miner) SealBlockWith(
|
|
parent common.Hash,
|
|
timestamp uint64,
|
|
blkMeta *engine.BlockMetadata,
|
|
baseFeePerGas *big.Int,
|
|
withdrawals types.Withdrawals,
|
|
) (*types.Block, error) {
|
|
return miner.worker.sealBlockWith(parent, timestamp, blkMeta, baseFeePerGas, withdrawals)
|
|
}
|
|
|
|
// BuildTransactionsLists builds multiple transactions lists which satisfy all the given limits.
|
|
func (miner *Miner) BuildTransactionsLists(
|
|
beneficiary common.Address,
|
|
baseFee *big.Int,
|
|
blockMaxGasLimit uint64,
|
|
maxBytesPerTxList uint64,
|
|
locals []string,
|
|
maxTransactionsLists uint64,
|
|
) ([]*PreBuiltTxList, error) {
|
|
return miner.BuildTransactionsListsWithMinTip(
|
|
beneficiary,
|
|
baseFee,
|
|
blockMaxGasLimit,
|
|
maxBytesPerTxList,
|
|
locals,
|
|
maxTransactionsLists,
|
|
0,
|
|
)
|
|
}
|
|
|
|
// BuildTransactionsListsWithMinTip builds multiple transactions lists which satisfy all
|
|
// the given limits and minimum tip.
|
|
func (miner *Miner) BuildTransactionsListsWithMinTip(
|
|
beneficiary common.Address,
|
|
baseFee *big.Int,
|
|
blockMaxGasLimit uint64,
|
|
maxBytesPerTxList uint64,
|
|
locals []string,
|
|
maxTransactionsLists uint64,
|
|
minTip uint64,
|
|
) ([]*PreBuiltTxList, error) {
|
|
return miner.worker.BuildTransactionsLists(
|
|
beneficiary,
|
|
baseFee,
|
|
blockMaxGasLimit,
|
|
maxBytesPerTxList,
|
|
locals,
|
|
maxTransactionsLists,
|
|
minTip,
|
|
)
|
|
}
|