feat: pick wallet scoring without UI
This commit is contained in:
parent
d7d2b89556
commit
d619974de7
2 changed files with 26 additions and 7 deletions
|
|
@ -63,6 +63,16 @@ function saveAccounts (accounts) {
|
|||
return Promise.all([loadAccounts(), getOperatorId('middleware')])
|
||||
.then(([currentAccounts, operatorId]) => {
|
||||
const newAccounts = _.merge(currentAccounts, accounts)
|
||||
|
||||
// Only allow one wallet scoring active at a time
|
||||
if (accounts.elliptic?.enabled && newAccounts.scorechain) {
|
||||
newAccounts.scorechain.enabled = false
|
||||
}
|
||||
|
||||
if (accounts.scorechain?.enabled && newAccounts.elliptic) {
|
||||
newAccounts.elliptic.enabled = false
|
||||
}
|
||||
|
||||
return db.tx(t => {
|
||||
return t.none(accountsSql, ['accounts', { accounts: newAccounts }, true, NEW_SETTINGS_LOADER_SCHEMA_VERSION])
|
||||
.then(() => t.none('NOTIFY $1:name, $2', ['reload', JSON.stringify({ schema: asyncLocalStorage.getStore().get('schema'), operatorId })]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue