mirror of https://github.com/BTCPrivate/z-nomp.git
Update paymentProcessor.js
Only manage opids created by z-nomp. All opids are still monitored.
This commit is contained in:
parent
f6f6f0c712
commit
129e11e8e3
|
@ -47,8 +47,10 @@ function SetupForPool(logger, poolOptions, setupFinished){
|
||||||
|
|
||||||
var logSystem = 'Payments';
|
var logSystem = 'Payments';
|
||||||
var logComponent = coin;
|
var logComponent = coin;
|
||||||
|
|
||||||
var opidCount = 0;
|
var opidCount = 0;
|
||||||
|
var opids = [];
|
||||||
|
|
||||||
// zcash team recommends 10 confirmations for safety from orphaned blocks
|
// 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 minConfShield = Math.max((processingConfig.minConf || 10), 1); // Don't allow 0 conf transactions.
|
||||||
var minConfPayout = Math.max((processingConfig.minConf || 10), 1);
|
var minConfPayout = Math.max((processingConfig.minConf || 10), 1);
|
||||||
|
@ -259,8 +261,10 @@ function SetupForPool(logger, poolOptions, setupFinished){
|
||||||
callback(true);
|
callback(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
var opid = (result.response || result[0].response);
|
||||||
opidCount++;
|
opidCount++;
|
||||||
logger.special(logSystem, logComponent, 'Shield balance ' + amount);
|
opids.push(opid);
|
||||||
|
logger.special(logSystem, logComponent, 'Shield balance ' + amount + ' ' + opid);
|
||||||
callback = function (){};
|
callback = function (){};
|
||||||
callback(null);
|
callback(null);
|
||||||
}
|
}
|
||||||
|
@ -300,8 +304,10 @@ function SetupForPool(logger, poolOptions, setupFinished){
|
||||||
callback(true);
|
callback(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
var opid = (result.response || result[0].response);
|
||||||
opidCount++;
|
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 = function (){};
|
||||||
callback(null);
|
callback(null);
|
||||||
}
|
}
|
||||||
|
@ -440,10 +446,12 @@ function SetupForPool(logger, poolOptions, setupFinished){
|
||||||
// check operation id status
|
// check operation id status
|
||||||
if (op.status == "success" || op.status == "failed") {
|
if (op.status == "success" || op.status == "failed") {
|
||||||
// clear operation id result
|
// clear operation id result
|
||||||
batchRPC.push(['z_getoperationresult', [[op.id]]]);
|
var opid_index = opids.indexOf(op.id);
|
||||||
// clear operation id count
|
if (opid_index > -1) {
|
||||||
if (opidCount > 0) {
|
// clear operation id count
|
||||||
opidCount = 0;
|
batchRPC.push(['z_getoperationresult', [[op.id]]]);
|
||||||
|
opidCount--;
|
||||||
|
opids.splice(opid_index, 1);
|
||||||
}
|
}
|
||||||
// log status to console
|
// log status to console
|
||||||
if (op.status == "failed") {
|
if (op.status == "failed") {
|
||||||
|
@ -498,8 +506,9 @@ function SetupForPool(logger, poolOptions, setupFinished){
|
||||||
}
|
}
|
||||||
if (err === true) {
|
if (err === true) {
|
||||||
opidTimeout = setTimeout(checkOpids, opid_interval);
|
opidTimeout = setTimeout(checkOpids, opid_interval);
|
||||||
if (opidCount > 0) {
|
if (opidCount !== 0) {
|
||||||
opidCount = 0;
|
opidCount = 0;
|
||||||
|
opids = [];
|
||||||
logger.warning(logSystem, logComponent, 'Clearing operation ids due to RPC call errors.');
|
logger.warning(logSystem, logComponent, 'Clearing operation ids due to RPC call errors.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue