Fix full config saved on client on priority change (#1329)
* Fix full config saved on client on priority change * Fix WebLN disabled on priority change * Always merge configs
This commit is contained in:
parent
203db13553
commit
48d0cd1086
@ -186,20 +186,23 @@ function useConfig (wallet) {
|
||||
|
||||
let valid = true
|
||||
try {
|
||||
newClientConfig = await walletValidate(wallet, newClientConfig)
|
||||
const transformedConfig = await walletValidate(wallet, newClientConfig)
|
||||
if (transformedConfig) {
|
||||
newClientConfig = Object.assign(newClientConfig, transformedConfig)
|
||||
}
|
||||
} catch {
|
||||
valid = false
|
||||
}
|
||||
|
||||
if (valid) {
|
||||
if (priorityOnly) {
|
||||
setClientConfig(newConfig)
|
||||
setClientConfig(newClientConfig)
|
||||
} else {
|
||||
try {
|
||||
// XXX: testSendPayment can return a new config (e.g. lnc)
|
||||
// XXX: testSendPayment can return a new config (e.g. lnc)
|
||||
const newerConfig = await wallet.testSendPayment?.(newConfig, { me, logger })
|
||||
if (newerConfig) {
|
||||
newClientConfig = newerConfig
|
||||
newClientConfig = Object.assign(newClientConfig, newerConfig)
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error(err.message)
|
||||
@ -219,7 +222,10 @@ function useConfig (wallet) {
|
||||
|
||||
let valid = true
|
||||
try {
|
||||
newServerConfig = await walletValidate(wallet, newServerConfig)
|
||||
const transformedConfig = await walletValidate(wallet, newServerConfig)
|
||||
if (transformedConfig) {
|
||||
newServerConfig = Object.assign(newServerConfig, transformedConfig)
|
||||
}
|
||||
} catch {
|
||||
valid = false
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user