Only block reused address if option is on
This commit is contained in:
parent
fb42fc54a0
commit
5125601e56
2 changed files with 7 additions and 7 deletions
|
|
@ -2,7 +2,7 @@ const db = require('./db')
|
||||||
|
|
||||||
function blocked (address, cryptoCode) {
|
function blocked (address, cryptoCode) {
|
||||||
const sql = `select * from blacklist where address = $1 and crypto_code = $2`
|
const sql = `select * from blacklist where address = $1 and crypto_code = $2`
|
||||||
return db.oneOrNone(sql, [
|
return db.any(sql, [
|
||||||
address,
|
address,
|
||||||
cryptoCode
|
cryptoCode
|
||||||
])
|
])
|
||||||
|
|
|
||||||
|
|
@ -24,13 +24,13 @@ function post (machineTx, pi) {
|
||||||
let blacklisted = false
|
let blacklisted = false
|
||||||
let addressReuse = false
|
let addressReuse = false
|
||||||
|
|
||||||
return checkForBlacklisted(updatedTx)
|
return Promise.all([settingsLoader.loadLatest(), checkForBlacklisted(updatedTx)])
|
||||||
.then(blacklistItem => {
|
.then(([{ config }, blacklistItems]) => {
|
||||||
if (blacklistItem && blacklistItem.created_by_operator) {
|
const rejectAddressReuseActive = configManager.unscoped(config).rejectAddressReuseActive
|
||||||
blacklisted = true
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
addressReuse = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue