OSDN Git Service

fix
authorHAOYUatHZ <haoyu@protonmail.com>
Thu, 6 Jun 2019 01:21:26 +0000 (09:21 +0800)
committerHAOYUatHZ <haoyu@protonmail.com>
Thu, 6 Jun 2019 01:21:26 +0000 (09:21 +0800)
federation/synchron/unconfirmed_tx_keeper.go

index 29b1b1e..ece31f9 100644 (file)
@@ -7,7 +7,7 @@ import (
        // "github.com/bytom/protocol/bc"
        // "github.com/bytom/protocol/bc/types"
        "github.com/jinzhu/gorm"
-       // log "github.com/sirupsen/logrus"
+       log "github.com/sirupsen/logrus"
 
        "github.com/vapor/federation/config"
        // "github.com/blockcenter/database"
@@ -25,5 +25,15 @@ type unconfirmedTxKeeper struct {
 }
 
 func (u *unconfirmedTxKeeper) Run() {
+       ws := service.NewWSClient(u.cfg.Upstream.WebSocket, u.processTxCh)
+       if err := ws.Connect(); err != nil {
+               log.WithField("err", err).Fatal("websocket dail fail")
+       }
 
+       defer ws.Close()
+       if err := ws.Subscribe(service.TopicNotifyNewTransactions); err != nil {
+               log.WithField("err", err).Fatal("subscribe new transaction fail")
+       }
+
+       // u.receiveTransactions()
 }