Merge pull request #1434 from ubavic/adresse-reuse-fix-any

fix: use`db.one`
This commit is contained in:
Rafael Taranto 2022-11-07 09:57:59 +01:00 committed by GitHub
commit 1fddbb2bef

View file

@ -45,7 +45,7 @@ function post (machineTx, pi) {
if (_.some(it => it.address === updatedTx.toAddress)(blacklistItems)) {
blacklisted = true
notifier.notifyIfActive('compliance', 'blacklistNotify', r.tx, false)
} else if (isReusedAddress[0].exists && rejectAddressReuse) {
} else if (isReusedAddress && rejectAddressReuse) {
notifier.notifyIfActive('compliance', 'blacklistNotify', r.tx, true)
addressReuse = true
}
@ -173,7 +173,7 @@ function doesTxReuseAddress (tx) {
SELECT to_address FROM cash_in_txs WHERE id != $1
) AS x WHERE to_address = $2
)`
return db.any(sql, [tx.id, tx.toAddress])
return db.one(sql, [tx.id, tx.toAddress]).then(({ exists }) => exists)
}
return Promise.resolve(false)
}