bitagora-booth
Advanced tools
Comparing version 1.0.155 to 1.0.156
23
booth.js
@@ -207,24 +207,27 @@ /** | ||
for (var i=0; i<apis.length; i++) { | ||
let result = await postVote(bytes, apis[i]).catch(() => { }); | ||
let result = await postVote(bytes, apis[i]).catch(() => { return false }); | ||
console.log("Result from calling API "+apis[i]); | ||
response = result; | ||
if (Boolean(response)) { | ||
if (result) { | ||
console.log("Received response"); | ||
console.log(response); | ||
if ( response.status == 'COMMITTED' ) { | ||
console.log(result); | ||
if ( result.status == 'COMMITTED' ) { | ||
console.log("Submission committed"); | ||
response = result; | ||
break; | ||
} else if ( response.status == 'PENDING' ) { | ||
} else if ( result.status == 'PENDING' ) { | ||
console.log("Submission pending. Waiting for confirmation"); | ||
link = apis[i] + "/batch_statuses?id=" + response.id; | ||
link = apis[i] + "/batch_statuses?id=" + result.id; | ||
console.log(link); | ||
response = await confirmSubmission(link); | ||
response = await confirmSubmission(link).catch(() => { return { status: 'ERROR' } }); | ||
console.log("Confirmed submission response"); | ||
console.log(response); | ||
if (Boolean(response) && Boolean(response.status) && (response.status == 'COMMITTED')) break; | ||
} else if (response.status == 'INVALID' ) { | ||
if (response.invalid_transactions[0].message == 'InvalidTransaction: Invalid Action: Vote already cast') response.status = 'COMMITTED'; | ||
} else if (result.status == 'INVALID' ) { | ||
response = result; | ||
if (response.invalid_transactions[0].message.indexOf('Vote already cast') != -1) response.status = 'COMMITTED'; | ||
console.log("Submission invalid. Breaking."); | ||
break; | ||
} | ||
} else { | ||
console.log("No response"); | ||
} | ||
@@ -231,0 +234,0 @@ } |
{ | ||
"name": "bitagora-booth", | ||
"version": "1.0.155", | ||
"version": "1.0.156", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "author": "Ignasi Ribó, 2018", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77059
2897