mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
miner: use pendingFeeRecipient instead of etherbase
This commit is contained in:
parent
2bd5c5fcc9
commit
4cf7e955cd
7 changed files with 18 additions and 17 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ func newTester(t *testing.T, confOverride func(*ethconfig.Config)) *tester {
|
|||
ethConf := ðconfig.Config{
|
||||
Genesis: core.DeveloperGenesisBlock(11_500_000, nil),
|
||||
Miner: miner.Config{
|
||||
Etherbase: common.HexToAddress(testAddress),
|
||||
PendingFeeRecipient: common.HexToAddress(testAddress),
|
||||
},
|
||||
}
|
||||
if confOverride != nil {
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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 := ðconfig.Config{Genesis: genesis, SyncMode: downloader.FullSync, TrieTimeout: time.Minute, TrieDirtyCache: 256, TrieCleanCache: 256, Miner: mcfg}
|
||||
ethservice, err := eth.New(n, ethcfg)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ var (
|
|||
newTxs []*types.Transaction
|
||||
|
||||
testConfig = Config{
|
||||
Etherbase: testBankAddress,
|
||||
PendingFeeRecipient: testBankAddress,
|
||||
Recommit: time.Second,
|
||||
GasCeil: params.GenesisGasLimit,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue