Skip to content

Commit

Permalink
Trianglesphere/oom fix (ethereum#297)
Browse files Browse the repository at this point in the history
* Adds UseLightweightKDF option to mobile config

The mobile geth config options were pared down tp reduce complexity, but
the UseLightweightKDF option was not added. Because we use Geth to store
our keys on mobile, we want to use the lightweight KDF otherwise we get
OOM crashes on certain phones.

* Sets node config KDF parameter correctly

It needed to be passed through from mobile config to node config.

* Adds links for reference
  • Loading branch information
Joshua Gutow authored Jun 26, 2019
1 parent f6fc613 commit 52adf69
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions mobile/geth.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ type NodeConfig struct {
// This has to be integer since Enum exports to Java are not supported by "gomobile"
// See getSyncMode(syncMode int)
SyncMode int

// UseLightweightKDF lowers the memory and CPU requirements of the key store
// scrypt KDF at the expense of security.
// See https://geth.ethereum.org/doc/Mobile_Account-management for reference
UseLightweightKDF bool
}

// defaultNodeConfig contains the default node configuration values to use if all
Expand Down Expand Up @@ -132,11 +137,12 @@ func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error) {

// Create the empty networking stack
nodeConf := &node.Config{
Name: clientIdentifier,
Version: params.VersionWithMeta,
DataDir: datadir,
KeyStoreDir: filepath.Join(datadir, "keystore"), // Mobile should never use internal keystores!
IPCPath: "geth.ipc",
Name: clientIdentifier,
Version: params.VersionWithMeta,
DataDir: datadir,
KeyStoreDir: filepath.Join(datadir, "keystore"), // Mobile should never use internal keystores!
UseLightweightKDF: config.UseLightweightKDF,
IPCPath: "geth.ipc",
P2P: p2p.Config{
NoDiscovery: true,
DiscoveryV5: false,
Expand Down

0 comments on commit 52adf69

Please sign in to comment.