Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use sqlite for dht key store #287

Merged
merged 11 commits into from Mar 22, 2019
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -10,7 +10,7 @@ idminer
coverage.txt
analysisVendor.png
vendor/**/.gitignore
*.keystore
*.keystore*
node_*/
kayak_test
*.conf
Expand Down
4 changes: 2 additions & 2 deletions client/helper_test.go
Expand Up @@ -201,9 +201,9 @@ func initNode() (cleanupFunc func(), tempDir string, server *rpc.Server, err err
// init conf
_, testFile, _, _ := runtime.Caller(0)
pubKeyStoreFile := filepath.Join(tempDir, PubKeyStorePath+"_dht")
os.Remove(pubKeyStoreFile)
utils.RemoveAll(pubKeyStoreFile + "*")
clientPubKeyStoreFile := filepath.Join(tempDir, PubKeyStorePath+"_c")
os.Remove(clientPubKeyStoreFile)
utils.RemoveAll(clientPubKeyStoreFile + "*")
dupConfFile := filepath.Join(tempDir, "config.yaml")
confFile := filepath.Join(filepath.Dir(testFile), "../test/node_standalone/config.yaml")
if err = utils.DupConf(confFile, dupConfFile); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/cql-minerd/integration_test.go
Expand Up @@ -801,7 +801,7 @@ func benchMiner(b *testing.B, minerCount uint16) {
// create
meta := client.ResourceMeta{
ResourceMeta: types.ResourceMeta{
Node: minerCount,
Node: minerCount,
UseEventualConsistency: benchEventualConsistency,
},
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/cql-minerd/node.go
Expand Up @@ -18,7 +18,6 @@ package main

import (
"fmt"
"os"
"syscall"
"time"

Expand All @@ -28,6 +27,7 @@ import (
"github.com/CovenantSQL/CovenantSQL/crypto/kms"
"github.com/CovenantSQL/CovenantSQL/route"
"github.com/CovenantSQL/CovenantSQL/rpc"
"github.com/CovenantSQL/CovenantSQL/utils"
"github.com/CovenantSQL/CovenantSQL/utils/log"
)

Expand Down Expand Up @@ -69,7 +69,7 @@ func initNode() (server *rpc.Server, err error) {
}

func createServer(privateKeyPath, pubKeyStorePath string, masterKey []byte, listenAddr string) (server *rpc.Server, err error) {
os.Remove(pubKeyStorePath)
utils.RemoveAll(pubKeyStorePath + "*")

server = rpc.NewServer()
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions cmd/cqld/bench_test.go
Expand Up @@ -63,7 +63,7 @@ func start3BPs() {
var cmd *utils.CMD
os.Remove(FJ(testWorkingDir, "./node_0/chain.db"))
os.Remove(FJ(testWorkingDir, "./node_0/dht.db"))
os.Remove(FJ(testWorkingDir, "./node_0/public.keystore"))
utils.RemoveAll(FJ(testWorkingDir, "./node_0/public.keystore*"))
if cmd, err = utils.RunCommandNB(
FJ(baseDir, "./bin/cqld.test"),
[]string{"-config", FJ(testWorkingDir, "./node_0/config.yaml"),
Expand All @@ -77,7 +77,7 @@ func start3BPs() {
}
os.Remove(FJ(testWorkingDir, "./node_1/chain.db"))
os.Remove(FJ(testWorkingDir, "./node_1/dht.db"))
os.Remove(FJ(testWorkingDir, "./node_1/public.keystore"))
utils.RemoveAll(FJ(testWorkingDir, "./node_1/public.keystore*"))
if cmd, err = utils.RunCommandNB(
FJ(baseDir, "./bin/cqld.test"),
[]string{"-config", FJ(testWorkingDir, "./node_1/config.yaml"),
Expand All @@ -91,7 +91,7 @@ func start3BPs() {
}
os.Remove(FJ(testWorkingDir, "./node_2/chain.db"))
os.Remove(FJ(testWorkingDir, "./node_2/dht.db"))
os.Remove(FJ(testWorkingDir, "./node_2/public.keystore"))
utils.RemoveAll(FJ(testWorkingDir, "./node_2/public.keystore*"))
if cmd, err = utils.RunCommandNB(
FJ(baseDir, "./bin/cqld.test"),
[]string{"-config", FJ(testWorkingDir, "./node_2/config.yaml"),
Expand All @@ -104,7 +104,7 @@ func start3BPs() {
log.Errorf("start node failed: %v", err)
}
os.Remove(FJ(testWorkingDir, "./node_c/dht.db"))
os.Remove(FJ(testWorkingDir, "./node_c/public.keystore"))
utils.RemoveAll(FJ(testWorkingDir, "./node_c/public.keystore*"))
}

func stopNodes() {
Expand Down