merge lightning
This commit is contained in:
commit
6fa6ac1647
92 changed files with 2688 additions and 2651 deletions
|
|
@ -4,11 +4,13 @@ set -e
|
|||
|
||||
DOMAIN=localhost
|
||||
|
||||
CONFIG_DIR=$HOME/.lamassu
|
||||
LOG_FILE=/tmp/cert-gen.log
|
||||
CERT_DIR=$PWD/certs
|
||||
KEY_DIR=$PWD/certs
|
||||
|
||||
CONFIG_DIR=$HOME/.lamassu
|
||||
LAMASSU_CA_PATH=$PWD/Lamassu_CA.pem
|
||||
MIGRATE_STATE_PATH=$CONFIG_DIR/.migrate
|
||||
POSTGRES_PASS=postgres123
|
||||
|
||||
mkdir -p $CERT_DIR
|
||||
mkdir -p $CONFIG_DIR >> $LOG_FILE 2>&1
|
||||
|
|
@ -49,11 +51,7 @@ openssl genrsa \
|
|||
openssl req -new \
|
||||
-key $SERVER_KEY_PATH \
|
||||
-out /tmp/Lamassu_OP.csr.pem \
|
||||
-subj "/C=IS/ST=/L=Reykjavik/O=Lamassu Operator/CN=$IP" \
|
||||
-reqexts SAN \
|
||||
-sha256 \
|
||||
-config <(cat /etc/ssl/openssl.cnf \
|
||||
<(printf "[SAN]\nsubjectAltName=IP.1:$IP")) \
|
||||
-subj "/C=IS/ST=/L=Reykjavik/O=Lamassu Operator/CN=$DOMAIN" \
|
||||
>> $LOG_FILE 2>&1
|
||||
|
||||
openssl x509 \
|
||||
|
|
@ -62,22 +60,22 @@ openssl x509 \
|
|||
-CAkey $CA_KEY_PATH \
|
||||
-CAcreateserial \
|
||||
-out $SERVER_CERT_PATH \
|
||||
-extfile <(cat /etc/ssl/openssl.cnf \
|
||||
<(printf "[SAN]\nsubjectAltName=IP.1:$IP")) \
|
||||
-extensions SAN \
|
||||
-days 3650 >> $LOG_FILE 2>&1
|
||||
|
||||
rm /tmp/Lamassu_OP.csr.pem
|
||||
|
||||
cat <<EOF > $CONFIG_DIR/lamassu.json
|
||||
{
|
||||
"postgresql": "psql://lamassu:lamassu@localhost/lamassu",
|
||||
"postgresql": "psql://postgres:$POSTGRES_PASS@localhost/lamassu",
|
||||
"seedPath": "$SEED_FILE",
|
||||
"caPath": "$CA_PATH",
|
||||
"certPath": "$SERVER_CERT_PATH",
|
||||
"keyPath": "$SERVER_KEY_PATH",
|
||||
"hostname": "$DOMAIN",
|
||||
"logLevel": "debug"
|
||||
"logLevel": "debug",
|
||||
"lamassuCaPath": "$LAMASSU_CA_PATH",
|
||||
"lamassuServerPath": "$PWD",
|
||||
"migrateStatePath": "$MIGRATE_STATE_PATH"
|
||||
}
|
||||
EOF
|
||||
|
||||
|
|
|
|||
|
|
@ -7,44 +7,44 @@ var db = pgp(psqlUrl)
|
|||
|
||||
db.manyOrNone(`select * from transactions where incoming=false
|
||||
and stage='final_request' and authority='machine'`)
|
||||
.then(rs =>
|
||||
db.tx(t =>
|
||||
t.batch(rs.map(r => db.none(`insert into cash_in_txs (session_id,
|
||||
.then(rs =>
|
||||
db.tx(t =>
|
||||
t.batch(rs.map(r => db.none(`insert into cash_in_txs (session_id,
|
||||
device_fingerprint, to_address, crypto_atoms, crypto_code, fiat,
|
||||
currency_code, fee, tx_hash, error, created) values ($1, $2, $3, $4, $5,
|
||||
$6, $7, $8, $9, $10, $11)`, [r.session_id, r.device_fingerprint,
|
||||
r.to_address, r.satoshis, r.crypto_code, r.fiat, r.currency_code, r.fee,
|
||||
r.tx_hash, r.error, r.created]))
|
||||
r.to_address, r.satoshis, r.crypto_code, r.fiat, r.currency_code, r.fee,
|
||||
r.tx_hash, r.error, r.created]))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
.then(() => db.manyOrNone(`select * from transactions where incoming=true
|
||||
.then(() => db.manyOrNone(`select * from transactions where incoming=true
|
||||
and stage='initial_request' and authority='pending'`))
|
||||
.then(rs =>
|
||||
db.tx(t =>
|
||||
t.batch(rs.map(r => db.none(`insert into cash_out_txs (session_id,
|
||||
.then(rs =>
|
||||
db.tx(t =>
|
||||
t.batch(rs.map(r => db.none(`insert into cash_out_txs (session_id,
|
||||
device_fingerprint, to_address, crypto_atoms, crypto_code, fiat,
|
||||
currency_code, tx_hash, phone, error, created) values ($1, $2, $3, $4, $5,
|
||||
$6, $7, $8, $9, $10, $11)`, [r.session_id, r.device_fingerprint,
|
||||
r.to_address, r.satoshis, r.crypto_code, r.fiat, r.currency_code,
|
||||
r.tx_hash, r.phone, r.error, r.created]))
|
||||
r.to_address, r.satoshis, r.crypto_code, r.fiat, r.currency_code,
|
||||
r.tx_hash, r.phone, r.error, r.created]))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
.then(() => db.manyOrNone(`select * from transactions where incoming=true
|
||||
.then(() => db.manyOrNone(`select * from transactions where incoming=true
|
||||
and stage='dispense' and authority='authorized'`))
|
||||
.then(rs =>
|
||||
db.tx(t =>
|
||||
t.batch(rs.map(r =>
|
||||
db.none(`update cash_out_txs set dispensed=true where session_id=$1`, [r.session_id])
|
||||
.then(() => db.none(`insert into cash_out_actions (session_id, action,
|
||||
.then(rs =>
|
||||
db.tx(t =>
|
||||
t.batch(rs.map(r =>
|
||||
db.none(`update cash_out_txs set dispensed=true where session_id=$1`, [r.session_id])
|
||||
.then(() => db.none(`insert into cash_out_actions (session_id, action,
|
||||
created) values ($1, $2, $3)`, [r.session_id, 'dispensed', r.created]))
|
||||
))
|
||||
))
|
||||
)
|
||||
)
|
||||
)
|
||||
.then(() => pgp.end())
|
||||
.then(() => console.log('Success.'))
|
||||
.catch(e => {
|
||||
console.log(e)
|
||||
pgp.end()
|
||||
})
|
||||
.then(() => pgp.end())
|
||||
.then(() => console.log('Success.'))
|
||||
.catch(e => {
|
||||
console.log(e)
|
||||
pgp.end()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
const uuid = require('@fczbkk/uuid4')
|
||||
|
||||
const tx = require('../lib/cash-out-tx')
|
||||
const tx = require('../lib/cash-out/cash-out-tx.js')
|
||||
|
||||
const argv = process.argv.slice(2)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ const settingsLoader = require('../lib/settings-loader')
|
|||
const pp = require('../lib/pp')
|
||||
|
||||
settingsLoader.loadLatest()
|
||||
.then(r => {
|
||||
pp('config')(r)
|
||||
process.exit(0)
|
||||
})
|
||||
.catch(e => {
|
||||
console.log(e.stack)
|
||||
process.exit(1)
|
||||
})
|
||||
.then(r => {
|
||||
pp('config')(r)
|
||||
process.exit(0)
|
||||
})
|
||||
.catch(e => {
|
||||
console.log(e.stack)
|
||||
process.exit(1)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ set -e
|
|||
|
||||
supervisorctl stop lamassu-server
|
||||
supervisorctl stop lamassu-admin-server
|
||||
npm -g install lamassu/lamassu-server#v5
|
||||
npm -g install lamassu/lamassu-server#v5 --unsafe-perm
|
||||
lamassu-migrate
|
||||
supervisorctl start lamassu-server
|
||||
supervisorctl start lamassu-admin-server
|
||||
|
|
|
|||
|
|
@ -8,38 +8,38 @@ const psqlUrl = require('../lib/options').postgresql
|
|||
const db = pgp(psqlUrl)
|
||||
|
||||
db.many('select data from user_config', 'exchanges')
|
||||
.then(rows => {
|
||||
const config = rows.filter(r => r.type === 'exchanges')[0].data
|
||||
const brain = rows.filter(r => r.type === 'unit')[0].data
|
||||
const settings = config.exchanges.settings
|
||||
const compliance = settings.compliance
|
||||
const newConfig = {
|
||||
global: {
|
||||
cashInTransactionLimit: compliance.maximum.limit,
|
||||
cashOutTransactionLimit: settings.fiatTxLimit,
|
||||
cashInCommission: settings.commission,
|
||||
cashOutCommission: settings.fiatCommission || settings.commission,
|
||||
idVerificationEnabled: compliance.idVerificationEnabled,
|
||||
idVerificationLimit: compliance.idVerificationLimit,
|
||||
lowBalanceMargin: settings.lowBalanceMargin,
|
||||
zeroConfLimit: settings.zeroConfLimit,
|
||||
fiatCurrency: settings.currency,
|
||||
topCashOutDenomination: settings.cartridges[0],
|
||||
bottomCashOutDenomination: settings.cartridges[1],
|
||||
virtualCashOutDenomination: settings.virtualCartridges[0],
|
||||
machineLanguages: brain.locale.localeInfo.primaryLocales,
|
||||
coins: settings.coins
|
||||
},
|
||||
accounts: settings.plugins.settings
|
||||
}
|
||||
.then(rows => {
|
||||
const config = rows.filter(r => r.type === 'exchanges')[0].data
|
||||
const brain = rows.filter(r => r.type === 'unit')[0].data
|
||||
const settings = config.exchanges.settings
|
||||
const compliance = settings.compliance
|
||||
const newConfig = {
|
||||
global: {
|
||||
cashInTransactionLimit: compliance.maximum.limit,
|
||||
cashOutTransactionLimit: settings.fiatTxLimit,
|
||||
cashInCommission: settings.commission,
|
||||
cashOutCommission: settings.fiatCommission || settings.commission,
|
||||
idVerificationEnabled: compliance.idVerificationEnabled,
|
||||
idVerificationLimit: compliance.idVerificationLimit,
|
||||
lowBalanceMargin: settings.lowBalanceMargin,
|
||||
zeroConfLimit: settings.zeroConfLimit,
|
||||
fiatCurrency: settings.currency,
|
||||
topCashOutDenomination: settings.cartridges[0],
|
||||
bottomCashOutDenomination: settings.cartridges[1],
|
||||
virtualCashOutDenomination: settings.virtualCartridges[0],
|
||||
machineLanguages: brain.locale.localeInfo.primaryLocales,
|
||||
coins: settings.coins
|
||||
},
|
||||
accounts: settings.plugins.settings
|
||||
}
|
||||
|
||||
db.none('insert into user_config (type, data) values ($1, $2)', ['global', newConfig])
|
||||
.then(() => {
|
||||
console.log('Success.')
|
||||
process.exit(0)
|
||||
db.none('insert into user_config (type, data) values ($1, $2)', ['global', newConfig])
|
||||
.then(() => {
|
||||
console.log('Success.')
|
||||
process.exit(0)
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Error: %s', err)
|
||||
process.exit(1)
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Error: %s', err)
|
||||
process.exit(1)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue