aboutsummaryrefslogtreecommitdiffstats
path: root/consensus
diff options
context:
space:
mode:
authorBojie Wu <bojie@dexon.org>2018-10-14 11:54:17 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:49 +0800
commit79e7ea1ac0feafdc63d480009bab62f7dfaa2e66 (patch)
treea2aefa8a1bc8606b8955cd4c39544817c40f6dd9 /consensus
parent946d4fdec65f396890e65bc1905b1422055ec46d (diff)
downloaddexon-79e7ea1ac0feafdc63d480009bab62f7dfaa2e66.tar
dexon-79e7ea1ac0feafdc63d480009bab62f7dfaa2e66.tar.gz
dexon-79e7ea1ac0feafdc63d480009bab62f7dfaa2e66.tar.bz2
dexon-79e7ea1ac0feafdc63d480009bab62f7dfaa2e66.tar.lz
dexon-79e7ea1ac0feafdc63d480009bab62f7dfaa2e66.tar.xz
dexon-79e7ea1ac0feafdc63d480009bab62f7dfaa2e66.tar.zst
dexon-79e7ea1ac0feafdc63d480009bab62f7dfaa2e66.zip
app: calculate block reward according to chain num
Diffstat (limited to 'consensus')
-rw-r--r--consensus/dexcon/dexcon.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/consensus/dexcon/dexcon.go b/consensus/dexcon/dexcon.go
index 919e920dc..c3d42d599 100644
--- a/consensus/dexcon/dexcon.go
+++ b/consensus/dexcon/dexcon.go
@@ -27,8 +27,6 @@ import (
"github.com/dexon-foundation/dexon/rpc"
)
-var blockReward = big.NewInt(5e+18)
-
// Config is the configuration for DEXON consensus.
type Config struct {
}
@@ -101,7 +99,8 @@ func (d *Dexcon) 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 (d *Dexcon) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error) {
- state.AddBalance(header.Coinbase, blockReward)
+ reward := new(big.Int).Div(d.config.MiningReward, new(big.Int).SetUint64(uint64(d.config.NumChains)))
+ state.AddBalance(header.Coinbase, reward)
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
return types.NewBlock(header, txs, uncles, receipts), nil