OSDN Git Service

add
authorHAOYUatHZ <haoyu@protonmail.com>
Sat, 15 Jun 2019 03:06:47 +0000 (11:06 +0800)
committerHAOYUatHZ <haoyu@protonmail.com>
Sat, 15 Jun 2019 03:06:47 +0000 (11:06 +0800)
cmd/fedd/main.go
federation/synchron/mainchain_keeper.go
federation/synchron/sidechain_keeper.go

index f59557d..4130488 100644 (file)
@@ -20,8 +20,8 @@ func main() {
        }
 
        txCh := make(chan *orm.CrossTransaction)
-       go synchron.NewMainchainKeeper(db, &cfg.Mainchain).Run()
-       go synchron.NewSidechainKeeper(db, &cfg.Sidechain).Run()
+       go synchron.NewMainchainKeeper(db, &cfg.Mainchain, txCh).Run()
+       go synchron.NewSidechainKeeper(db, &cfg.Sidechain, txCh).Run()
        go federation.NewWarder(txCh).Run()
 
        // keep the main func running in case of terminating goroutines
index 50f7a03..e0cfc93 100644 (file)
@@ -31,15 +31,17 @@ type mainchainKeeper struct {
        node       *service.Node
        chainName  string
        assetCache *database.AssetCache
+       txCh       chan *orm.CrossTransaction
 }
 
-func NewMainchainKeeper(db *gorm.DB, chainCfg *config.Chain) *mainchainKeeper {
+func NewMainchainKeeper(db *gorm.DB, chainCfg *config.Chain, txCh chan *orm.CrossTransaction) *mainchainKeeper {
        return &mainchainKeeper{
                cfg:        chainCfg,
                db:         db,
                node:       service.NewNode(chainCfg.Upstream),
                chainName:  chainCfg.Name,
                assetCache: database.NewAssetCache(),
+               txCh:       txCh,
        }
 }
 
index fed458e..5da38bc 100644 (file)
@@ -26,15 +26,17 @@ type sidechainKeeper struct {
        node       *service.Node
        chainName  string
        assetCache *database.AssetCache
+       txCh       chan *orm.CrossTransaction
 }
 
-func NewSidechainKeeper(db *gorm.DB, chainCfg *config.Chain) *sidechainKeeper {
+func NewSidechainKeeper(db *gorm.DB, chainCfg *config.Chain, txCh chan *orm.CrossTransaction) *sidechainKeeper {
        return &sidechainKeeper{
                cfg:        chainCfg,
                db:         db,
                node:       service.NewNode(chainCfg.Upstream),
                chainName:  chainCfg.Name,
                assetCache: database.NewAssetCache(),
+               txCh:       txCh,
        }
 }