Skip to content

Commit 2d35ab5

Browse files
committed
stash commit (DO NOT MERGE)
1 parent 08b3f98 commit 2d35ab5

File tree

5 files changed

+40
-18
lines changed

5 files changed

+40
-18
lines changed

config.json

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
{
22
"nodeAddr": "localhost",
3-
"gethPort": 8545,
3+
"gethPort": 9547,
44
"startBlock": 0,
5+
"endBlock": "latest",
56
"quiet": true,
6-
"syncAll": true,
7-
"patch": true,
7+
"syncAll": false,
8+
"patch": false,
89
"patchBlocks": 100,
910
"settings": {
1011
"symbol": "ETC",
1112
"name": "Ethereum Classic",
1213
"title": "Ethereum Classic Block Explorer",
1314
"author": "Elaine",
1415
"miners": {
15-
"0xdf7d7e053933b5cc24372f878c90e62dadad5d42": "EtherMine",
16-
"0xc91716199ccde49dc4fafaeb68925127ac80443f": "F2Pool",
17-
"0x9eab4b0fc468a7f5d46228bf5a76cb52370d068d": "NanoPool",
18-
"0x8c5535afdbdeea80adedc955420f684931bf91e0": "MiningPoolHub",
19-
"0x4750e296949b747df1585aa67beee8be903dd560": "UUPool",
20-
"0xef224fa5fad302b51f38898f4df499d7af127af0": "91pool",
21-
"0x00d29bfdf5f8d2d0466da4b948f37692ca50867a": "2miners",
22-
"0x4c2b4e716883a2c3f6b980b70b577e54b9441060": "ETCPool PL",
23-
"0xd144e30a0571aaf0d0c050070ac435deba461fab": "Clona Network"
16+
"0xe3ec5ebd3e822c972d802a0ee4e0ec080b8237ba": "SejunPool",
17+
"0xc734480388db099cb43fd1c3ed530b39b9d8d567": "GonsPool",
18+
"0x2eb64b8ab13f0d7823158217d15ba310ed3d0e58": "TopMining",
19+
"0x0b292a321fe5e20cc943648a782184f8ab44d2eb": "MoricPool",
20+
"0x2930822031420731f09dce572554a8b8c1eaa09b": "Gonsmine",
21+
"0xfc35930abb108ae6cae33fd065dfb799808ea326": "Comining",
22+
"0x90d7c82615f151953a8d71a68096cee4d428619c": "privatePool"
2423
}
2524
}
26-
}
25+
}

public/js/controllers/AddressController.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ angular.module('BlocksApp').controller('AddressController', function($stateParam
99

1010
$rootScope.$state.current.data["pageSubTitle"] = $stateParams.hash;
1111
$scope.addrHash = $stateParams.hash;
12-
$scope.addr = {"balance": 0, "count": 0};
12+
$scope.addr = {"balance": 0, "count": 0, "mined": 0};
1313
$scope.settings = $rootScope.setup;
1414

1515
//fetch web3 stuff
@@ -18,7 +18,7 @@ angular.module('BlocksApp').controller('AddressController', function($stateParam
1818
url: '/web3relay',
1919
data: {"addr": $scope.addrHash, "options": ["balance", "count", "bytecode"]}
2020
}).success(function(data) {
21-
$scope.addr = data;
21+
$scope.addr = $.extend($scope.addr, data);
2222
fetchTxs($scope.addr.count);
2323
if (data.isContract) {
2424
$rootScope.$state.current.data["pageTitle"] = "Contract Address";
@@ -80,6 +80,9 @@ angular.module('BlocksApp').controller('AddressController', function($stateParam
8080
return getDuration(data).toString();
8181
}, "targets": [6]},
8282
]
83+
}).on('xhr', function(e, settings, json) {
84+
$scope.addr.count = json.recordsTotal;
85+
$scope.addr.mined = parseInt(json.mined);
8386
});
8487
}
8588

public/views/address.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</span> <a href="http://etherscan.io/address/{{addrHash}}" target="_blank"><i class="fa fa-external-link"></i></a>
1919
</div>
2020
<div class="margin-top-20">
21-
0 <span class="eth-stat-text">Mined</span>
21+
{{ addr.mined }} <span class="eth-stat-text">Mined</span>
2222
</div>
2323
<div class="margin-top-20">
2424
{{ addr.count }} <span class="eth-stat-text">Transactions</span>

routes/index.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var getAddr = function(req, res){
4444
var limit = parseInt(req.body.length);
4545
var start = parseInt(req.body.start);
4646

47-
var data = { draw: parseInt(req.body.draw), recordsFiltered: count, recordsTotal: count };
47+
var data = { draw: parseInt(req.body.draw), recordsFiltered: count, recordsTotal: count, mined: 0 };
4848

4949
var addrFind = Transaction.find( { $or: [{"to": addr}, {"from": addr}] })
5050

@@ -58,6 +58,25 @@ var getAddr = function(req, res){
5858
}
5959
}
6060

61+
Transaction.aggregate([
62+
{$match: { $or: [{"to": addr}, {"from": addr}] }},
63+
{$group: { _id: null, count: { $sum: 1 } }}
64+
]).exec(function(err, results) {
65+
if (!err && results && results.length > 0) {
66+
// fix recordsTotal
67+
data.recordsTotal = results[0].count;
68+
data.recordsFiltered = results[0].count;
69+
}
70+
});
71+
72+
Block.aggregate([
73+
{ $match: { "miner": addr } },
74+
{ $group: { _id: '$miner', count: { $sum: 1 } }
75+
}]).exec(function(err, results) {
76+
if (!err && results && results.length > 0) {
77+
data.mined = results[0].count;
78+
console.log(results);
79+
}
6180
addrFind.lean(true).sort(sortOrder).skip(start).limit(limit)
6281
.exec("find", function (err, docs) {
6382
if (docs)
@@ -67,6 +86,7 @@ var getAddr = function(req, res){
6786
res.write(JSON.stringify(data));
6887
res.end();
6988
});
89+
});
7090

7191
};
7292
var getBlock = function(req, res) {

tools/stats.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var mongoose = require( 'mongoose' );
88
var BlockStat = require( '../db.js' ).BlockStat;
99

1010
var updateStats = function(range, interval, rescan) {
11-
var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));
11+
var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:9545'));
1212

1313
mongoose.connect(process.env.MONGO_URI || 'mongodb://localhost/blockDB');
1414
mongoose.set('debug', true);

0 commit comments

Comments
 (0)