chore: server code formatting
This commit is contained in:
parent
aedabcbdee
commit
68517170e2
234 changed files with 9824 additions and 6195 deletions
|
|
@ -8,7 +8,7 @@ module.exports = { setup, updateCore }
|
|||
|
||||
const coinRec = coinUtils.getCryptoCurrency('DASH')
|
||||
|
||||
function setup (dataDir) {
|
||||
function setup(dataDir) {
|
||||
common.firewall([coinRec.defaultPort])
|
||||
const config = buildConfig()
|
||||
common.writeFile(path.resolve(dataDir, coinRec.configFile), config)
|
||||
|
|
@ -16,12 +16,17 @@ function setup (dataDir) {
|
|||
common.writeSupervisorConfig(coinRec, cmd)
|
||||
}
|
||||
|
||||
function updateCore (coinRec, isCurrentlyRunning) {
|
||||
function updateCore(coinRec, isCurrentlyRunning) {
|
||||
common.logger.info('Updating Dash Core. This may take a minute...')
|
||||
common.es(`sudo supervisorctl stop dash`)
|
||||
common.es(`curl -#Lo /tmp/dash.tar.gz ${coinRec.url}`)
|
||||
if (common.es(`sha256sum /tmp/dash.tar.gz | awk '{print $1}'`).trim() !== coinRec.urlHash) {
|
||||
common.logger.info('Failed to update Dash Core: Package signature do not match!')
|
||||
if (
|
||||
common.es(`sha256sum /tmp/dash.tar.gz | awk '{print $1}'`).trim() !==
|
||||
coinRec.urlHash
|
||||
) {
|
||||
common.logger.info(
|
||||
'Failed to update Dash Core: Package signature do not match!',
|
||||
)
|
||||
return
|
||||
}
|
||||
common.es(`tar -xzf /tmp/dash.tar.gz -C /tmp/`)
|
||||
|
|
@ -31,20 +36,38 @@ function updateCore (coinRec, isCurrentlyRunning) {
|
|||
common.es(`rm -r /tmp/${coinRec.dir.replace('/bin', '')}`)
|
||||
common.es(`rm /tmp/dash.tar.gz`)
|
||||
|
||||
if (common.es(`grep "enableprivatesend=" /mnt/blockchains/dash/dash.conf || true`)) {
|
||||
if (
|
||||
common.es(
|
||||
`grep "enableprivatesend=" /mnt/blockchains/dash/dash.conf || true`,
|
||||
)
|
||||
) {
|
||||
common.logger.info(`Switching from 'PrivateSend' to 'CoinJoin'...`)
|
||||
common.es(`sed -i 's/enableprivatesend/enablecoinjoin/g' /mnt/blockchains/dash/dash.conf`)
|
||||
} else if (common.es(`grep "enablecoinjoin=" /mnt/blockchains/dash/dash.conf || true`)) {
|
||||
common.es(
|
||||
`sed -i 's/enableprivatesend/enablecoinjoin/g' /mnt/blockchains/dash/dash.conf`,
|
||||
)
|
||||
} else if (
|
||||
common.es(`grep "enablecoinjoin=" /mnt/blockchains/dash/dash.conf || true`)
|
||||
) {
|
||||
common.logger.info(`enablecoinjoin already defined, skipping...`)
|
||||
} else {
|
||||
common.logger.info(`Enabling CoinJoin in config file...`)
|
||||
common.es(`echo "\nenablecoinjoin=1" >> /mnt/blockchains/dash/dash.conf`)
|
||||
}
|
||||
|
||||
if (common.es(`grep "privatesendautostart=" /mnt/blockchains/dash/dash.conf || true`)) {
|
||||
if (
|
||||
common.es(
|
||||
`grep "privatesendautostart=" /mnt/blockchains/dash/dash.conf || true`,
|
||||
)
|
||||
) {
|
||||
common.logger.info(`Switching from 'PrivateSend' to 'CoinJoin'...`)
|
||||
common.es(`sed -i 's/privatesendautostart/coinjoinautostart/g' /mnt/blockchains/dash/dash.conf`)
|
||||
} else if (common.es(`grep "coinjoinautostart=" /mnt/blockchains/dash/dash.conf || true`)) {
|
||||
common.es(
|
||||
`sed -i 's/privatesendautostart/coinjoinautostart/g' /mnt/blockchains/dash/dash.conf`,
|
||||
)
|
||||
} else if (
|
||||
common.es(
|
||||
`grep "coinjoinautostart=" /mnt/blockchains/dash/dash.conf || true`,
|
||||
)
|
||||
) {
|
||||
common.logger.info(`coinjoinautostart already defined, skipping...`)
|
||||
} else {
|
||||
common.logger.info(`Enabling CoinJoin AutoStart in config file...`)
|
||||
|
|
@ -53,7 +76,9 @@ function updateCore (coinRec, isCurrentlyRunning) {
|
|||
|
||||
if (common.es(`grep "litemode=" /mnt/blockchains/dash/dash.conf || true`)) {
|
||||
common.logger.info(`Switching from 'LiteMode' to 'DisableGovernance'...`)
|
||||
common.es(`sed -i 's/litemode/disablegovernance/g' /mnt/blockchains/dash/dash.conf`)
|
||||
common.es(
|
||||
`sed -i 's/litemode/disablegovernance/g' /mnt/blockchains/dash/dash.conf`,
|
||||
)
|
||||
} else {
|
||||
common.es(`echo "\ndisablegovernance already defined, skipping..."`)
|
||||
}
|
||||
|
|
@ -66,7 +91,7 @@ function updateCore (coinRec, isCurrentlyRunning) {
|
|||
common.logger.info('Dash Core is updated!')
|
||||
}
|
||||
|
||||
function buildConfig () {
|
||||
function buildConfig() {
|
||||
return `rpcuser=lamassuserver
|
||||
rpcpassword=${common.randomPass()}
|
||||
dbcache=500
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue