aboutsummaryrefslogtreecommitdiffstats
path: root/core/test
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2019-01-11 12:58:30 +0800
committerGitHub <noreply@github.com>2019-01-11 12:58:30 +0800
commit809e8def862fdfa792061a448f952747f1af4d3c (patch)
treebd038971e65a09bc9bb399f03a37b194ce67ae3c /core/test
parentfa25817354d5b7d40f5911004232392acfe7fe53 (diff)
downloadtangerine-consensus-809e8def862fdfa792061a448f952747f1af4d3c.tar.gz
tangerine-consensus-809e8def862fdfa792061a448f952747f1af4d3c.tar.zst
tangerine-consensus-809e8def862fdfa792061a448f952747f1af4d3c.zip
syncer: fix issues when switching to core.Consensus (#418)
- when confirmed blocks passed to core.Consensus aren't continuous in position in some chain, the pulling would skip those missing blocks. - fix: when some block is missing, avoid adding it and all blocks after it to core.Consensus. - we need to avoid the receive channel of network module full. - fix: during switching to core.Consensus, we need to launch a dummy receiver to receive from receive channel of network module. - fix: between the period during core.Consensus created and before running, a dummy receiver is also required to receive from receive channel of network module.
Diffstat (limited to 'core/test')
-rw-r--r--core/test/utils.go19
1 files changed, 0 insertions, 19 deletions
diff --git a/core/test/utils.go b/core/test/utils.go
index d85395b..a2819ae 100644
--- a/core/test/utils.go
+++ b/core/test/utils.go
@@ -18,7 +18,6 @@
package test
import (
- "context"
"errors"
"fmt"
"math"
@@ -227,24 +226,6 @@ func VerifyDB(db db.Database) error {
return nil
}
-// LaunchDummyReceiver launches a go routine to receive and drop messages from
-// a network module. An optional context could be passed to stop the go routine.
-func LaunchDummyReceiver(
- ctx context.Context, networkModule *Network) context.CancelFunc {
- dummyCtx, dummyCancel := context.WithCancel(ctx)
- go func() {
- loop:
- for {
- select {
- case <-dummyCtx.Done():
- break loop
- case <-networkModule.ReceiveChan():
- }
- }
- }()
- return dummyCancel
-}
-
func getComplementSet(
all, set map[types.NodeID]struct{}) map[types.NodeID]struct{} {
complement := make(map[types.NodeID]struct{})