"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"
)
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
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) {}