Skip to content
Snippets Groups Projects
Commit fb73ef6b authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[fix] #786 block_hash is not present

parent 73aa26c1
Branches
Tags
No related merge requests found
...@@ -293,18 +293,19 @@ function FileDAL(params) { ...@@ -293,18 +293,19 @@ function FileDAL(params) {
const certs = yield that.certDAL.getToTarget(hash); const certs = yield that.certDAL.getToTarget(hash);
const links = yield that.cindexDAL.getValidLinksTo(pub); const links = yield that.cindexDAL.getValidLinksTo(pub);
let matching = certs; let matching = certs;
links.map((entry) => { yield links.map((entry) => co(function*() {
entry.from = entry.issuer; entry.from = entry.issuer;
const cbt = entry.created_on.split('-');
const wbt = entry.written_on.split('-'); const wbt = entry.written_on.split('-');
entry.block = parseInt(cbt[0]); const blockNumber = parseInt(entry.created_on); // created_on field of `c_index` does not have the full blockstamp
entry.block_number = parseInt(cbt[0]); const basedBlock = yield that.getBlock(blockNumber);
entry.block_hash = cbt[1]; entry.block = blockNumber;
entry.block_number = blockNumber;
entry.block_hash = basedBlock ? basedBlock.hash : null;
entry.linked = true; entry.linked = true;
entry.written_block = parseInt(wbt[0]); entry.written_block = parseInt(wbt[0]);
entry.written_hash = wbt[1]; entry.written_hash = wbt[1];
matching.push(entry); matching.push(entry);
}); }));
matching = _.sortBy(matching, (c) => -c.block); matching = _.sortBy(matching, (c) => -c.block);
matching.reverse(); matching.reverse();
return matching; return matching;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment