aboutsummaryrefslogtreecommitdiffstats
path: root/consensus
diff options
context:
space:
mode:
authorBojie Wu <bojie@dexon.org>2018-10-09 13:28:45 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:49 +0800
commit9b6a659b4de7c9b1c2f331b880a1397159181600 (patch)
treea79f3da3c2fdb8bf32d20faffa2d0cc6f9424de2 /consensus
parentd7127cb517f29e727a48a588484834d7f242aadb (diff)
downloaddexon-9b6a659b4de7c9b1c2f331b880a1397159181600.tar
dexon-9b6a659b4de7c9b1c2f331b880a1397159181600.tar.gz
dexon-9b6a659b4de7c9b1c2f331b880a1397159181600.tar.bz2
dexon-9b6a659b4de7c9b1c2f331b880a1397159181600.tar.lz
dexon-9b6a659b4de7c9b1c2f331b880a1397159181600.tar.xz
dexon-9b6a659b4de7c9b1c2f331b880a1397159181600.tar.zst
dexon-9b6a659b4de7c9b1c2f331b880a1397159181600.zip
dex: implement dexon application interface
Diffstat (limited to 'consensus')
-rw-r--r--consensus/dexcon/dexcon.go7
1 files changed, 6 insertions, 1 deletions
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