diff options
author | Mission Liao <mission.liao@dexon.org> | 2018-10-24 17:50:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-24 17:50:09 +0800 |
commit | dbee0586b0a565ae9a31a3c2d967f5c2af76f60d (patch) | |
tree | cdfaef7754aedfda8d02c7023364a645e391e59e /core/test/utils.go | |
parent | f90c15fcfa575e138355a449c49cd784ba54db17 (diff) | |
download | dexon-consensus-dbee0586b0a565ae9a31a3c2d967f5c2af76f60d.tar dexon-consensus-dbee0586b0a565ae9a31a3c2d967f5c2af76f60d.tar.gz dexon-consensus-dbee0586b0a565ae9a31a3c2d967f5c2af76f60d.tar.bz2 dexon-consensus-dbee0586b0a565ae9a31a3c2d967f5c2af76f60d.tar.lz dexon-consensus-dbee0586b0a565ae9a31a3c2d967f5c2af76f60d.tar.xz dexon-consensus-dbee0586b0a565ae9a31a3c2d967f5c2af76f60d.tar.zst dexon-consensus-dbee0586b0a565ae9a31a3c2d967f5c2af76f60d.zip |
test: add test.State (#239)
* separate test utility and interface implementation
for test.Governance.
* add test.State.
* integrate test.State to test.Governance.
test.State is mainly used to emulate state propagation
on fullnode.
Diffstat (limited to 'core/test/utils.go')
-rw-r--r-- | core/test/utils.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/test/utils.go b/core/test/utils.go index 2fc21ce..0bb82b8 100644 --- a/core/test/utils.go +++ b/core/test/utils.go @@ -102,3 +102,17 @@ func FindMyIP() (ip string, err error) { err = fmt.Errorf("unable to find IP") return } + +// NewKeys creates private keys and corresponding public keys as slice. +func NewKeys(count int) ( + prvKeys []crypto.PrivateKey, pubKeys []crypto.PublicKey, err error) { + for i := 0; i < count; i++ { + var prvKey crypto.PrivateKey + if prvKey, err = ecdsa.NewPrivateKey(); err != nil { + return + } + prvKeys = append(prvKeys, prvKey) + pubKeys = append(pubKeys, prvKey.PublicKey()) + } + return +} |