status-im / status-go

The Status module that consumes go-ethereum
https://status.im
Mozilla Public License 2.0
728 stars 246 forks source link

Refactor NodeConfig persistence and adjust APIConfig #5424

Open MishkaRogachev opened 3 months ago

MishkaRogachev commented 3 months ago

Problem

Based on this discussion

At the moment the node configuration code is very confusing, and it contains an unused (requires checking) functionality for saving parameters to the database. For example let's review statusd's startup code:

1) statusd starts with a config file, which structured identical to NodeConfig (No, it is NodeConfig!) 2) Here some options are copied to APIConfig to pass it to backend.RestoreAccountAndLogin 3) Next the generateOrImportAccount loads a default config and overrides it with options in APIConfig. (requests.RestoreAccount derived from requests.CreateAccount, that's why it has APIConfig)

Basically, all options missing in the APIConfig, will be ignored.

Implementation

The proposal of this fix it to get rid of saving the NodeConfig to the database, that was mentioned by Igor here: https://github.com/status-im/status-go/pull/5346#discussion_r1652476903