forked from Mirrors/doipjs
Ensure an output of the verification process
This commit is contained in:
parent
e718c02628
commit
41d3b16029
1 changed files with 15 additions and 7 deletions
22
src/claim.js
22
src/claim.js
|
@ -213,7 +213,7 @@ class Claim {
|
||||||
for (let index = 0; index < this._matches.length; index++) {
|
for (let index = 0; index < this._matches.length; index++) {
|
||||||
const claimData = this._matches[index]
|
const claimData = this._matches[index]
|
||||||
|
|
||||||
let verificationResult,
|
let verificationResult = null,
|
||||||
proofData = null,
|
proofData = null,
|
||||||
proofFetchError
|
proofFetchError
|
||||||
|
|
||||||
|
@ -235,18 +235,18 @@ class Claim {
|
||||||
viaProxy: proofData.viaProxy,
|
viaProxy: proofData.viaProxy,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.isAmbiguous()) {
|
|
||||||
// Assume a wrong match and continue
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Consider the proof completed but with a negative result
|
// Consider the proof completed but with a negative result
|
||||||
verificationResult = {
|
verificationResult = verificationResult ? verificationResult : {
|
||||||
result: false,
|
result: false,
|
||||||
completed: true,
|
completed: true,
|
||||||
proof: {},
|
proof: {},
|
||||||
errors: [proofFetchError],
|
errors: [proofFetchError],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.isAmbiguous()) {
|
||||||
|
// Assume a wrong match and continue
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verificationResult.completed) {
|
if (verificationResult.completed) {
|
||||||
|
@ -257,6 +257,14 @@ class Claim {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fail safe verification result
|
||||||
|
verificationResult = verificationResult ? verificationResult : {
|
||||||
|
result: false,
|
||||||
|
completed: true,
|
||||||
|
proof: {},
|
||||||
|
errors: ['Unknown error'],
|
||||||
|
}
|
||||||
|
|
||||||
this._status = E.ClaimStatus.VERIFIED
|
this._status = E.ClaimStatus.VERIFIED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue