aboutsummaryrefslogtreecommitdiffstats
path: root/core/test
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-09-25 18:52:35 +0800
committermissionliao <38416648+missionliao@users.noreply.github.com>2018-09-25 18:52:35 +0800
commit0ffea9dadcfc0d8a740942a2d666eccc00613cd4 (patch)
tree7984fd6c5a58abc96b1a808efb89806d48612299 /core/test
parentd844c339a128322dff180a6ccc6e6b241e917546 (diff)
downloaddexon-consensus-0ffea9dadcfc0d8a740942a2d666eccc00613cd4.tar
dexon-consensus-0ffea9dadcfc0d8a740942a2d666eccc00613cd4.tar.gz
dexon-consensus-0ffea9dadcfc0d8a740942a2d666eccc00613cd4.tar.bz2
dexon-consensus-0ffea9dadcfc0d8a740942a2d666eccc00613cd4.tar.lz
dexon-consensus-0ffea9dadcfc0d8a740942a2d666eccc00613cd4.tar.xz
dexon-consensus-0ffea9dadcfc0d8a740942a2d666eccc00613cd4.tar.zst
dexon-consensus-0ffea9dadcfc0d8a740942a2d666eccc00613cd4.zip
core: update governance interface to consider genesis state (#136)
Diffstat (limited to 'core/test')
-rw-r--r--core/test/app.go2
-rw-r--r--core/test/governance.go17
-rw-r--r--core/test/tcp-transport.go4
-rw-r--r--core/test/transport_test.go2
4 files changed, 13 insertions, 12 deletions
diff --git a/core/test/app.go b/core/test/app.go
index cc2bbe6..4cac36c 100644
--- a/core/test/app.go
+++ b/core/test/app.go
@@ -110,7 +110,7 @@ func (app *App) PreparePayload(position types.Position) []byte {
}
// VerifyPayload implements Application.
-func (app *App) VerifyPayload(payloads []byte) bool {
+func (app *App) VerifyPayload(payload []byte) bool {
return true
}
diff --git a/core/test/governance.go b/core/test/governance.go
index e486afe..0bcb39a 100644
--- a/core/test/governance.go
+++ b/core/test/governance.go
@@ -67,7 +67,8 @@ func NewGovernance(nodeCount int, lambda time.Duration) (
// GetNotarySet implements Governance interface to return current
// notary set.
-func (g *Governance) GetNotarySet() (ret map[types.NodeID]struct{}) {
+func (g *Governance) GetNotarySet(blockHeight uint64) (
+ ret map[types.NodeID]struct{}) {
// Return a cloned map.
ret = make(map[types.NodeID]struct{})
for k := range g.notarySet {
@@ -79,13 +80,13 @@ func (g *Governance) GetNotarySet() (ret map[types.NodeID]struct{}) {
// GetConfiguration returns the configuration at a given block height.
func (g *Governance) GetConfiguration(blockHeight uint64) *types.Config {
return &types.Config{
- NumShards: 1,
- NumChains: uint32(len(g.notarySet)),
- GenesisCRS: "__ DEXON",
- LambdaBA: g.lambdaBA,
- LambdaDKG: g.lambdaDKG,
- K: 0,
- PhiRatio: 0.667,
+ CRS: []byte("__ DEXON"),
+ NumShards: 1,
+ NumChains: uint32(len(g.notarySet)),
+ LambdaBA: g.lambdaBA,
+ LambdaDKG: g.lambdaDKG,
+ K: 0,
+ PhiRatio: 0.667,
}
}
diff --git a/core/test/tcp-transport.go b/core/test/tcp-transport.go
index 8bbaf9c..0f9bd73 100644
--- a/core/test/tcp-transport.go
+++ b/core/test/tcp-transport.go
@@ -447,7 +447,7 @@ func (t *TCPTransportClient) Join(
conn string
)
for {
- addr = net.JoinHostPort("0.0.0.0", strconv.Itoa(t.localPort))
+ addr = net.JoinHostPort("127.0.0.1", strconv.Itoa(t.localPort))
ln, err = net.Listen("tcp", addr)
if err == nil {
break
@@ -564,7 +564,7 @@ func (t *TCPTransportServer) Host() (chan *TransportEnvelope, error) {
// if we can listen on the pre-defiend part, we don't have to
// retry with other random ports.
ln, err := net.Listen(
- "tcp", net.JoinHostPort("0.0.0.0", strconv.Itoa(t.localPort)))
+ "tcp", net.JoinHostPort("127.0.0.1", strconv.Itoa(t.localPort)))
if err != nil {
return nil, err
}
diff --git a/core/test/transport_test.go b/core/test/transport_test.go
index 1d4b53d..4d71fc8 100644
--- a/core/test/transport_test.go
+++ b/core/test/transport_test.go
@@ -242,7 +242,7 @@ func (s *TransportTestSuite) TestTCPLocal() {
wg sync.WaitGroup
latency = &FixedLatencyModel{Latency: 300}
serverPort = 8080
- serverAddr = net.JoinHostPort("0.0.0.0", strconv.Itoa(serverPort))
+ serverAddr = net.JoinHostPort("127.0.0.1", strconv.Itoa(serverPort))
server = &testPeerServer{
trans: NewTCPTransportServer(&testMarshaller{}, serverPort)}
)