Use Tickets: better handling of non-validation

This commit is contained in:
mDuo13
2021-01-14 18:26:27 -08:00
parent b3ce979a16
commit bb46c3206e

View File

@@ -312,12 +312,13 @@ api.on('ledger', async (ledger) => {
tx_result = await api.request("tx", { tx_result = await api.request("tx", {
"transaction": waiting_for_tx, "transaction": waiting_for_tx,
"min_ledger": parseInt($("#earliest-ledger-version").text()), "min_ledger": parseInt($("#earliest-ledger-version").text()),
"max_ledger": parseInt(ledger.ledgerVersion) "max_ledger": parseInt($("#lastledgersequence").text())
}) })
console.log(tx_result) console.log(tx_result)
if (tx_result.validated) { if (tx_result.validated) {
$("#tx-validation-status").html( $("#tx-validation-status").html(
`<th>Final Result:</th><td>${tx_result.meta.TransactionResult} (Validated)</td>`) `<th>Final Result:</th><td>${tx_result.meta.TransactionResult} (Validated)</td>`)
waiting_for_tx = null;
if ( $(".breadcrumb-item.bc-wait").hasClass("active") ) { if ( $(".breadcrumb-item.bc-wait").hasClass("active") ) {
complete_step("Wait") complete_step("Wait")
@@ -325,9 +326,16 @@ api.on('ledger', async (ledger) => {
$("#check-tickets").prop("title", "") $("#check-tickets").prop("title", "")
} }
} }
} catch(error) { // TODO: handle the case described in https://github.com/ripple/rippled/issues/3727
console.error(error); } catch(e) {
// TODO: catch final failures here if possible if (e.data.error == "txnNotFound" && e.data.searched_all) {
$("#tx-validation-status").html(
`<th>Final Result:</th><td>Failed to achieve consensus (final)</td>`)
waiting_for_tx = null;
} else {
$("#tx-validation-status").html(
`<th>Final Result:</th><td>Unknown</td>`)
}
} }
} }