Merge branch 'release-8.1' into fix/ct-ui-score-error-color

This commit is contained in:
Rafael Taranto 2022-11-21 11:18:13 +00:00 committed by GitHub
commit 01e0c57655
40 changed files with 332 additions and 160 deletions

View file

@ -168,23 +168,32 @@ function postProcess (r, pi, isBlacklisted, addressReuse, walletScore) {
function doesTxReuseAddress (tx) {
if (!tx.fiat || tx.fiat.isZero()) {
const sql = `SELECT EXISTS (SELECT DISTINCT to_address FROM cash_in_txs WHERE to_address = $1)`
return db.any(sql, [tx.toAddress])
const sql = `
SELECT EXISTS (
SELECT DISTINCT to_address FROM (
SELECT to_address FROM cash_in_txs WHERE id != $1
) AS x WHERE to_address = $2
)`
return db.one(sql, [tx.id, tx.toAddress]).then(({ exists }) => exists)
}
return Promise.resolve(false)
}
function getWalletScore (tx, pi) {
if (!tx.fiat || tx.fiat.isZero()) {
return pi.rateWallet(tx.cryptoCode, tx.toAddress)
}
// Passthrough the previous result
return pi.isValidWalletScore(tx.walletScore)
.then(isValid => ({
address: tx.toAddress,
score: tx.walletScore,
isValid
}))
pi.isWalletScoringEnabled(tx)
.then(isEnabled => {
if(!isEnabled) return null
if (!tx.fiat || tx.fiat.isZero()) {
return pi.rateWallet(tx.cryptoCode, tx.toAddress)
}
// Passthrough the previous result
return pi.isValidWalletScore(tx.walletScore)
.then(isValid => ({
address: tx.toAddress,
score: tx.walletScore,
isValid
}))
})
}
function monitorPending (settings) {