Skip to content

Commit

Permalink
Merge pull request #287 from CovenantSQL/feature/sqlite3_pubkeystore
Browse files Browse the repository at this point in the history
Use sqlite for dht key store
  • Loading branch information
leventeliu committed Mar 22, 2019
2 parents efcafe8 + eea91b5 commit aedcfda
Show file tree
Hide file tree
Showing 23 changed files with 463 additions and 256 deletions.
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

0 comments on commit aedcfda

Please sign in to comment.