Only block reused address if option is on

This commit is contained in:
Rafael Taranto 2019-08-18 19:46:32 +01:00 committed by Josh Harvey
parent fb42fc54a0
commit 5125601e56
2 changed files with 7 additions and 7 deletions

View file

@ -2,7 +2,7 @@ const db = require('./db')
function blocked (address, cryptoCode) {
const sql = `select * from blacklist where address = $1 and crypto_code = $2`
return db.oneOrNone(sql, [
return db.any(sql, [
address,
cryptoCode
])

View file

@ -24,13 +24,13 @@ function post (machineTx, pi) {
let blacklisted = false
let addressReuse = false
return checkForBlacklisted(updatedTx)
.then(blacklistItem => {
if (blacklistItem && blacklistItem.created_by_operator) {
blacklisted = true
}
return Promise.all([settingsLoader.loadLatest(), checkForBlacklisted(updatedTx)])
.then(([{ config }, blacklistItems]) => {
const rejectAddressReuseActive = configManager.unscoped(config).rejectAddressReuseActive
if (blacklistItem && !blacklistItem.created_by_operator) {
if (_.some(it => it.created_by_operator === true)(blacklistItems)) {
blacklisted = true
} else if (_.some(it => it.created_by_operator === false)(blacklistItems) && rejectAddressReuseActive) {
addressReuse = true
}