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

[fix] #1379: missing code

parent d813d34d
Branches
Tags
No related merge requests found
...@@ -227,13 +227,16 @@ export class IdentityService extends FIFOService { ...@@ -227,13 +227,16 @@ export class IdentityService extends FIFOService {
written_hash: null, written_hash: null,
block: cert.block_number block: cert.block_number
} }
if (current && mCert.expires_on < current.medianTime) {
throw DataErrors[DataErrors.CERT_WINDOW_IS_PASSED]
}
let existingCert = await this.dal.existsCert(mCert, current) let existingCert = await this.dal.existsCert(mCert, current)
if (!existingCert) { if (!existingCert) {
if (!(await this.dal.certDAL.getSandboxForKey(cert.from).acceptNewSandBoxEntry(mCert, this.conf.pair && this.conf.pair.pub))) { if (!(await this.dal.certDAL.getSandboxForKey(cert.from).acceptNewSandBoxEntry(mCert, this.conf.pair && this.conf.pair.pub))) {
throw constants.ERRORS.SANDBOX_FOR_CERT_IS_FULL; throw constants.ERRORS.SANDBOX_FOR_CERT_IS_FULL;
} }
await this.dal.registerNewCertification(mCert) await this.dal.registerNewCertification(mCert)
this.logger.info('✔ CERT %s', mCert.from); this.logger.info('✔ CERT %s block#%s -> %s', cert.from, cert.block_number, idty.uid)
} else { } else {
throw constants.ERRORS.ALREADY_UP_TO_DATE; throw constants.ERRORS.ALREADY_UP_TO_DATE;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment