refactor: remove duplicate function
This commit is contained in:
parent
e62245098b
commit
dd3b4116a6
1 changed files with 1 additions and 2 deletions
|
|
@ -30,6 +30,7 @@ function authorize (account, toAddress, cryptoAtoms, cryptoCode, isBitcoindAvail
|
|||
return axios.get(url)
|
||||
.then(r => {
|
||||
const data = r.data
|
||||
const sumTxRefs = txrefs => _.sumBy(txref => highConfidence(confidence, txref), txrefs)
|
||||
if (isBitcoindAvailable && isRBFEnabled && data.unconfirmed_txrefs) {
|
||||
_.map(unconfirmedTxref => {
|
||||
promise.push(new Promise((resolve, reject) => { resolve(fetchRBF(unconfirmedTxref.tx_hash)) }))
|
||||
|
|
@ -41,12 +42,10 @@ function authorize (account, toAddress, cryptoAtoms, cryptoCode, isBitcoindAvail
|
|||
if (rbfInfo.tx_hash === unconfirmedTxref.tx_hash) unconfirmedTxref.rbf = rbfInfo['bip125-replaceable']
|
||||
}, data.unconfirmed_txrefs)
|
||||
}, values)
|
||||
const sumTxRefs = txrefs => _.sumBy(txref => highConfidence(confidence, txref), txrefs)
|
||||
const authorizedValue = sumTxRefs(data.txrefs) + sumTxRefs(data.unconfirmed_txrefs)
|
||||
return cryptoAtoms.lte(authorizedValue)
|
||||
})
|
||||
} else {
|
||||
const sumTxRefs = txrefs => _.sumBy(txref => highConfidence(confidence, txref), txrefs)
|
||||
const authorizedValue = sumTxRefs(data.txrefs) + sumTxRefs(data.unconfirmed_txrefs)
|
||||
return cryptoAtoms.lte(authorizedValue)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue