diff options
author | wmin0 <wmin0@hotmail.com> | 2019-01-04 16:28:47 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-01-04 16:28:47 +0800 |
commit | 17b96ca95ffd4cbf8af762a974fc8b18f2c1b993 (patch) | |
tree | 10df60f30c05b731e81755cfd3e4e57625b1630b /core/syncer/agreement.go | |
parent | beaef47dd5dd4b342cef3c8b26508ce3c334be06 (diff) | |
download | tangerine-consensus-17b96ca95ffd4cbf8af762a974fc8b18f2c1b993.tar.gz tangerine-consensus-17b96ca95ffd4cbf8af762a974fc8b18f2c1b993.tar.zst tangerine-consensus-17b96ca95ffd4cbf8af762a974fc8b18f2c1b993.zip |
core: syncer: safe spawn go routine (#399)
Diffstat (limited to 'core/syncer/agreement.go')
-rw-r--r-- | core/syncer/agreement.go | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/core/syncer/agreement.go b/core/syncer/agreement.go index 32ea654..08be77a 100644 --- a/core/syncer/agreement.go +++ b/core/syncer/agreement.go @@ -18,8 +18,6 @@ package syncer import ( - "sync" - "github.com/dexon-foundation/dexon-consensus/common" "github.com/dexon-foundation/dexon-consensus/core" "github.com/dexon-foundation/dexon-consensus/core/types" @@ -29,7 +27,6 @@ import ( // Struct agreement implements struct of BA (Byzantine Agreement) protocol // needed in syncer, which only receives agreement results. type agreement struct { - wg *sync.WaitGroup cache *utils.NodeSetCache inputChan chan interface{} outputChan chan<- *types.Block @@ -47,12 +44,10 @@ func newAgreement( ch chan<- *types.Block, pullChan chan<- common.Hash, cache *utils.NodeSetCache, - wg *sync.WaitGroup, logger common.Logger) *agreement { return &agreement{ cache: cache, - wg: wg, inputChan: make(chan interface{}, 1000), outputChan: ch, pullChan: pullChan, @@ -68,8 +63,6 @@ func newAgreement( // run starts the agreement, this does not start a new routine, go a new // routine explicitly in the caller. func (a *agreement) run() { - a.wg.Add(1) - defer a.wg.Done() for { select { case val, ok := <-a.inputChan: |