diff --git a/src/gethdep.go b/src/gethdep.go index ae361185d..7e25a2774 100644 --- a/src/gethdep.go +++ b/src/gethdep.go @@ -10,7 +10,6 @@ import ( "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/node" errextra "github.com/pkg/errors" ) @@ -20,13 +19,13 @@ var ( ) // createAccount creates an internal geth account -func createAccount(password, keydir string) (string, string, error) { +func createAccount(password string) (string, string, error) { if currentNode != nil { - var sync *[]node.Service w := true - accman := accounts.NewManager(keydir, scryptN, scryptP, sync) + keydir := datadir + "/keystore" + accman := accounts.NewManager(keydir, scryptN, scryptP, &accountSync) // generate the account account, err := accman.NewAccount(password, w) @@ -82,9 +81,9 @@ func unlockAccount(address, password string, seconds int) error { // createAndStartNode creates a node entity and starts the // node running locally -func createAndStartNode(datadir string) error { +func createAndStartNode(inputDir string) error { - currentNode = MakeNode(datadir) + currentNode = MakeNode(inputDir) if currentNode != nil { RunNode(currentNode) return nil diff --git a/src/gethdep_test.go b/src/gethdep_test.go index 9033c3f1b..c54cabf12 100644 --- a/src/gethdep_test.go +++ b/src/gethdep_test.go @@ -19,7 +19,7 @@ func TestAccountBindings(t *testing.T) { } // create an account - address, _, err := createAccount("badpassword", ".ethereumtest/keystore") + address, _, err := createAccount("badpassword") if err != nil { fmt.Println(err.Error()) t.Error("Test failed: could not create account") diff --git a/src/library.go b/src/library.go index cc05e18ec..9838ab29f 100644 --- a/src/library.go +++ b/src/library.go @@ -10,11 +10,11 @@ import ( var emptyError = "" //export CreateAccount -func CreateAccount(password, keydir *C.char) *C.char { +func CreateAccount(password *C.char) *C.char { // This is equivalent to creating an account from the command line, // just modified to handle the function arg passing - address, pubKey, err := createAccount(C.GoString(password), C.GoString(keydir)) + address, pubKey, err := createAccount(C.GoString(password)) errString := emptyError if err != nil { diff --git a/src/main.go b/src/main.go index d69182542..26c9bb95e 100644 --- a/src/main.go +++ b/src/main.go @@ -32,6 +32,7 @@ var ( currentNode *node.Node // currently running geth node c *cli.Context // the CLI context used to start the geth node accountSync []node.Service // the object used to sync accounts between geth services + datadir string // data directory for geth ) func main() { @@ -44,7 +45,9 @@ func main() { } // MakeNode create a geth node entity -func MakeNode(datadir string) *node.Node { +func MakeNode(inputDir string) *node.Node { + + datadir = inputDir // TODO remove admin rpcapi flag set := flag.NewFlagSet("test", 0)