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)
|
Fatalf("-%s: invalid pending block producer address %q", MinerPendingFeeRecipientFlag.Name, addr)
|
||||||
return
|
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.
|
// 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.
|
// Figure out the dev account address.
|
||||||
// setEtherbase has been called above, configuring the miner address from command line flags.
|
// setEtherbase has been called above, configuring the miner address from command line flags.
|
||||||
if cfg.Miner.Etherbase != (common.Address{}) {
|
if cfg.Miner.PendingFeeRecipient != (common.Address{}) {
|
||||||
developer = accounts.Account{Address: cfg.Miner.Etherbase}
|
developer = accounts.Account{Address: cfg.Miner.PendingFeeRecipient}
|
||||||
} else if accs := ks.Accounts(); len(accs) > 0 {
|
} else if accs := ks.Accounts(); len(accs) > 0 {
|
||||||
developer = ks.Accounts()[0]
|
developer = ks.Accounts()[0]
|
||||||
} else {
|
} 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
|
// Make sure the address is configured as fee recipient, otherwise
|
||||||
// the miner will fail to start.
|
// the miner will fail to start.
|
||||||
cfg.Miner.Etherbase = developer.Address
|
cfg.Miner.PendingFeeRecipient = developer.Address
|
||||||
|
|
||||||
if err := ks.Unlock(developer, passphrase); err != nil {
|
if err := ks.Unlock(developer, passphrase); err != nil {
|
||||||
Fatalf("Failed to unlock developer account: %v", err)
|
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{
|
ethConf := ðconfig.Config{
|
||||||
Genesis: core.DeveloperGenesisBlock(11_500_000, nil),
|
Genesis: core.DeveloperGenesisBlock(11_500_000, nil),
|
||||||
Miner: miner.Config{
|
Miner: miner.Config{
|
||||||
Etherbase: common.HexToAddress(testAddress),
|
PendingFeeRecipient: common.HexToAddress(testAddress),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if confOverride != nil {
|
if confOverride != nil {
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
closeBloomHandler: make(chan struct{}),
|
closeBloomHandler: make(chan struct{}),
|
||||||
networkID: networkID,
|
networkID: networkID,
|
||||||
gasPrice: config.Miner.GasPrice,
|
gasPrice: config.Miner.GasPrice,
|
||||||
etherbase: config.Miner.Etherbase,
|
etherbase: config.Miner.PendingFeeRecipient,
|
||||||
bloomRequests: make(chan chan *bloombits.Retrieval),
|
bloomRequests: make(chan chan *bloombits.Retrieval),
|
||||||
bloomIndexer: core.NewBloomIndexer(chainDb, params.BloomBitsBlocks, params.BloomConfirms),
|
bloomIndexer: core.NewBloomIndexer(chainDb, params.BloomBitsBlocks, params.BloomConfirms),
|
||||||
p2pServer: stack.Server(),
|
p2pServer: stack.Server(),
|
||||||
|
|
|
||||||
|
|
@ -448,7 +448,7 @@ func startEthService(t *testing.T, genesis *core.Genesis, blocks []*types.Block)
|
||||||
}
|
}
|
||||||
|
|
||||||
mcfg := miner.DefaultConfig
|
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}
|
ethcfg := ðconfig.Config{Genesis: genesis, SyncMode: downloader.FullSync, TrieTimeout: time.Minute, TrieDirtyCache: 256, TrieCleanCache: 256, Miner: mcfg}
|
||||||
ethservice, err := eth.New(n, ethcfg)
|
ethservice, err := eth.New(n, ethcfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,12 @@ type Backend interface {
|
||||||
|
|
||||||
// Config is the configuration parameters of mining.
|
// Config is the configuration parameters of mining.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Etherbase common.Address `toml:",omitempty"` // Public address for block mining rewards
|
Etherbase common.Address `toml:"-"` // Deprecated
|
||||||
ExtraData hexutil.Bytes `toml:",omitempty"` // Block extra data set by the miner
|
PendingFeeRecipient common.Address `toml:"-"` // Address for pending block rewards.
|
||||||
GasCeil uint64 // Target gas ceiling for mined blocks.
|
ExtraData hexutil.Bytes `toml:",omitempty"` // Block extra data set by the miner
|
||||||
GasPrice *big.Int // Minimum gas price for mining a transaction
|
GasCeil uint64 // Target gas ceiling for mined blocks.
|
||||||
Recommit time.Duration // The time interval for miner to re-create mining work.
|
GasPrice *big.Int // Minimum gas price for mining a transaction
|
||||||
|
Recommit time.Duration // The time interval for miner to re-create mining work.
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultConfig contains default settings for miner.
|
// DefaultConfig contains default settings for miner.
|
||||||
|
|
@ -132,7 +133,7 @@ func (miner *Miner) BuildPayload(args *BuildPayloadArgs) (*Payload, error) {
|
||||||
// The result might be nil if pending generation is failed.
|
// The result might be nil if pending generation is failed.
|
||||||
func (miner *Miner) getPending() *newPayloadResult {
|
func (miner *Miner) getPending() *newPayloadResult {
|
||||||
miner.confMu.RLock()
|
miner.confMu.RLock()
|
||||||
coinbase := miner.config.Etherbase
|
coinbase := miner.config.PendingFeeRecipient
|
||||||
miner.confMu.RUnlock()
|
miner.confMu.RUnlock()
|
||||||
|
|
||||||
header := miner.chain.CurrentHeader()
|
header := miner.chain.CurrentHeader()
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ func minerTestGenesisBlock(period uint64, gasLimit uint64, faucet common.Address
|
||||||
func createMiner(t *testing.T) *Miner {
|
func createMiner(t *testing.T) *Miner {
|
||||||
// Create Ethash config
|
// Create Ethash config
|
||||||
config := Config{
|
config := Config{
|
||||||
Etherbase: common.HexToAddress("123456789"),
|
PendingFeeRecipient: common.HexToAddress("123456789"),
|
||||||
}
|
}
|
||||||
// Create chainConfig
|
// Create chainConfig
|
||||||
chainDB := rawdb.NewMemoryDatabase()
|
chainDB := rawdb.NewMemoryDatabase()
|
||||||
|
|
|
||||||
|
|
@ -58,9 +58,9 @@ var (
|
||||||
newTxs []*types.Transaction
|
newTxs []*types.Transaction
|
||||||
|
|
||||||
testConfig = Config{
|
testConfig = Config{
|
||||||
Etherbase: testBankAddress,
|
PendingFeeRecipient: testBankAddress,
|
||||||
Recommit: time.Second,
|
Recommit: time.Second,
|
||||||
GasCeil: params.GenesisGasLimit,
|
GasCeil: params.GenesisGasLimit,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue