Skip to content

Commit

Permalink
Store payment information in redis for future front-end display usage
Browse files Browse the repository at this point in the history
  • Loading branch information
zone117x committed Jul 9, 2014
1 parent ec93551 commit f0717a3
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions config_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"enabled": true,
"interval": 600,
"maxAddresses": 50,
"mixin": 3,
"transferFee": 5000000000,
"minPayment": 100000000000,
"denomination": 100000000000
Expand Down
2 changes: 1 addition & 1 deletion lib/configReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
29 changes: 28 additions & 1 deletion lib/paymentProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
});
Expand All @@ -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){
Expand All @@ -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){
Expand Down
9 changes: 4 additions & 5 deletions website_example/pages/pool_blocks.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit f0717a3

Please sign in to comment.