aboutsummaryrefslogtreecommitdiffstats
path: root/dex
diff options
context:
space:
mode:
authorWei-Ning Huang <w@cobinhood.com>2018-10-12 11:08:15 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:23:38 +0800
commit20c026c744a83675872a5c9d175a672e320297b1 (patch)
treef277cd0e766294acfa9d98ddfd4979eb318d6821 /dex
parentb0a60baf22729665cc4b52cd1f0b2aa4e479f684 (diff)
downloadgo-tangerine-20c026c744a83675872a5c9d175a672e320297b1.tar
go-tangerine-20c026c744a83675872a5c9d175a672e320297b1.tar.gz
go-tangerine-20c026c744a83675872a5c9d175a672e320297b1.tar.bz2
go-tangerine-20c026c744a83675872a5c9d175a672e320297b1.tar.lz
go-tangerine-20c026c744a83675872a5c9d175a672e320297b1.tar.xz
go-tangerine-20c026c744a83675872a5c9d175a672e320297b1.tar.zst
go-tangerine-20c026c744a83675872a5c9d175a672e320297b1.zip
dex: update application interface
Diffstat (limited to 'dex')
-rw-r--r--dex/app.go47
1 files changed, 27 insertions, 20 deletions
diff --git a/dex/app.go b/dex/app.go
index cdbcdbda6..b34c9f553 100644
--- a/dex/app.go
+++ b/dex/app.go
@@ -19,11 +19,13 @@ package dex
import (
"bytes"
- "github.com/dexon-foundation/dexon/core/rawdb"
"math/big"
"sync"
"time"
+ "github.com/dexon-foundation/dexon/core/rawdb"
+
+ coreCommon "github.com/dexon-foundation/dexon-consensus-core/common"
coreTypes "github.com/dexon-foundation/dexon-consensus-core/core/types"
"github.com/dexon-foundation/dexon/common"
@@ -232,26 +234,31 @@ func (d *DexconApp) VerifyBlock(block *coreTypes.Block) bool {
return true
}
+func (d *DexconApp) BlockConfirmed(block coreTypes.Block) {
+}
+
// BlockDelivered is called when a block is add to the compaction chain.
-func (d *DexconApp) BlockDelivered(block coreTypes.Block) {
- var transactions types.Transactions
- err := rlp.Decode(bytes.NewReader(block.Payload), &transactions)
- if err != nil {
- return
- }
+func (d *DexconApp) BlockDelivered(blockHash coreCommon.Hash, result coreTypes.FinalizationResult) {
+ /*
+ var transactions types.Transactions
+ err := rlp.Decode(bytes.NewReader(block.Payload), &transactions)
+ if err != nil {
+ return
+ }
- _, err = d.blockchain.InsertChain(
- []*types.Block{types.NewBlock(&types.Header{
- ParentHash: common.Hash(block.ParentHash),
- Number: new(big.Int).SetUint64(block.ConsensusHeight),
- Time: new(big.Int).SetInt64(block.ConsensusTimestamp.Unix()),
- TxHash: types.DeriveSha(transactions),
- Coinbase: common.BytesToAddress(block.ProposerID.Hash[:]),
- }, transactions, nil, nil)})
- if err != nil {
- // do something
- return
- }
+ _, err = d.blockchain.InsertChain(
+ []*types.Block{types.NewBlock(&types.Header{
+ ParentHash: common.Hash(block.ParentHash),
+ Number: new(big.Int).SetUint64(result.Height),
+ Time: new(big.Int).SetInt64(result.Timestamp.Unix()),
+ TxHash: types.DeriveSha(transactions),
+ Coinbase: common.BytesToAddress(block.ProposerID.Hash[:]),
+ }, transactions, nil, nil)})
+ if err != nil {
+ // do something
+ return
+ }
- d.notify(block.ConsensusHeight)
+ d.notify(result.Height)
+ */
}