miner: use pendingFeeRecipient instead of etherbase

This commit is contained in:
Marius van der Wijden 2024-03-06 12:15:39 +01:00
parent 2bd5c5fcc9
commit 4cf7e955cd
7 changed files with 18 additions and 17 deletions

View file

@ -1273,7 +1273,7 @@ func setEtherbase(ctx *cli.Context, cfg *ethconfig.Config) {
Fatalf("-%s: invalid pending block producer address %q", MinerPendingFeeRecipientFlag.Name, addr)
return
}
cfg.Miner.Etherbase = common.BytesToAddress(b)
cfg.Miner.PendingFeeRecipient = common.BytesToAddress(b)
}
// MakePasswordList reads password lines from the file specified by the global --password flag.
@ -1783,8 +1783,8 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
// Figure out the dev account address.
// setEtherbase has been called above, configuring the miner address from command line flags.
if cfg.Miner.Etherbase != (common.Address{}) {
developer = accounts.Account{Address: cfg.Miner.Etherbase}
if cfg.Miner.PendingFeeRecipient != (common.Address{}) {
developer = accounts.Account{Address: cfg.Miner.PendingFeeRecipient}
} else if accs := ks.Accounts(); len(accs) > 0 {
developer = ks.Accounts()[0]
} else {
@ -1795,7 +1795,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
}
// Make sure the address is configured as fee recipient, otherwise
// the miner will fail to start.
cfg.Miner.Etherbase = developer.Address
cfg.Miner.PendingFeeRecipient = developer.Address
if err := ks.Unlock(developer, passphrase); err != nil {
Fatalf("Failed to unlock developer account: %v", err)

View file

@ -96,7 +96,7 @@ func newTester(t *testing.T, confOverride func(*ethconfig.Config)) *tester {
ethConf := &ethconfig.Config{
Genesis: core.DeveloperGenesisBlock(11_500_000, nil),
Miner: miner.Config{
Etherbase: common.HexToAddress(testAddress),
PendingFeeRecipient: common.HexToAddress(testAddress),
},
}
if confOverride != nil {

View file

@ -165,7 +165,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
closeBloomHandler: make(chan struct{}),
networkID: networkID,
gasPrice: config.Miner.GasPrice,
etherbase: config.Miner.Etherbase,
etherbase: config.Miner.PendingFeeRecipient,
bloomRequests: make(chan chan *bloombits.Retrieval),
bloomIndexer: core.NewBloomIndexer(chainDb, params.BloomBitsBlocks, params.BloomConfirms),
p2pServer: stack.Server(),

View file

@ -448,7 +448,7 @@ func startEthService(t *testing.T, genesis *core.Genesis, blocks []*types.Block)
}
mcfg := miner.DefaultConfig
mcfg.Etherbase = testAddr
mcfg.PendingFeeRecipient = testAddr
ethcfg := &ethconfig.Config{Genesis: genesis, SyncMode: downloader.FullSync, TrieTimeout: time.Minute, TrieDirtyCache: 256, TrieCleanCache: 256, Miner: mcfg}
ethservice, err := eth.New(n, ethcfg)
if err != nil {

View file

@ -42,7 +42,8 @@ type Backend interface {
// Config is the configuration parameters of mining.
type Config struct {
Etherbase common.Address `toml:",omitempty"` // Public address for block mining rewards
Etherbase common.Address `toml:"-"` // Deprecated
PendingFeeRecipient common.Address `toml:"-"` // Address for pending block rewards.
ExtraData hexutil.Bytes `toml:",omitempty"` // Block extra data set by the miner
GasCeil uint64 // Target gas ceiling for mined blocks.
GasPrice *big.Int // Minimum gas price for mining a transaction
@ -132,7 +133,7 @@ func (miner *Miner) BuildPayload(args *BuildPayloadArgs) (*Payload, error) {
// The result might be nil if pending generation is failed.
func (miner *Miner) getPending() *newPayloadResult {
miner.confMu.RLock()
coinbase := miner.config.Etherbase
coinbase := miner.config.PendingFeeRecipient
miner.confMu.RUnlock()
header := miner.chain.CurrentHeader()

View file

@ -139,7 +139,7 @@ func minerTestGenesisBlock(period uint64, gasLimit uint64, faucet common.Address
func createMiner(t *testing.T) *Miner {
// Create Ethash config
config := Config{
Etherbase: common.HexToAddress("123456789"),
PendingFeeRecipient: common.HexToAddress("123456789"),
}
// Create chainConfig
chainDB := rawdb.NewMemoryDatabase()

View file

@ -58,7 +58,7 @@ var (
newTxs []*types.Transaction
testConfig = Config{
Etherbase: testBankAddress,
PendingFeeRecipient: testBankAddress,
Recommit: time.Second,
GasCeil: params.GenesisGasLimit,
}