From c081f7f49c009192e41af9547c7c920ec1d40030 Mon Sep 17 00:00:00 2001 From: Igor Mandrigin Date: Thu, 25 Oct 2018 16:20:12 +0200 Subject: [PATCH] ULC mode for Ropsten Signed-off-by: Igor Mandrigin --- src/status_im/constants.cljs | 5 +++++ src/status_im/node/core.cljs | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/status_im/constants.cljs b/src/status_im/constants.cljs index 0827e6e5d8..87da472140 100644 --- a/src/status_im/constants.cljs +++ b/src/status_im/constants.cljs @@ -70,6 +70,11 @@ :config {:NetworkId (ethereum/chain-keyword->chain-id :testnet) :DataDir "/ethereum/testnet" :LightEthConfig {:Enabled true}}} + "testnet_ulc" {:id "testnet_ulc", + :name "Ropsten ULC", + :config {:NetworkId (ethereum/chain-keyword->chain-id :testnet) + :DataDir "/ethereum/testnet_ulc" + :LightEthConfig {:Enabled true :ULC true}}} "testnet_rpc" {:id "testnet_rpc", :name "Ropsten with upstream RPC", :config {:NetworkId (ethereum/chain-keyword->chain-id :testnet) diff --git a/src/status_im/node/core.cljs b/src/status_im/node/core.cljs index be74ba9cfc..7d650ac33b 100644 --- a/src/status_im/node/core.cljs +++ b/src/status_im/node/core.cljs @@ -77,6 +77,16 @@ (if utils.platform/desktop? "" config/log-level-status-go))) +(defn- ulc-network? [config] + (get-in config [:LightEthConfig :ULC] false)) + +(defn- add-ulc-trusted-nodes [config trusted-nodes] + (if (ulc-network? config) + (-> config + (assoc-in [:LightEthConfig :TrustedNodes] trusted-nodes) + (assoc-in [:LightEthConfig :MinTrustedFraction] 50)) + config)) + (defn- get-account-node-config [db address] (let [accounts (get db :accounts/accounts) current-fleet-key (fleet/current-fleet db address) @@ -121,6 +131,9 @@ use-custom-bootnodes) (add-custom-bootnodes network bootnodes) + :always + (add-ulc-trusted-nodes (vals (:static current-fleet))) + :always (add-log-level log-level))))