aboutsummaryrefslogtreecommitdiffstats
path: root/integration_test/utils.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-09-28 12:32:50 +0800
committerGitHub <noreply@github.com>2018-09-28 12:32:50 +0800
commit5fc0efa940c7663a33d0fc501807a2627d2cb573 (patch)
tree932ef05c2d091bdbe6bc38f0391d45993cc1f42c /integration_test/utils.go
parent189a17a6586cd30ac355bd1165c44da6a2a08569 (diff)
downloadtangerine-consensus-5fc0efa940c7663a33d0fc501807a2627d2cb573.tar.gz
tangerine-consensus-5fc0efa940c7663a33d0fc501807a2627d2cb573.tar.zst
tangerine-consensus-5fc0efa940c7663a33d0fc501807a2627d2cb573.zip
core: hide types.NodeID from full node. (#147)
* Refine core.Governance interface - Remove types.NodeID from interface declaration. - All parameter should be round based. * Add core.NodeSetCache * Agreement accepts map of nodeID directly. * test.Transport.Peers method return public keys.
Diffstat (limited to 'integration_test/utils.go')
-rw-r--r--integration_test/utils.go24
1 files changed, 7 insertions, 17 deletions
diff --git a/integration_test/utils.go b/integration_test/utils.go
index 07d41b6..3e33362 100644
--- a/integration_test/utils.go
+++ b/integration_test/utils.go
@@ -4,7 +4,6 @@ import (
"time"
"github.com/dexon-foundation/dexon-consensus-core/core/blockdb"
- "github.com/dexon-foundation/dexon-consensus-core/core/crypto"
"github.com/dexon-foundation/dexon-consensus-core/core/test"
"github.com/dexon-foundation/dexon-consensus-core/core/types"
)
@@ -18,11 +17,6 @@ func PrepareNodes(
nodes map[types.NodeID]*Node,
err error) {
- var (
- db blockdb.BlockDatabase
- key crypto.PrivateKey
- )
-
apps = make(map[types.NodeID]*test.App)
dbs = make(map[types.NodeID]blockdb.BlockDatabase)
nodes = make(map[types.NodeID]*Node)
@@ -31,25 +25,21 @@ func PrepareNodes(
if err != nil {
return
}
- for nID := range gov.GetNodeSet(0) {
+ for _, prvKey := range gov.GetPrivateKeys() {
+ nID := types.NewNodeID(prvKey.PublicKey())
apps[nID] = test.NewApp()
-
- if db, err = blockdb.NewMemBackedBlockDB(); err != nil {
- return
- }
- dbs[nID] = db
- }
- for nID := range gov.GetNodeSet(0) {
- if key, err = gov.GetPrivateKey(nID); err != nil {
+ dbs[nID], err = blockdb.NewMemBackedBlockDB()
+ if err != nil {
return
}
nodes[nID] = NewNode(
apps[nID],
gov,
dbs[nID],
- key,
+ prvKey,
networkLatency,
- proposingLatency)
+ proposingLatency,
+ )
}
return
}