OSDN Git Service

Merge pull request #201 from Bytom/v0.1
[bytom/vapor.git] / cmd / fedd / main.go
diff --git a/cmd/fedd/main.go b/cmd/fedd/main.go
new file mode 100644 (file)
index 0000000..2ba8ec6
--- /dev/null
@@ -0,0 +1,27 @@
+package main
+
+import (
+       "sync"
+
+       log "github.com/sirupsen/logrus"
+
+       "github.com/vapor/federation/config"
+       "github.com/vapor/federation/database"
+       "github.com/vapor/federation/synchron"
+)
+
+func main() {
+       cfg := config.NewConfig()
+       db, err := database.NewMySQLDB(cfg.MySQLConfig)
+       if err != nil {
+               log.WithField("err", err).Panic("initialize mysql db error")
+       }
+
+       go synchron.NewMainchainKeeper(db, &cfg.Mainchain).Run()
+       go synchron.NewSidechainKeeper(db, &cfg.Sidechain).Run()
+
+       // keep the main func running in case of terminating goroutines
+       var wg sync.WaitGroup
+       wg.Add(1)
+       wg.Wait()
+}