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

Hotfix: wrong certifications were included in blocks

parent d2fb1910
Branches
Tags
No related merge requests found
...@@ -549,6 +549,21 @@ function NextBlockGenerator(conf, dal) { ...@@ -549,6 +549,21 @@ function NextBlockGenerator(conf, dal) {
// The block above which (above from current means blocks with number < current) // The block above which (above from current means blocks with number < current)
const blockOfChainability = current ? (yield dal.getChainabilityBlock(current.medianTime, conf.sigPeriod)) : null; const blockOfChainability = current ? (yield dal.getChainabilityBlock(current.medianTime, conf.sigPeriod)) : null;
for (const cert of certs) { for (const cert of certs) {
const targetIdty = yield dal.getIdentityByHashOrNull(cert.target);
// The identity must be known
if (targetIdty) {
const certSig = cert.sig;
cert.sig = '';
cert.currency = conf.currency;
cert.issuer = cert.from;
cert.idty_issuer = targetIdty.pubkey;
cert.idty_uid = targetIdty.uid;
cert.idty_buid = targetIdty.buid;
cert.idty_sig = targetIdty.sig;
cert.buid = [cert.block_number, cert.block_hash].join('-');
const rawCert = Certification.statics.fromJSON(cert).getRaw();
if (keyring.verify(rawCert, certSig, cert.from)) {
cert.sig = certSig;
let exists = false; let exists = false;
if (current) { if (current) {
// Already exists a link not replayable yet? // Already exists a link not replayable yet?
...@@ -575,6 +590,8 @@ function NextBlockGenerator(conf, dal) { ...@@ -575,6 +590,8 @@ function NextBlockGenerator(conf, dal) {
} }
} }
} }
}
}
return updates; return updates;
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment