Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
1 lines (1 sloc) 439 Bytes
var lastReward=AT.getBlockTimestamp();var bestTxid,bestTicket;var amnt=0;AT.setInterval(function(){bestTxid=0;bestTicket=MAX_INT;amnt=0;AT.foreachTx(lastReward,AT.getBlockTimestamp(-2),function(txid){if(AT.getTxTarget(txid)==AT.getAddress()){amnt+=AT.getTxAmount(txid);if(bestTicket>AT.getTicket(txid)){bestTicket=AT.getTicket(txid);bestTxid=txid}}});AT.transfer(amnt,AT.getTxSource(bestTxid));lastReward=AT.getBlockTimestamp(-1)},60*24/4)