This commit is contained in:
Josh Harvey 2016-10-13 21:36:10 +03:00
parent c9b7a80e89
commit a24f8d6a5a
2 changed files with 14 additions and 9 deletions

View file

@ -91,4 +91,5 @@ module.exports = function (options) {
return server
})
.catch(e => console.log(e.stack))
}

View file

@ -61,8 +61,6 @@ let lastAlertTime = null
exports.init = function init (connectionString, seedPath) {
const masterSeed = new Buffer(fs.readFileSync(seedPath, 'utf8').trim(), 'hex')
hkdf = new HKDF('sha256', 'lamassu-server-salt', masterSeed)
db.init(connectionString)
}
function loadPlugin (name, config) {
@ -130,9 +128,14 @@ function loadPlugin (name, config) {
return plugin
}
function loadOrConfigPlugin (pluginHandle, pluginType, cryptoCode, cfg, accounts, options,
function pp (o) {
console.log(require('util').inspect(o, {depth: null}))
}
function loadOrConfigPlugin (pluginHandle, pluginType, cryptoCode, config, accounts, options,
onChangeCallback) {
const currentName = cfg.cryptoServices[pluginType]
pp(config)
const currentName = config.cryptoServices[pluginType]
currentlyUsedPlugins[cryptoCode] = currentlyUsedPlugins[cryptoCode] || {}
@ -175,15 +178,15 @@ exports.configure = function configure (config) {
const accounts = configManager.loadAccounts()
console.log('DEBUG42')
deviceCurrency = config.fiat.fiatCurrency
// cryptoCodes = config.crypto.cryptoCurrencies TODO: add to admin
console.log('DEBUG43')
const cryptoCodes = getCryptoCodes()
console.log('DEBUG30')
cryptoCodes.forEach(cryptoCode => {
const cryptoScopedConfig = config.cryptoScoped(cryptoCode, cachedConfig)
console.log('DEBUG31')
const cryptoScopedConfig = configManager.cryptoScoped(cryptoCode, cachedConfig)
console.log('DEBUG31.1')
// TICKER [required] configure (or load)
loadOrConfigPlugin(
@ -199,7 +202,7 @@ exports.configure = function configure (config) {
}
)
console.log('DEBUG31')
console.log('DEBUG31.2')
// Give each crypto a different derived seed so as not to allow any
// plugin to spend another plugin's funds
@ -213,6 +216,7 @@ exports.configure = function configure (config) {
accounts,
{masterSeed: cryptoSeed},
function onWalletChange (newWallet) {
console.log('DEBUG34: %s, %j', cryptoCode, newWallet)
walletPlugins[cryptoCode] = newWallet
pollBalance(cryptoCode)
}