Merge pull request #176 from hellcatz/patch-14

Update paymentProcessor.js
This commit is contained in:
sennevb 2017-08-12 12:29:07 +02:00 committed by GitHub
commit e8e52e3eb3
1 changed files with 17 additions and 8 deletions

View File

@ -47,8 +47,10 @@ function SetupForPool(logger, poolOptions, setupFinished){
var logSystem = 'Payments';
var logComponent = coin;
var opidCount = 0;
var opids = [];
// zcash team recommends 10 confirmations for safety from orphaned blocks
var minConfShield = Math.max((processingConfig.minConf || 10), 1); // Don't allow 0 conf transactions.
var minConfPayout = Math.max((processingConfig.minConf || 10), 1);
@ -261,8 +263,10 @@ function SetupForPool(logger, poolOptions, setupFinished){
callback(true);
}
else {
var opid = (result.response || result[0].response);
opidCount++;
logger.special(logSystem, logComponent, 'Shield balance ' + amount);
opids.push(opid);
logger.special(logSystem, logComponent, 'Shield balance ' + amount + ' ' + opid);
callback = function (){};
callback(null);
}
@ -302,8 +306,10 @@ function SetupForPool(logger, poolOptions, setupFinished){
callback(true);
}
else {
var opid = (result.response || result[0].response);
opidCount++;
logger.special(logSystem, logComponent, 'Unshield funds for payout ' + amount);
opids.push(opid);
logger.special(logSystem, logComponent, 'Unshield funds for payout ' + amount + ' ' + opid);
callback = function (){};
callback(null);
}
@ -442,10 +448,12 @@ function SetupForPool(logger, poolOptions, setupFinished){
// check operation id status
if (op.status == "success" || op.status == "failed") {
// clear operation id result
batchRPC.push(['z_getoperationresult', [[op.id]]]);
// clear operation id count
if (opidCount > 0) {
opidCount = 0;
var opid_index = opids.indexOf(op.id);
if (opid_index > -1) {
// clear operation id count
batchRPC.push(['z_getoperationresult', [[op.id]]]);
opidCount--;
opids.splice(opid_index, 1);
}
// log status to console
if (op.status == "failed") {
@ -500,8 +508,9 @@ function SetupForPool(logger, poolOptions, setupFinished){
}
if (err === true) {
opidTimeout = setTimeout(checkOpids, opid_interval);
if (opidCount > 0) {
if (opidCount !== 0) {
opidCount = 0;
opids = [];
logger.warning(logSystem, logComponent, 'Clearing operation ids due to RPC call errors.');
}
}