Store payment information in redis for future front-end display usage

pull/3/head
Matthew Little 2014-07-08 17:55:39 -07:00
parent ec93551a2b
commit f0717a3646
5 changed files with 35 additions and 7 deletions

View File

@ -232,6 +232,7 @@ Explanation for each field:
"enabled": true,
"interval": 600, //how often to run in seconds
"maxAddresses": 50, //split up payments if sending to more than this many addresses
"mixin": 3, //number of transactions yours is indistinguishable from
"transferFee": 5000000000, //fee to pay for each transaction
"minPayment": 100000000000, //miner balance required before sending payment
"denomination": 100000000000 //truncate to this precision and store remainder

View File

@ -64,6 +64,7 @@
"enabled": true,
"interval": 600,
"maxAddresses": 50,
"mixin": 3,
"transferFee": 5000000000,
"minPayment": 100000000000,
"denomination": 100000000000

View File

@ -17,6 +17,6 @@ catch(e){
return;
}
global.version = "v0.99.2.3";
global.version = "v0.99.2.4";
global.devDonationAddress = '45Jmf8PnJKziGyrLouJMeBFw2yVyX1QB52sKEQ4S1VSU2NVsaVGPNu4bWKkaHaeZ6tWCepP6iceZk8XhTLzDaEVa72QrtVh';
global.doDonations = config.blockUnlocker.devDonation > 0 && devDonationAddress[0] === config.poolServer.poolAddress[0];

View File

@ -77,10 +77,11 @@ function runInterval(){
for (var i = 0; i < transferCommandsLength; i++){
transferCommands.push({
redis: [],
amount : 0,
rpc: {
destinations: [],
fee: config.payments.transferFee,
mixin: 0,
mixin: config.payments.mixin,
unlock_time: 0
}
});
@ -94,6 +95,7 @@ function runInterval(){
transferCommands[commandIndex].rpc.destinations.push({amount: amount, address: worker});
transferCommands[commandIndex].redis.push(['hincrby', config.coin + ':workers:' + worker, 'balance', -amount]);
transferCommands[commandIndex].redis.push(['hincrby', config.coin + ':workers:' + worker, 'paid', amount]);
transferCommands[commandIndex].amount += amount;
addresses++;
if (addresses >= config.payments.maxAddresses){
@ -110,6 +112,31 @@ function runInterval(){
cback(false);
return;
}
var now = Date.now() / 1000 | 0;
var txHash = result.tx_hash.replace('<', '').replace('>', '');
transferCmd.redis.push(['zadd', config.coin + ':payments:all', now, [
txHash,
transferCmd.amount,
transferCmd.rpc.fee,
transferCmd.rpc.mixin,
Object.keys(transferCmd.rpc.destinations).length
].join(':')]);
for (var i = 0; i < transferCmd.rpc.destinations.length; i++){
var destination = transferCmd.rpc.destinations[i];
transferCmd.redis.push(['zadd', config.coin + ':payments:' + destination.address, now, [
txHash,
destination.amount,
transferCmd.rpc.fee,
transferCmd.rpc.mixin
].join(':')]);
}
log('info', logSystem, 'Payments sent via wallet daemon %j', [result]);
redisClient.multi(transferCmd.redis).exec(function(error, replies){
if (error){

View File

@ -44,13 +44,12 @@
</tbody>
</table>
<p class="text-center">
<button type="button" class="btn btn-default" id="loadMoreBlocks">Load More</button>
</p>
</div>
<p class="text-center">
<button type="button" class="btn btn-default" id="loadMoreBlocks">Load More</button>
</p>
<script>
currentPage = {