Fix for many wallet config errors (#731)

* Added an extra warning message when failing to reach the node, work in progress on changing default dir for node api ssecret 'foreign_api_secret'

* In the middle of debugging hell, default overwrite any updates to the config made earlier, its never written to a file when running init

* More debugging, next trace the overwrite of the config

* Added get get_node_path function, seperating wallet dir and node_dir -compiling but some  warnings

* Tested wallet config creation fix for Issues: #728 #3394 Pull 3420, partial fix for 3002

* Removed some debugging code

* Fixed passing config to create_config function, some more test needed before pulling to main

* All test succeed: a) normal, b) top-dir, c) here, d) with default config template in working dir

* Cleaning up

* Fixed a single test for config that needed adjusting
This commit is contained in:
Anynomouss
2025-03-08 12:22:59 +00:00
committed by GitHub
parent 3b0cc2401a
commit 7ceade4449
7 changed files with 108 additions and 42 deletions
+8 -3
View File
@@ -70,6 +70,7 @@ pub struct InitArgs {
pub restore: bool,
}
/// Write config (default if None), initiate the wallet
pub fn init<L, C, K>(
owner_api: &mut Owner<L, C, K>,
_g_args: &GlobalArgs,
@@ -81,12 +82,16 @@ where
C: NodeClient + 'static,
K: keychain::Keychain + 'static,
{
// Assume global chain type has already been initialized.
let chain_type = global::get_chain_type();
let mut w_lock = owner_api.wallet_inst.lock();
let p = w_lock.lc_provider()?;
p.create_config(&chain_type, WALLET_CONFIG_FILE_NAME, None, None, None)?;
p.create_config(
&chain_type,
WALLET_CONFIG_FILE_NAME,
Some(args.config),
None,
None,
)?;
p.create_wallet(
None,
args.recovery_phrase,