}
func NewWarder(cfg *config.Config, db *gorm.DB, txCh chan *orm.CrossTransaction) *warder {
- var others []*service.Warder
- for _, warderCfg := range cfg.Warders {
- if !warderCfg.IsLocal {
- anotherWarder := service.NewWarder(&warderCfg)
- others = append(others, anotherWarder)
- }
- }
-
return &warder{
colletInterval: time.Duration(cfg.CollectMinutes) * time.Minute,
db: db,
txCh: txCh,
mainchainNode: service.NewNode(cfg.Mainchain.Upstream),
sidechainNode: service.NewNode(cfg.Sidechain.Upstream),
- others: others,
+ others: parseOtherWarders(cfg),
+ }
+}
+
+func parseOtherWarders(cfg *config.Config) []*service.Warder {
+ var others []*service.Warder
+ for _, warderCfg := range cfg.Warders {
+ if !warderCfg.IsLocal {
+ anotherWarder := service.NewWarder(&warderCfg)
+ others = append(others, anotherWarder)
+ }
}
+ return others
}
func (w *warder) Run() {