mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
add block reward to clique config
This commit is contained in:
parent
16009f940c
commit
a8fb4ed8f3
3 changed files with 10 additions and 2 deletions
|
|
@ -66,11 +66,16 @@ func (w *wizard) makeGenesis() {
|
||||||
genesis.Config.Clique = ¶ms.CliqueConfig{
|
genesis.Config.Clique = ¶ms.CliqueConfig{
|
||||||
Period: 15,
|
Period: 15,
|
||||||
Epoch: 30000,
|
Epoch: 30000,
|
||||||
|
Reward: 0,
|
||||||
}
|
}
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
fmt.Println("How many seconds should blocks take? (default = 15)")
|
fmt.Println("How many seconds should blocks take? (default = 15)")
|
||||||
genesis.Config.Clique.Period = uint64(w.readDefaultInt(15))
|
genesis.Config.Clique.Period = uint64(w.readDefaultInt(15))
|
||||||
|
|
||||||
|
fmt.Println()
|
||||||
|
fmt.Println("How many Ethers should be rewarded to signer? (default = 0)")
|
||||||
|
genesis.Config.Clique.Reward = uint64(w.readDefaultInt(0))
|
||||||
|
|
||||||
// We also need the initial list of signers
|
// We also need the initial list of signers
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
fmt.Println("Which accounts are allowed to seal? (mandatory at least one)")
|
fmt.Println("Which accounts are allowed to seal? (mandatory at least one)")
|
||||||
|
|
|
||||||
|
|
@ -571,8 +571,10 @@ func (c *Clique) Prepare(chain consensus.ChainReader, header *types.Header) erro
|
||||||
// rewards given, and returns the final block.
|
// rewards given, and returns the final block.
|
||||||
func (c *Clique) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error) {
|
func (c *Clique) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error) {
|
||||||
// set block reward
|
// set block reward
|
||||||
blockReward := big.NewInt(5e+18)
|
// FIXME: unit Ether could be too plump
|
||||||
reward := new(big.Int).Set(blockReward)
|
chainReward := new(big.Int).SetUint64(chain.Config().Clique.Reward * params.Ether)
|
||||||
|
|
||||||
|
reward := new(big.Int).Set(chainReward)
|
||||||
state.AddBalance(header.Coinbase, reward)
|
state.AddBalance(header.Coinbase, reward)
|
||||||
|
|
||||||
// No block rewards in PoA, so the state remains as is and uncles are dropped
|
// No block rewards in PoA, so the state remains as is and uncles are dropped
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,7 @@ func (c *EthashConfig) String() string {
|
||||||
type CliqueConfig struct {
|
type CliqueConfig struct {
|
||||||
Period uint64 `json:"period"` // Number of seconds between blocks to enforce
|
Period uint64 `json:"period"` // Number of seconds between blocks to enforce
|
||||||
Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint
|
Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint
|
||||||
|
Reward uint64 `json:"reward"` // Block reward - unit Ether
|
||||||
}
|
}
|
||||||
|
|
||||||
// String implements the stringer interface, returning the consensus engine details.
|
// String implements the stringer interface, returning the consensus engine details.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue