get tx fee paid from transaction made by sendmany
This commit is contained in:
parent
b73b6a828e
commit
b5c9d0174b
@ -345,13 +345,13 @@ function SetupForPool(logger, poolOptions){
|
|||||||
finalRedisCommands.push(['hincrbyfloat', coin + '_stats', 'totalPaid', (toBePaid / magnitude).toFixed(coinPrecision)]);
|
finalRedisCommands.push(['hincrbyfloat', coin + '_stats', 'totalPaid', (toBePaid / magnitude).toFixed(coinPrecision)]);
|
||||||
|
|
||||||
|
|
||||||
callback(null, magnitude, results[0].response, workerPayments, finalRedisCommands);
|
callback(null, magnitude, workerPayments, finalRedisCommands);
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
function(magnitude, balanceBefore, workerPayments, finalRedisCommands, callback){
|
function(magnitude, workerPayments, finalRedisCommands, callback){
|
||||||
|
|
||||||
//This does the final all-or-nothing atom transaction if block deamon sent payments
|
//This does the final all-or-nothing atom transaction if block deamon sent payments
|
||||||
var finalizeRedisTx = function(){
|
var finalizeRedisTx = function(){
|
||||||
@ -388,21 +388,21 @@ function SetupForPool(logger, poolOptions){
|
|||||||
var totalWorkers = Object.keys(workerPayments).length;
|
var totalWorkers = Object.keys(workerPayments).length;
|
||||||
logger.debug(logSystem, logComponent, 'Payments sent, a total of ' + totalAmountUnits + ' ' + poolOptions.coin.symbol +
|
logger.debug(logSystem, logComponent, 'Payments sent, a total of ' + totalAmountUnits + ' ' + poolOptions.coin.symbol +
|
||||||
' was sent to ' + totalWorkers + ' miners');
|
' was sent to ' + totalWorkers + ' miners');
|
||||||
setTimeout(function() { // not sure if we need some time to let daemon update the wallet balance
|
daemon.cmd('gettransaction', [results[0].response], function(results){
|
||||||
daemon.cmd('getbalance', [''], function(results){
|
if (results[0].error){
|
||||||
var balanceDiff = balanceBefore - results[0].response;
|
callback('Check finished - error with gettransaction ' + JSON.stringify(results[0].error));
|
||||||
var txFee = balanceDiff - totalAmountUnits;
|
return;
|
||||||
var feeAmountUnits = parseFloat((totalAmountUnits / (1 - processingConfig.feePercent) * processingConfig.feePercent).toFixed(coinPrecision));
|
}
|
||||||
var poolFees = feeAmountUnits - txFee;
|
var feeAmountUnits = parseFloat((totalAmountUnits / (1 - processingConfig.feePercent) * processingConfig.feePercent).toFixed(coinPrecision));
|
||||||
daemon.cmd('move', ['', processingConfig.feeCollectAccount, poolFees], function(results){
|
var poolFees = feeAmountUnits - results[0].response.fee;
|
||||||
if (results[0].error){
|
daemon.cmd('move', ['', processingConfig.feeCollectAccount, poolFees], function(results){
|
||||||
callback('Check finished - error with move ' + JSON.stringify(results[0].error));
|
if (results[0].error){
|
||||||
return;
|
callback('Check finished - error with move ' + JSON.stringify(results[0].error));
|
||||||
}
|
return;
|
||||||
callback(null, poolFees + ' ' + poolOptions.coin.symbol + ' collected as pool fee');
|
}
|
||||||
});
|
callback(null, poolFees + ' ' + poolOptions.coin.symbol + ' collected as pool fee');
|
||||||
});
|
});
|
||||||
}, 1000);
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user