unlock account binding, functionality

This commit is contained in:
Daniel Whitenack 2016-06-21 13:29:38 -05:00
parent 9cee10eb61
commit b7d2a7432a
5 changed files with 145 additions and 106 deletions

188
src/Godeps/Godeps.json generated
View File

@ -22,238 +22,238 @@
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/accounts", "ImportPath": "github.com/ethereum/go-ethereum/accounts",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/accounts/abi", "ImportPath": "github.com/ethereum/go-ethereum/accounts/abi",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/accounts/abi/bind", "ImportPath": "github.com/ethereum/go-ethereum/accounts/abi/bind",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/cmd/utils", "ImportPath": "github.com/ethereum/go-ethereum/cmd/utils",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/common", "ImportPath": "github.com/ethereum/go-ethereum/common",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/common/compiler", "ImportPath": "github.com/ethereum/go-ethereum/common/compiler",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/common/httpclient", "ImportPath": "github.com/ethereum/go-ethereum/common/httpclient",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/common/registrar", "ImportPath": "github.com/ethereum/go-ethereum/common/registrar",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/common/registrar/ethreg", "ImportPath": "github.com/ethereum/go-ethereum/common/registrar/ethreg",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/core", "ImportPath": "github.com/ethereum/go-ethereum/core",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/core/state", "ImportPath": "github.com/ethereum/go-ethereum/core/state",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/core/types", "ImportPath": "github.com/ethereum/go-ethereum/core/types",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/core/vm", "ImportPath": "github.com/ethereum/go-ethereum/core/vm",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/crypto", "ImportPath": "github.com/ethereum/go-ethereum/crypto",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/crypto/ecies", "ImportPath": "github.com/ethereum/go-ethereum/crypto/ecies",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/crypto/randentropy", "ImportPath": "github.com/ethereum/go-ethereum/crypto/randentropy",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/crypto/secp256k1", "ImportPath": "github.com/ethereum/go-ethereum/crypto/secp256k1",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/crypto/sha3", "ImportPath": "github.com/ethereum/go-ethereum/crypto/sha3",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/eth", "ImportPath": "github.com/ethereum/go-ethereum/eth",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/eth/downloader", "ImportPath": "github.com/ethereum/go-ethereum/eth/downloader",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/eth/fetcher", "ImportPath": "github.com/ethereum/go-ethereum/eth/fetcher",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/eth/filters", "ImportPath": "github.com/ethereum/go-ethereum/eth/filters",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/eth/gasprice", "ImportPath": "github.com/ethereum/go-ethereum/eth/gasprice",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/ethapi", "ImportPath": "github.com/ethereum/go-ethereum/ethapi",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/ethdb", "ImportPath": "github.com/ethereum/go-ethereum/ethdb",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/event", "ImportPath": "github.com/ethereum/go-ethereum/event",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/event/filter", "ImportPath": "github.com/ethereum/go-ethereum/event/filter",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/internal/debug", "ImportPath": "github.com/ethereum/go-ethereum/internal/debug",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/jsre", "ImportPath": "github.com/ethereum/go-ethereum/jsre",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/les", "ImportPath": "github.com/ethereum/go-ethereum/les",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/les/flowcontrol", "ImportPath": "github.com/ethereum/go-ethereum/les/flowcontrol",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/light", "ImportPath": "github.com/ethereum/go-ethereum/light",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/logger", "ImportPath": "github.com/ethereum/go-ethereum/logger",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/logger/glog", "ImportPath": "github.com/ethereum/go-ethereum/logger/glog",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/metrics", "ImportPath": "github.com/ethereum/go-ethereum/metrics",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/miner", "ImportPath": "github.com/ethereum/go-ethereum/miner",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/node", "ImportPath": "github.com/ethereum/go-ethereum/node",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/p2p", "ImportPath": "github.com/ethereum/go-ethereum/p2p",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/p2p/discover", "ImportPath": "github.com/ethereum/go-ethereum/p2p/discover",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/p2p/nat", "ImportPath": "github.com/ethereum/go-ethereum/p2p/nat",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/params", "ImportPath": "github.com/ethereum/go-ethereum/params",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/pow", "ImportPath": "github.com/ethereum/go-ethereum/pow",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/release", "ImportPath": "github.com/ethereum/go-ethereum/release",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/rlp", "ImportPath": "github.com/ethereum/go-ethereum/rlp",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/rpc", "ImportPath": "github.com/ethereum/go-ethereum/rpc",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/trie", "ImportPath": "github.com/ethereum/go-ethereum/trie",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/ethereum/go-ethereum/whisper", "ImportPath": "github.com/ethereum/go-ethereum/whisper",
"Comment": "v1.0.1-894-gca8606b", "Comment": "v1.0.1-897-g3144839",
"Rev": "ca8606be4d90c0ec49581fe22c8ee4d251a31714" "Rev": "31448394c8ee75b73b5a5931ea9e2e8b3564a0de"
}, },
{ {
"ImportPath": "github.com/fatih/color", "ImportPath": "github.com/fatih/color",

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/node"
errextra "github.com/pkg/errors" errextra "github.com/pkg/errors"
@ -27,7 +28,7 @@ func createAccount(password, keydir string) (string, string, error) {
return "", "", errextra.Wrap(err, "Account manager could not create the account") return "", "", errextra.Wrap(err, "Account manager could not create the account")
} }
address := fmt.Sprintf("{%x}", account.Address) address := fmt.Sprintf("%x", account.Address)
key, err := crypto.LoadECDSA(account.File) key, err := crypto.LoadECDSA(account.File)
if err != nil { if err != nil {
return address, "", errextra.Wrap(err, "Could not load the key") return address, "", errextra.Wrap(err, "Could not load the key")
@ -38,6 +39,32 @@ func createAccount(password, keydir string) (string, string, error) {
} }
// unlockAccount unlocks an existing account for a certain duration and
// inject the account as a whisper identity if the account was created as
// a whisper enabled account
func unlockAccount(address, password string) error {
if currentNode != nil {
accman := utils.MakeAccountManager(c, &accountSync)
account, err := utils.MakeAddress(accman, address)
if err != nil {
return errextra.Wrap(err, "Could not retrieve account from address")
}
err = accman.Unlock(account, password)
if err != nil {
return errextra.Wrap(err, "Could not decrypt account")
}
return nil
}
return errors.New("No running node detected for account unlock")
}
// createAndStartNode creates a node entity and starts the // createAndStartNode creates a node entity and starts the
// node running locally // node running locally
func createAndStartNode(datadir string) error { func createAndStartNode(datadir string) error {

View File

@ -18,6 +18,18 @@ func doCreateAccount(password, keydir *C.char) (*C.char, *C.char, C.int) {
return C.CString(address), C.CString(pubKey), 0 return C.CString(address), C.CString(pubKey), 0
} }
//export doUnlockAccount
func doUnlockAccount(address, password *C.char) C.int {
// This is equivalent to unlocking an account from the command line,
// just modified to unlock the account for the currently running geth node
// based on the provided arguments
if err := unlockAccount(C.GoString(address), C.GoString(password)); err != nil {
fmt.Fprintln(os.Stderr, err)
return -1
}
return 0
}
// export doStartNode // export doStartNode
func doStartNode(datadir *C.char) C.int { func doStartNode(datadir *C.char) C.int {
// This starts a geth node with the given datadir // This starts a geth node with the given datadir
@ -26,5 +38,4 @@ func doStartNode(datadir *C.char) C.int {
return -1 return -1
} }
return 0 return 0
} }

View File

@ -27,10 +27,11 @@ const (
) )
var ( var (
vString string // Combined textual representation of all the version components vString string // Combined textual representation of the version components
rConfig release.Config // Structured version information and release oracle config rConfig release.Config // Structured version information and release oracle config
currentNode *node.Node currentNode *node.Node
c *cli.Context c *cli.Context
accountSync []node.Service
) )
func main() { func main() {
@ -59,15 +60,15 @@ func MakeNode(datadir string) *node.Node {
rConfig.Minor = uint32(versionMinor) rConfig.Minor = uint32(versionMinor)
rConfig.Patch = uint32(versionPatch) rConfig.Patch = uint32(versionPatch)
currentNode = utils.MakeSystemNode(clientIdentifier, vString, rConfig, makeDefaultExtra(), c) currentNode, accountSync = utils.MakeSystemNode(clientIdentifier, vString, rConfig, makeDefaultExtra(), c)
return currentNode return currentNode
} }
// StartNode starts a geth node entity // StartNode starts a geth node entity
func StartNode(currentNode *node.Node) { func StartNode(nodeIn *node.Node) {
utils.StartNode(currentNode) utils.StartNode(nodeIn)
currentNode.Wait() nodeIn.Wait()
} }
func makeDefaultExtra() []byte { func makeDefaultExtra() []byte {

View File

@ -662,7 +662,7 @@ func MakePasswordList(ctx *cli.Context) []string {
// MakeSystemNode sets up a local node, configures the services to launch and // MakeSystemNode sets up a local node, configures the services to launch and
// assembles the P2P protocol stack. // assembles the P2P protocol stack.
func MakeSystemNode(name, version string, relconf release.Config, extra []byte, ctx *cli.Context) *node.Node { func MakeSystemNode(name, version string, relconf release.Config, extra []byte, ctx *cli.Context) (*node.Node, []node.Service) {
// Avoid conflicting network flags // Avoid conflicting network flags
networks, netFlags := 0, []cli.BoolFlag{DevModeFlag, TestNetFlag, OlympicFlag} networks, netFlags := 0, []cli.BoolFlag{DevModeFlag, TestNetFlag, OlympicFlag}
for _, flag := range netFlags { for _, flag := range netFlags {
@ -695,8 +695,8 @@ func MakeSystemNode(name, version string, relconf release.Config, extra []byte,
WSModules: MakeRPCModules(ctx.GlobalString(WSApiFlag.Name)), WSModules: MakeRPCModules(ctx.GlobalString(WSApiFlag.Name)),
} }
// Configure the Ethereum service // Configure the Ethereum service
var AccountSync []node.Service var accountSync []node.Service
accman := MakeAccountManager(ctx, &AccountSync) accman := MakeAccountManager(ctx, &accountSync)
// initialise new random number generator // initialise new random number generator
rand := rand.New(rand.NewSource(time.Now().UnixNano())) rand := rand.New(rand.NewSource(time.Now().UnixNano()))
@ -797,7 +797,7 @@ func MakeSystemNode(name, version string, relconf release.Config, extra []byte,
if shhEnable { if shhEnable {
if err := stack.Register(func(*node.ServiceContext) (node.Service, error) { if err := stack.Register(func(*node.ServiceContext) (node.Service, error) {
whisperInstance := whisper.New() whisperInstance := whisper.New()
AccountSync = append(AccountSync, whisperInstance) accountSync = append(accountSync, whisperInstance)
return whisperInstance, nil return whisperInstance, nil
}); err != nil { }); err != nil {
Fatalf("Failed to register the Whisper service: %v", err) Fatalf("Failed to register the Whisper service: %v", err)
@ -837,7 +837,7 @@ func MakeSystemNode(name, version string, relconf release.Config, extra []byte,
} }
} }
return stack return stack, accountSync
} }
// SetupNetwork configures the system for either the main net or some test network. // SetupNetwork configures the system for either the main net or some test network.