go-ethereum/miner/taiko_miner.go

71 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"
"github.com/ethereum/go-ethereum/internal/ethapi"
)
// PreBuiltTxList is a pre-built transaction list based on the latest chain state,
// with estimated gas used / bytes.
type PreBuiltTxList struct {
TxList []*ethapi.RPCTransaction
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.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.buildTransactionsLists(
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.buildTransactionsLists(
beneficiary,
baseFee,
blockMaxGasLimit,
maxBytesPerTxList,
locals,
maxTransactionsLists,
minTip,
)
}