Chore: remove 1-conf check in wallet plugin

Chore: Use _.isNil
This commit is contained in:
csrapr 2021-04-16 16:04:34 +01:00 committed by Josh Harvey
parent 84e7b67635
commit d1db0b95c8
3 changed files with 7 additions and 8 deletions

View file

@ -145,7 +145,7 @@ function authorizeZeroConf (settings, tx, machineId) {
return Promise.reject(new Error('tx.fiat is undefined!')) return Promise.reject(new Error('tx.fiat is undefined!'))
} }
if (plugin === 'no-zero-conf' || tx.fiat.gt(zeroConfLimit)) { if (tx.fiat.gt(zeroConfLimit)) {
return Promise.resolve(false) return Promise.resolve(false)
} }

View file

@ -19,10 +19,10 @@ exports.up = function (next) {
_.forEach(cryptoCode => { _.forEach(cryptoCode => {
const walletConfig = configManager.getWalletSettings(cryptoCode, config) const walletConfig = configManager.getWalletSettings(cryptoCode, config)
const zeroConfLimit = cryptoCode === 'ETH' ? 0 : _.get('zeroConfLimit', walletConfig) const zeroConfLimit = _.get('zeroConfLimit', walletConfig)
const key = `wallets_${cryptoCode}_zeroConfLimit`
if (isNil(zeroConfLimit)) { if (_.isNil(zeroConfLimit)) {
config[key] = min config[`wallets_${cryptoCode}_zeroConfLimit`] = smallerZeroConf
} }
}, cryptoCodes) }, cryptoCodes)

View file

@ -50,7 +50,6 @@ const Wizard = ({ coin, onClose, accountsConfig, accounts, save, error }) => {
const getValue = code => R.find(R.propEq('code', code))(accounts) const getValue = code => R.find(R.propEq('code', code))(accounts)
const limit = zeroConfLimit && coin.code !== 'ETH' ? zeroConfLimit : 0
const onContinue = async (stepConfig, stepAccount) => { const onContinue = async (stepConfig, stepAccount) => {
const newConfig = R.merge(config, stepConfig) const newConfig = R.merge(config, stepConfig)
const newAccounts = stepAccount const newAccounts = stepAccount
@ -58,8 +57,8 @@ const Wizard = ({ coin, onClose, accountsConfig, accounts, save, error }) => {
: accountsToSave : accountsToSave
if (isLastStep) { if (isLastStep) {
newConfig.zeroConfLimit = limit const configToSave = { ...newConfig, zeroConfLimit: 0 }
return save(toNamespace(coin.code, newConfig), newAccounts) return save(toNamespace(coin.code, configToSave), newAccounts)
} }
setState({ setState({