WIP
This commit is contained in:
parent
4625ffef0f
commit
8b267210c9
3 changed files with 13 additions and 2 deletions
|
|
@ -9,3 +9,4 @@ process.on('unhandledRejection', err => {
|
||||||
})
|
})
|
||||||
|
|
||||||
app.run()
|
app.run()
|
||||||
|
.catch(console.log)
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ function getStatus (account, toAddress, cryptoAtoms, cryptoCode) {
|
||||||
if (elapsed < AUTHORIZE_TIME) return Promise.resolve({status: 'published'})
|
if (elapsed < AUTHORIZE_TIME) return Promise.resolve({status: 'published'})
|
||||||
if (elapsed < CONFIRM_TIME) return Promise.resolve({status: 'authorized'})
|
if (elapsed < CONFIRM_TIME) return Promise.resolve({status: 'authorized'})
|
||||||
|
|
||||||
console.log('[%s] DEBUG: Mock wallet has confirmed transaction', cryptoCode)
|
console.log('[%s] DEBUG: Mock wallet has confirmed transaction: %s', cryptoCode, toAddress)
|
||||||
return Promise.resolve({status: 'confirmed'})
|
return Promise.resolve({status: 'confirmed'})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,12 @@ const reboots = {}
|
||||||
|
|
||||||
const devMode = argv.dev || options.http
|
const devMode = argv.dev || options.http
|
||||||
|
|
||||||
|
function checkHasLightning (settings) {
|
||||||
|
return configManager.cryptoScoped('BTC', settings.config).wallet === 'lnd'
|
||||||
|
}
|
||||||
|
|
||||||
function poll (req, res, next) {
|
function poll (req, res, next) {
|
||||||
|
console.log('DEBUG102')
|
||||||
const deviceId = req.deviceId
|
const deviceId = req.deviceId
|
||||||
const deviceTime = req.deviceTime
|
const deviceTime = req.deviceTime
|
||||||
const serialNumber = req.query.sn
|
const serialNumber = req.query.sn
|
||||||
|
|
@ -37,7 +42,10 @@ function poll (req, res, next) {
|
||||||
const settings = req.settings
|
const settings = req.settings
|
||||||
const config = configManager.machineScoped(deviceId, settings.config)
|
const config = configManager.machineScoped(deviceId, settings.config)
|
||||||
const pi = plugins(settings, deviceId)
|
const pi = plugins(settings, deviceId)
|
||||||
|
console.log('DEBUG101')
|
||||||
|
const hasLightning = checkHasLightning(settings)
|
||||||
|
|
||||||
|
console.log('DEBUG100')
|
||||||
pids[deviceId] = {pid, ts: Date.now()}
|
pids[deviceId] = {pid, ts: Date.now()}
|
||||||
|
|
||||||
return pi.pollQueries(serialNumber, deviceTime, req.query)
|
return pi.pollQueries(serialNumber, deviceTime, req.query)
|
||||||
|
|
@ -78,13 +86,15 @@ function poll (req, res, next) {
|
||||||
cassettes,
|
cassettes,
|
||||||
twoWayMode: config.cashOutEnabled,
|
twoWayMode: config.cashOutEnabled,
|
||||||
zeroConfLimit: config.zeroConfLimit,
|
zeroConfLimit: config.zeroConfLimit,
|
||||||
reboot
|
reboot,
|
||||||
|
hasLightning
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.idVerificationEnabled) {
|
if (response.idVerificationEnabled) {
|
||||||
response.idVerificationLimit = config.idVerificationLimit
|
response.idVerificationLimit = config.idVerificationLimit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(response)
|
||||||
return res.json(_.assign(response, results))
|
return res.json(_.assign(response, results))
|
||||||
})
|
})
|
||||||
.catch(next)
|
.catch(next)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue