Skip to content

Commit

Permalink
added more custom coin functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
uaktags committed Jul 15, 2021
1 parent a6dec3e commit d8feeb1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 139 deletions.
13 changes: 1 addition & 12 deletions lib/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,18 +510,6 @@ module.exports = {
});
},

/* get_last_txs_ajax: function(start, length, cb) {
Tx.countDocuments({'total': {$gt: 1}}, function(err, count){
Tx.find({'total': {$gt: 1}}).sort({blockindex: 'desc'}).skip(Number(start)).limit(Number(length)).exec(function(err, txs){
if (err) {
return cb(err);
} else {
return cb(txs, count);
}
});
});
},*/

get_address_txs_ajax: function(hash, start, length, cb) {
var totalCount = 0;
Address.findOne({a_id: hash}, function(err, addressTotalTxs) {
Expand All @@ -547,6 +535,7 @@ module.exports = {

lib.syncLoop(count, function (loop) {
var i = loop.iteration();
console.log(hashes[i]);
find_tx(hashes[i].addresses, function (tx) {
if (tx) {
txs.push(tx);
Expand Down
23 changes: 22 additions & 1 deletion lib/explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,28 @@ module.exports = {
if (settings.index.show_hashrate == false) return cb('-');
rpcCommand([{method: coin.getNetHash(), parameters: []}], function(response){
if (response == 'There was an error. Check your console.') { return cb(response);}
return cb(coin.getNetHashCalculation(response));
if((coin.hasOwnProperty('useCustomNetHashCalculation') && coin.useCustomNetHashCalculation()) && coin.hasOwnProperty('getNetHashCalculation')){
return cb(coin.getNetHashCalculation(response));
}else{
if (response) {
response = parseFloat(response);
if (settings.nethash_units == 'K') {
return cb((response / 1000).toFixed(4));
} else if (settings.nethash_units == 'M'){
return cb((response / 1000000).toFixed(4));
} else if (settings.nethash_units == 'G') {
return cb((response / 1000000000).toFixed(4));
} else if (settings.nethash_units == 'T') {
return cb((response / 1000000000000).toFixed(4));
} else if (settings.nethash_units == 'P') {
return cb((response / 1000000000000000).toFixed(4));
} else {
return cb((response).toFixed(4));
}
} else {
return cb('-');
}
}
});
},

Expand Down
126 changes: 0 additions & 126 deletions lib/jsonrpc.js

This file was deleted.

0 comments on commit d8feeb1

Please sign in to comment.