forked from Mirrors/doipjs
Fix verification logic
This commit is contained in:
parent
f64f9cff58
commit
2c722d31a9
2 changed files with 9 additions and 7 deletions
14
src/claim.js
14
src/claim.js
|
@ -251,7 +251,9 @@ class Claim {
|
||||||
|
|
||||||
// Post process the data
|
// Post process the data
|
||||||
if (claimData.functions && claimData.functions.postprocess) {
|
if (claimData.functions && claimData.functions.postprocess) {
|
||||||
({ claimData, proofData } = claimData.functions.postprocess(claimData, proofData))
|
try {
|
||||||
|
({ claimData, proofData } = claimData.functions.postprocess(claimData, proofData))
|
||||||
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Consider the proof completed but with a negative result
|
// Consider the proof completed but with a negative result
|
||||||
|
@ -261,11 +263,11 @@ class Claim {
|
||||||
proof: {},
|
proof: {},
|
||||||
errors: [proofFetchError]
|
errors: [proofFetchError]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isAmbiguous()) {
|
if (this.isAmbiguous() && !verificationResult.result) {
|
||||||
// Assume a wrong match and continue
|
// Assume a wrong match and continue
|
||||||
continue
|
continue
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verificationResult.completed) {
|
if (verificationResult.completed) {
|
||||||
|
@ -283,7 +285,7 @@ class Claim {
|
||||||
result: false,
|
result: false,
|
||||||
completed: true,
|
completed: true,
|
||||||
proof: {},
|
proof: {},
|
||||||
errors: ['Unknown error']
|
errors: []
|
||||||
}
|
}
|
||||||
|
|
||||||
this._status = E.ClaimStatus.VERIFIED
|
this._status = E.ClaimStatus.VERIFIED
|
||||||
|
|
|
@ -172,7 +172,7 @@ const runJSON = async (proofData, checkPath, checkClaim, checkClaimFormat, check
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(checkPath[0] in proofData)) {
|
if (typeof proofData === 'object' && !(checkPath[0] in proofData)) {
|
||||||
throw new Error('err_json_structure_incorrect')
|
throw new Error('err_json_structure_incorrect')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue