mirror of https://github.com/BTCPrivate/z-nomp.git
Update paymentProcessor.js
Updates to comments in code...
This commit is contained in:
parent
241bdea7ee
commit
c0f66c0b29
|
@ -736,6 +736,7 @@ function SetupForPool(logger, poolOptions, setupFinished){
|
||||||
}
|
}
|
||||||
// account feature not implemented at this time
|
// account feature not implemented at this time
|
||||||
addressAccount = "";
|
addressAccount = "";
|
||||||
|
// begin payments for generated coins
|
||||||
callback(null, workers, rounds, addressAccount);
|
callback(null, workers, rounds, addressAccount);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -945,32 +946,39 @@ function SetupForPool(logger, poolOptions, setupFinished){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// perform the sendmany operation
|
// POINT OF NO RETURN! GOOD LUCK!
|
||||||
|
// WE ARE SENDING PAYMENT CMD TO DAEMON
|
||||||
|
|
||||||
|
// perform the sendmany operation .. addressAccount
|
||||||
daemon.cmd('sendmany', ["", addressAmounts], function (result) {
|
daemon.cmd('sendmany', ["", addressAmounts], function (result) {
|
||||||
// check for failed payments, there are many reasons
|
// check for failed payments, there are many reasons
|
||||||
if (result.error && result.error.code === -6) {
|
if (result.error && result.error.code === -6) {
|
||||||
// not enough minerals...
|
// we thought we had enough funds to send payments, but apparently not...
|
||||||
var higherPercent = withholdPercent + 0.01;
|
// try decreasing payments by a small percent to cover unexpected tx fees?
|
||||||
logger.warning(logSystem, logComponent, 'Not enough funds to cover the tx fees for sending out payments, decreasing rewards by '
|
var higherPercent = withholdPercent + 0.001;
|
||||||
+ (higherPercent * 100) + '% and retrying');
|
logger.warning(logSystem, logComponent, 'Not enough funds to cover the tx fees for sending out payments, decreasing rewards by ' + (higherPercent * 100) + '% and retrying');
|
||||||
|
|
||||||
trySend(higherPercent);
|
trySend(higherPercent);
|
||||||
|
//callback(true); not a complete failure...
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (result.error && result.error.code === -5) {
|
else if (result.error && result.error.code === -5) {
|
||||||
// invalid address specified in addressAmounts array
|
// invalid address specified in addressAmounts array
|
||||||
logger.error(logSystem, logComponent, 'Error sending payments ' + result.error.message);
|
logger.error(logSystem, logComponent, 'Error sending payments ' + result.error.message);
|
||||||
|
// payment failed, prevent updates to redis
|
||||||
callback(true);
|
callback(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (result.error && result.error.message != null) {
|
else if (result.error && result.error.message != null) {
|
||||||
// unknown error from daemon
|
// error from daemon
|
||||||
logger.error(logSystem, logComponent, 'Error sending payments ' + result.error.message);
|
logger.error(logSystem, logComponent, 'Error sending payments ' + result.error.message);
|
||||||
|
// payment failed, prevent updates to redis
|
||||||
callback(true);
|
callback(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (result.error) {
|
else if (result.error) {
|
||||||
// some other unknown error
|
// unknown error
|
||||||
logger.error(logSystem, logComponent, 'Error sending payments ' + JSON.stringify(result.error));
|
logger.error(logSystem, logComponent, 'Error sending payments ' + JSON.stringify(result.error));
|
||||||
|
// payment failed, prevent updates to redis
|
||||||
callback(true);
|
callback(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue