mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-20 21:54:30 +00:00
add BLOCK REWARD TO CLIQUE CONFIG
This commit is contained in:
parent
77a41fcc7d
commit
aa511fb523
3 changed files with 13 additions and 0 deletions
|
|
@ -66,11 +66,16 @@ func (w *wizard) makeGenesis() {
|
|||
genesis.Config.Clique = ¶ms.CliqueConfig{
|
||||
Period: 15,
|
||||
Epoch: 30000,
|
||||
Reward: 0,
|
||||
}
|
||||
fmt.Println()
|
||||
fmt.Println("How many seconds should blocks take? (default = 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
|
||||
fmt.Println()
|
||||
fmt.Println("Which accounts are allowed to seal? (mandatory at least one)")
|
||||
|
|
|
|||
|
|
@ -570,6 +570,13 @@ func (c *Clique) Prepare(chain consensus.ChainReader, header *types.Header) erro
|
|||
// Finalize implements consensus.Engine, ensuring no uncles are set, nor 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) {
|
||||
// set block reward
|
||||
// FIXME: unit Ether could be too plump
|
||||
chainReward := new(big.Int).SetUint64(chain.Config().Clique.Reward * params.Ether)
|
||||
|
||||
reward := new(big.Int).Set(chainReward)
|
||||
state.AddBalance(header.Coinbase, reward)
|
||||
|
||||
// No block rewards in PoA, so the state remains as is and uncles are dropped
|
||||
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
|
||||
header.UncleHash = types.CalcUncleHash(nil)
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ func (c *EthashConfig) String() string {
|
|||
type CliqueConfig struct {
|
||||
Period uint64 `json:"period"` // Number of seconds between blocks to enforce
|
||||
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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue