OSDN Git Service

init
authorHAOYUatHZ <haoyu@protonmail.com>
Sat, 15 Jun 2019 03:02:04 +0000 (11:02 +0800)
committerHAOYUatHZ <haoyu@protonmail.com>
Sat, 15 Jun 2019 03:02:04 +0000 (11:02 +0800)
cmd/fedd/main.go
federation/warder.go

index dd4b6da..f59557d 100644 (file)
@@ -8,6 +8,7 @@ import (
        "github.com/vapor/federation"
        "github.com/vapor/federation/config"
        "github.com/vapor/federation/database"
+       "github.com/vapor/federation/database/orm"
        "github.com/vapor/federation/synchron"
 )
 
@@ -18,9 +19,10 @@ func main() {
                log.WithField("err", err).Panic("initialize mysql db error")
        }
 
+       txCh := make(chan *orm.CrossTransaction)
        go synchron.NewMainchainKeeper(db, &cfg.Mainchain).Run()
        go synchron.NewSidechainKeeper(db, &cfg.Sidechain).Run()
-       go federation.NewWarder().Run()
+       go federation.NewWarder(txCh).Run()
 
        // keep the main func running in case of terminating goroutines
        var wg sync.WaitGroup
index fa197fd..f81fbca 100644 (file)
@@ -1,11 +1,23 @@
 package federation
 
+import (
+       "github.com/vapor/federation/database/orm"
+)
+
 type warder struct {
+       txCh chan *orm.CrossTransaction
 }
 
-func NewWarder() *warder {
-       return &warder{}
+func NewWarder(txCh chan *orm.CrossTransaction) *warder {
+       return &warder{
+               txCh: txCh,
+       }
 }
 
 func (w *warder) Run() {
+       for tx := range w.txCh {
+               w.proposeDestTx(tx)
+       }
 }
+
+func (w *warder) proposeDestTx(tx *orm.CrossTransaction) {}