Browse Source

bug/blockslistapi

generic-ui
Matias Alejo Garcia 11 years ago
parent
commit
4650418a73
  1. 13
      app/controllers/blocks.js
  2. 2
      public/views/block_list.html

13
app/controllers/blocks.js

@ -115,7 +115,18 @@ exports.list = function(req, res) {
for(var i=0;i<limit;i++) {
blockshashList.push(blocks[i].hash);
}
async.mapSeries(blockshashList, getBlock, function(err, allblocks) {
async.mapSeries(blockshashList,
function(hash, cb) {
getBlock(hash, function(err, info) {
return cb(err,{
height: info.height,
size: info.size,
hash: info.hash,
time: info.time,
txlength: info.tx.length,
});
});
}, function(err, allblocks) {
res.jsonp({
blocks: allblocks,
length: allblocks.length,

2
public/views/block_list.html

@ -42,7 +42,7 @@
<tr class="fader" data-ng-repeat='b in blocks'>
<td><a href="/block/{{b.hash}}">{{b.height}}</a></td>
<td>{{b.time * 1000 | date:'medium'}}</td>
<td>{{b.tx.length}}</td>
<td>{{b.txlength}}</td>
<td>{{b.size}}</td>
</tr>
</tbody>

Loading…
Cancel
Save