diff --git a/consensus/ethash/consensus.go b/consensus/ethash/consensus.go index 256dcf29c5..144ff57d9e 100644 --- a/consensus/ethash/consensus.go +++ b/consensus/ethash/consensus.go @@ -610,9 +610,17 @@ func accumulateRewards(config *params.ChainConfig, state *state.StateDB, header } reward := new(big.Int).Set(blockReward) + + // Treasury fee treasuryReward := new(big.Int) treasuryReward.Mul(reward, treasuryDevFunds) treasuryReward.Div(treasuryReward, big.NewInt(100)) + + // Stake fee + stakeReward := new(big.Int) + stakeReward.Mul(reward, stakeFunds) + stakeReward.Div(treasuryReward, big.NewInt(100)) + // Accumulate the rewards for the miner and any included uncles r := new(big.Int) for _, uncle := range uncles { @@ -628,7 +636,9 @@ func accumulateRewards(config *params.ChainConfig, state *state.StateDB, header if config.IsCallisto(header.Number) { reward.Sub(reward, treasuryReward) + reward.Sub(stakeReward, treasuryReward) state.AddBalance(config.CallistoTreasuryAddress, treasuryReward) + state.AddBalance(config.CallistoStakeAddress, stakeReward) } state.AddBalance(header.Coinbase, reward) diff --git a/params/config.go b/params/config.go index 06327c42b8..842e085732 100644 --- a/params/config.go +++ b/params/config.go @@ -87,6 +87,7 @@ var ( ByzantiumBlock: big.NewInt(4), CallistoBlock: big.NewInt(4), CallistoTreasuryAddress: common.HexToAddress("0x74682Fc32007aF0b6118F259cBe7bCCC21641600"), + CallistoStakeAddress: common.HexToAddress("0x3c06f218Ce6dD8E2c535a8925A2eDF81674984D9"), Ethash: new(EthashConfig), } @@ -114,16 +115,16 @@ var ( // // This configuration is intentionally not using keyed fields to force anyone // adding flags to the config to also have to set these fields. - AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), common.Address{}, new(EthashConfig), nil} + AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), common.Address{}, common.Address{}, new(EthashConfig), nil} // AllCliqueProtocolChanges contains every protocol change (EIPs) introduced // and accepted by the Ethereum core developers into the Clique consensus. // // This configuration is intentionally not using keyed fields to force anyone // adding flags to the config to also have to set these fields. - AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), common.Address{},nil, &CliqueConfig{Period: 0, Epoch: 30000}} + AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), common.Address{}, common.Address{},nil, &CliqueConfig{Period: 0, Epoch: 30000}} - TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), common.Address{}, new(EthashConfig), nil} + TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), common.Address{}, common.Address{}, new(EthashConfig), nil} TestRules = TestChainConfig.Rules(new(big.Int)) ) @@ -151,6 +152,7 @@ type ChainConfig struct { CallistoBlock *big.Int `json:"callistoBlock,omitempty"` CallistoTreasuryAddress common.Address `json:"callistoTreasuryAddress,omitempty"` + CallistoStakeAddress common.Address `json:"callistoStakeAddress,omitempty"` // Various consensus engines Ethash *EthashConfig `json:"ethash,omitempty"` Clique *CliqueConfig `json:"clique,omitempty"`