mirror of https://github.com/BTCPrivate/z-nomp.git
Work on payment processing
This commit is contained in:
parent
916201f128
commit
e62293ed2e
|
@ -80,17 +80,21 @@ function SetupForPool(logger, poolOptions){
|
|||
daemon.cmd('gettransaction', [tx], function(results){
|
||||
//console.dir(results[0].response.details[0].category);
|
||||
var status = results[0].response.details[0].category;
|
||||
var confirmed = (status === 'generate');
|
||||
var amount = results[0].response.details[0].amount;
|
||||
if (status !== 'generate') return;
|
||||
var f = 'shares_' + coin + ':round' + blockHeight;
|
||||
console.log(f);
|
||||
redisClient.hgetall('shares_' + coin + ':round' + blockHeight, function(error, results){
|
||||
if (error || !results) return;
|
||||
console.log('okay ' + JSON.stringify(results));
|
||||
|
||||
/* next:
|
||||
- get contributed shares
|
||||
- get unsent payments
|
||||
- calculate payments
|
||||
- send payments
|
||||
- put unsent payments in db
|
||||
- remove tx from db
|
||||
- remove shares from db
|
||||
*/
|
||||
//get balances_coin from redis for each address in this round
|
||||
//add up total balances
|
||||
//send necessary payments
|
||||
//put left over balances in redis
|
||||
//clean up (move block entry to processedBlocks_coin) so this logic isn't called again
|
||||
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -52,12 +52,15 @@ module.exports = function(logger, poolConfig){
|
|||
|
||||
if (!isValidShare) return;
|
||||
|
||||
connection.hincrby(['shares_' + coin + ':' + shareData.height, shareData.worker, shareData.difficulty], function(error, result){
|
||||
connection.hincrby(['shares_' + coin + ':roundCurrent', shareData.worker, shareData.difficulty], function(error, result){
|
||||
if (error)
|
||||
logger.error('redis', 'Could not store worker share')
|
||||
});
|
||||
|
||||
if (isValidBlock){
|
||||
connection.rename('shares_' + coin + ':roundCurrent', 'shares_' + coin + ':round' + shareData.height, function(result){
|
||||
console.log('rename result: ' + result);
|
||||
});
|
||||
connection.sadd(['blocks_' + coin, shareData.tx + ':' + shareData.height], function(error, result){
|
||||
if (error)
|
||||
logger.error('redis', 'Could not store block data');
|
||||
|
|
Loading…
Reference in New Issue