aboutsummaryrefslogtreecommitdiffstats
path: root/dex/backend.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2019-03-17 09:12:50 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:23 +0800
commit9493109f2be4507605e6b17e406bf8fd147ab3c8 (patch)
tree84fee3d1fb2095ff5ba793bdfccba89970bc8f89 /dex/backend.go
parent9ee92eff068b09246ab6446efa39abfc0c7bd8a8 (diff)
downloadgo-tangerine-9493109f2be4507605e6b17e406bf8fd147ab3c8.tar
go-tangerine-9493109f2be4507605e6b17e406bf8fd147ab3c8.tar.gz
go-tangerine-9493109f2be4507605e6b17e406bf8fd147ab3c8.tar.bz2
go-tangerine-9493109f2be4507605e6b17e406bf8fd147ab3c8.tar.lz
go-tangerine-9493109f2be4507605e6b17e406bf8fd147ab3c8.tar.xz
go-tangerine-9493109f2be4507605e6b17e406bf8fd147ab3c8.tar.zst
go-tangerine-9493109f2be4507605e6b17e406bf8fd147ab3c8.zip
dex: implement recovery mechanism (#258)
* dex: implement recovery mechanism The DEXON recovery protocol allows us to use the Ethereum blockchain as a fallback consensus chain to coordinate recovery. * fix
Diffstat (limited to 'dex/backend.go')
-rw-r--r--dex/backend.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/dex/backend.go b/dex/backend.go
index 056a6d221..6ee1a5fa1 100644
--- a/dex/backend.go
+++ b/dex/backend.go
@@ -21,6 +21,7 @@ import (
"fmt"
"time"
+ "github.com/dexon-foundation/dexon-consensus/core/syncer"
"github.com/dexon-foundation/dexon/accounts"
"github.com/dexon-foundation/dexon/consensus"
"github.com/dexon-foundation/dexon/consensus/dexcon"
@@ -180,7 +181,12 @@ func New(ctx *node.ServiceContext, config *Config) (*Dexon, error) {
dex.protocolManager = pm
dex.network = NewDexconNetwork(pm)
- dex.bp = NewBlockProposer(dex, dMoment)
+ recovery := NewRecovery(chainConfig.Recovery, config.RecoveryNetworkRPC,
+ dex.governance, config.PrivateKey)
+ watchCat := syncer.NewWatchCat(recovery, dex.governance, 10*time.Second,
+ time.Duration(chainConfig.Recovery.Timeout)*time.Second, log.Root())
+
+ dex.bp = NewBlockProposer(dex, watchCat, dMoment)
return dex, nil
}