|
|
@ -233,6 +233,8 @@ cache.one = function(req, res, next) { |
|
|
|
total =+ callStack[coin]; |
|
|
|
} |
|
|
|
|
|
|
|
delete callStack.all; |
|
|
|
|
|
|
|
if (total / Object.keys(callStack).length === 1) { |
|
|
|
cacheCallInProgress = false; |
|
|
|
cache.io.emit('messages', { |
|
|
@ -466,7 +468,7 @@ cache.one = function(req, res, next) { |
|
|
|
console.log(JSON.parse(body).result); |
|
|
|
writeCache(); |
|
|
|
var addrCount = outObj.basilisk[coin].addresses ? outObj.basilisk[coin].addresses.length : 0; |
|
|
|
var callsArrayBTC = callsArray.length; |
|
|
|
var callsArrayBTC = callsArray.length; // restrict BTC and SYS only to listunspent and listtransactions calls
|
|
|
|
if (callsArray.indexOf('getbalance') > - 1) { |
|
|
|
callsArrayBTC--; |
|
|
|
} |
|
|
@ -476,11 +478,19 @@ cache.one = function(req, res, next) { |
|
|
|
callStack[coin] = callStack[coin] + addrCount * (coin === 'BTC' || coin === 'SYS' ? callsArrayBTC : callsArray.length); |
|
|
|
console.log(coin + ' stack len ' + callStack[coin]); |
|
|
|
|
|
|
|
async.each(outObj.basilisk[coin].addresses, function(address) { |
|
|
|
execDEXRequests(address, coin); |
|
|
|
}); |
|
|
|
if (body.indexOf('need to unlock wallet') > -1) { |
|
|
|
callStack[coin] = 1; |
|
|
|
checkCallStack(); |
|
|
|
console.log('error wallet is locked'); |
|
|
|
} else { |
|
|
|
async.each(outObj.basilisk[coin].addresses, function(address) { |
|
|
|
execDEXRequests(address, coin); |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// TODO: error
|
|
|
|
callStack[coin] = 1; |
|
|
|
checkCallStack(); |
|
|
|
console.log('error getting ' + coin + ' addrs'); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
@ -503,6 +513,7 @@ cache.one = function(req, res, next) { |
|
|
|
|
|
|
|
if (coin === 'all') { |
|
|
|
var tempUrl = 'http://' + cache.appConfig.host + ':' + cache.appConfig.iguanaCorePort + '/api/InstantDEX/allcoins?userpass=' + sessionKey; |
|
|
|
console.log(tempUrl); |
|
|
|
request({ |
|
|
|
url: mock ? 'http://localhost:17777/shepherd/mock?url=' + tempUrl : tempUrl, |
|
|
|
method: 'GET' |
|
|
@ -550,11 +561,16 @@ cache.one = function(req, res, next) { |
|
|
|
|
|
|
|
getAddresses(coin); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
console.log('no coin is running in basilisk'); |
|
|
|
callStack[coin] = 1; |
|
|
|
checkCallStack(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (error) { // stop further requests on failure, exit
|
|
|
|
callStack[coin] = 1; |
|
|
|
checkCallStack(); |
|
|
|
console.log('error getting allcoins'); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|