account sync pointer fix
This commit is contained in:
parent
2241ceccd4
commit
f34cef1d47
|
@ -25,7 +25,7 @@ func createAccount(password string) (string, string, error) {
|
||||||
|
|
||||||
w := true
|
w := true
|
||||||
keydir := datadir + "/keystore"
|
keydir := datadir + "/keystore"
|
||||||
accman := accounts.NewManager(keydir, scryptN, scryptP, &accountSync)
|
accman := accounts.NewManager(keydir, scryptN, scryptP, accountSync)
|
||||||
|
|
||||||
// generate the account
|
// generate the account
|
||||||
account, err := accman.NewAccount(password, w)
|
account, err := accman.NewAccount(password, w)
|
||||||
|
@ -60,7 +60,7 @@ func unlockAccount(address, password string, seconds int) error {
|
||||||
|
|
||||||
if currentNode != nil {
|
if currentNode != nil {
|
||||||
|
|
||||||
accman := utils.MakeAccountManager(c, &accountSync)
|
accman := utils.MakeAccountManager(c, accountSync)
|
||||||
account, err := utils.MakeAddress(accman, address)
|
account, err := utils.MakeAddress(accman, address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errextra.Wrap(err, "Could not retrieve account from address")
|
return errextra.Wrap(err, "Could not retrieve account from address")
|
||||||
|
|
18
src/main.go
18
src/main.go
|
@ -4,6 +4,7 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/codegangsta/cli"
|
"github.com/codegangsta/cli"
|
||||||
"github.com/ethereum/go-ethereum/cmd/utils"
|
"github.com/ethereum/go-ethereum/cmd/utils"
|
||||||
|
@ -27,12 +28,12 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
vString string // Combined textual representation of the version
|
vString string // Combined textual representation of the version
|
||||||
rConfig release.Config // Structured version information and release oracle config
|
rConfig release.Config // Structured version information and release oracle config
|
||||||
currentNode *node.Node // currently running geth node
|
currentNode *node.Node // currently running geth node
|
||||||
c *cli.Context // the CLI context used to start the 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
|
accountSync *[]node.Service // the object used to sync accounts between geth services
|
||||||
datadir string // data directory for geth
|
datadir string // data directory for geth
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -40,8 +41,6 @@ func main() {
|
||||||
// Placeholder for anything we want to run by default
|
// Placeholder for anything we want to run by default
|
||||||
fmt.Println("You are running statusgo!")
|
fmt.Println("You are running statusgo!")
|
||||||
|
|
||||||
createAndStartNode(".ethereum")
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MakeNode create a geth node entity
|
// MakeNode create a geth node entity
|
||||||
|
@ -58,7 +57,7 @@ func MakeNode(inputDir string) *node.Node {
|
||||||
set.String("rpcport", "8545", "rpc port")
|
set.String("rpcport", "8545", "rpc port")
|
||||||
set.String("rpcapi", "db,eth,net,web3,shh,admin", "rpc api(s)")
|
set.String("rpcapi", "db,eth,net,web3,shh,admin", "rpc api(s)")
|
||||||
set.String("datadir", datadir, "data directory for geth")
|
set.String("datadir", datadir, "data directory for geth")
|
||||||
set.String("logdir", datadir, "log dir for glog")
|
//set.String("logdir", datadir, "log dir for glog")
|
||||||
c = cli.NewContext(nil, set, nil)
|
c = cli.NewContext(nil, set, nil)
|
||||||
|
|
||||||
// Construct the textual version string from the individual components
|
// Construct the textual version string from the individual components
|
||||||
|
@ -73,6 +72,7 @@ func MakeNode(inputDir string) *node.Node {
|
||||||
|
|
||||||
utils.DebugSetup(c)
|
utils.DebugSetup(c)
|
||||||
currentNode, accountSync = utils.MakeSystemNode(clientIdentifier, vString, rConfig, makeDefaultExtra(), c)
|
currentNode, accountSync = utils.MakeSystemNode(clientIdentifier, vString, rConfig, makeDefaultExtra(), c)
|
||||||
|
fmt.Println(accountSync)
|
||||||
return currentNode
|
return currentNode
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -670,7 +670,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, []node.Service) {
|
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 {
|
||||||
|
@ -845,7 +845,7 @@ func MakeSystemNode(name, version string, relconf release.Config, extra []byte,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return stack, accountSync
|
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.
|
||||||
|
|
Loading…
Reference in New Issue