Merge in release and fix conflicts
This commit is contained in:
commit
e7ef9d0753
7 changed files with 56 additions and 9 deletions
23
bin/lamassu-ofac-update-sources
Executable file
23
bin/lamassu-ofac-update-sources
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
|
||||
const ofacSources = [
|
||||
{
|
||||
name: 'sdn_advanced',
|
||||
url: 'https://www.treasury.gov/ofac/downloads/sanctions/1.0/sdn_advanced.xml'
|
||||
},
|
||||
{
|
||||
name: 'cons_advanced',
|
||||
url: 'https://www.treasury.gov/ofac/downloads/sanctions/1.0/cons_advanced.xml'
|
||||
}
|
||||
]
|
||||
|
||||
const options = require('../lib/options-loader')()
|
||||
|
||||
if (!options.opts.ofacSources) {
|
||||
options.opts.ofacSources = ofacSources
|
||||
fs.writeFileSync(options.path, JSON.stringify(options.opts, null, ' '), 'utf8')
|
||||
}
|
||||
|
|
@ -70,6 +70,9 @@ lamassu-migrate-config >> ${LOG_FILE} 2>&1
|
|||
decho "update to mnemonic"
|
||||
$SCRIPTPATH/bin/lamassu-update-to-mnemonic --prod
|
||||
|
||||
decho "update ofac sources"
|
||||
lamassu-ofac-update-sources >> ${LOG_FILE} 2>&1
|
||||
|
||||
decho "updating supervisor conf"
|
||||
perl -i -pe 's/command=.*/command=$ENV{NPM_BIN}\/lamassu-server/g' /etc/supervisor/conf.d/lamassu-server.conf >> ${LOG_FILE} 2>&1
|
||||
perl -i -pe 's/command=.*/command=$ENV{NPM_BIN}\/lamassu-admin-server/g' /etc/supervisor/conf.d/lamassu-admin-server.conf >> ${LOG_FILE} 2>&1
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ const BINARIES = {
|
|||
dir: 'bitcoin-0.16.3/bin'
|
||||
},
|
||||
ETH: {
|
||||
url: 'https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.8.19-dae82f09.tar.gz',
|
||||
dir: 'geth-linux-amd64-1.8.19-dae82f09'
|
||||
url: 'https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.8.22-7fa3509e.tar.gz',
|
||||
dir: 'geth-linux-amd64-1.8.22-7fa3509e'
|
||||
},
|
||||
ZEC: {
|
||||
url: 'https://z.cash/downloads/zcash-2.0.2-linux64.tar.gz',
|
||||
dir: 'zcash-2.0.2/bin'
|
||||
url: 'https://z.cash/downloads/zcash-2.0.3-linux64.tar.gz',
|
||||
dir: 'zcash-2.0.3/bin'
|
||||
},
|
||||
DASH: {
|
||||
url: 'https://github.com/dashpay/dash/releases/download/v0.12.3.3/dashcore-0.12.3.3-x86_64-linux-gnu.tar.gz',
|
||||
|
|
@ -41,8 +41,8 @@ const BINARIES = {
|
|||
dir: 'litecoin-0.16.3/bin'
|
||||
},
|
||||
BCH: {
|
||||
url: 'https://download.bitcoinabc.org/0.18.5/linux/bitcoin-abc-0.18.5-x86_64-linux-gnu.tar.gz',
|
||||
dir: 'bitcoin-abc-0.18.5/bin',
|
||||
url: 'https://download.bitcoinabc.org/0.19.0/linux/bitcoin-abc-0.19.0-x86_64-linux-gnu.tar.gz',
|
||||
dir: 'bitcoin-abc-0.19.0/bin',
|
||||
files: [['bitcoind', 'bitcoincashd'], ['bitcoin-cli', 'bitcoincash-cli']]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,10 +131,10 @@ function updateCassettes (t, tx) {
|
|||
}
|
||||
|
||||
function wasJustAuthorized (oldTx, newTx, isZeroConf) {
|
||||
const isAuthorized = () => _.includes(oldTx.status, ['notSeen', 'published']) &&
|
||||
const isAuthorized = () => _.includes(oldTx.status, ['notSeen', 'published', 'rejected']) &&
|
||||
_.includes(newTx.status, ['authorized', 'instant', 'confirmed'])
|
||||
|
||||
const isConfirmed = () => _.includes(oldTx.status, ['notSeen', 'published', 'authorized']) &&
|
||||
const isConfirmed = () => _.includes(oldTx.status, ['notSeen', 'published', 'authorized', 'rejected']) &&
|
||||
_.includes(newTx.status, ['instant', 'confirmed'])
|
||||
|
||||
return isZeroConf ? isAuthorized() : isConfirmed()
|
||||
|
|
|
|||
|
|
@ -75,4 +75,8 @@ function match (nameParts, birthDateString, options) {
|
|||
return result
|
||||
}
|
||||
|
||||
module.exports = {load, match}
|
||||
function getStructs () {
|
||||
return structs
|
||||
}
|
||||
|
||||
module.exports = {load, match, getStructs}
|
||||
|
|
|
|||
|
|
@ -103,6 +103,10 @@ function update () {
|
|||
throw new Error('ofacDataDir must be defined in lamassu.json')
|
||||
}
|
||||
|
||||
if (!options.ofacSources) {
|
||||
logger.error('ofacSources must be defined in lamassu.json')
|
||||
}
|
||||
|
||||
const OFAC_SOURCES_DIR = path.join(OFAC_DATA_DIR, 'sources')
|
||||
const OFAC_ETAGS_FILE = path.join(OFAC_DATA_DIR, 'etags.json')
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
const _ = require('lodash/fp')
|
||||
|
||||
const plugins = require('./plugins')
|
||||
const notifier = require('./notifier')
|
||||
const T = require('./time')
|
||||
|
|
@ -16,6 +18,7 @@ const SWEEP_HD_INTERVAL = T.minute
|
|||
const TRADE_INTERVAL = 60 * T.seconds
|
||||
const PONG_INTERVAL = 10 * T.seconds
|
||||
const PONG_CLEAR_INTERVAL = 1 * T.day
|
||||
const SANCTIONS_INITIAL_DOWNLOAD_INTERVAL = 5 * T.minutes
|
||||
const SANCTIONS_UPDATE_INTERVAL = 1 * T.week
|
||||
const RADAR_UPDATE_INTERVAL = 5 * T.minutes
|
||||
|
||||
|
|
@ -35,6 +38,15 @@ function reload (__settings) {
|
|||
function pi () { return _pi }
|
||||
function settings () { return _settings }
|
||||
|
||||
function initialSanctionsDownload () {
|
||||
const structs = sanctions.getStructs()
|
||||
const isEmptyStructs = _.isNil(structs) || _.flow(_.values, _.all(_.isEmpty))(structs)
|
||||
|
||||
if (!isEmptyStructs) return Promise.resolve()
|
||||
|
||||
return updateAndLoadSanctions()
|
||||
}
|
||||
|
||||
function updateAndLoadSanctions () {
|
||||
const config = configManager.unscoped(settings().config)
|
||||
|
||||
|
|
@ -75,6 +87,7 @@ function start (__settings) {
|
|||
setInterval(() => pi().pong(), PONG_INTERVAL)
|
||||
setInterval(() => pi().pongClear(), PONG_CLEAR_INTERVAL)
|
||||
setInterval(() => notifier.checkNotification(pi()), CHECK_NOTIFICATION_INTERVAL)
|
||||
setInterval(initialSanctionsDownload, SANCTIONS_INITIAL_DOWNLOAD_INTERVAL)
|
||||
setInterval(updateAndLoadSanctions, SANCTIONS_UPDATE_INTERVAL)
|
||||
setInterval(updateCoinAtmRadar, RADAR_UPDATE_INTERVAL)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue