From 92bb88eee90bc2e5aca19c9aedc618652f834c81 Mon Sep 17 00:00:00 2001 From: Bojie Wu Date: Tue, 9 Oct 2018 13:28:45 +0800 Subject: dex: implement dexon application interface --- consensus/dexcon/dexcon.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'consensus') diff --git a/consensus/dexcon/dexcon.go b/consensus/dexcon/dexcon.go index 9004106aa..919e920dc 100644 --- a/consensus/dexcon/dexcon.go +++ b/consensus/dexcon/dexcon.go @@ -27,6 +27,8 @@ import ( "github.com/dexon-foundation/dexon/rpc" ) +var blockReward = big.NewInt(5e+18) + // Config is the configuration for DEXON consensus. type Config struct { } @@ -99,7 +101,10 @@ 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) { - return nil, nil + state.AddBalance(header.Coinbase, blockReward) + header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number)) + + return types.NewBlock(header, txs, uncles, receipts), nil } // Seal implements consensus.Engine, attempting to create a sealed block using -- cgit v1.2.3