From 2edf59fae8f20c14eef8b157a3b9c44fd49ad6bd Mon Sep 17 00:00:00 2001 From: Elliot Lee Date: Thu, 2 Aug 2018 12:21:23 -0700 Subject: [PATCH] Ignore initial result of tx submission (RLJS-607) --- .../rippleapi_quickstart/submit-and-verify.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/content/_code-samples/rippleapi_quickstart/submit-and-verify.js b/content/_code-samples/rippleapi_quickstart/submit-and-verify.js index 57c061573e..b243bfee97 100644 --- a/content/_code-samples/rippleapi_quickstart/submit-and-verify.js +++ b/content/_code-samples/rippleapi_quickstart/submit-and-verify.js @@ -1,7 +1,6 @@ 'use strict'; /* import RippleAPI and support libraries */ const RippleAPI = require('ripple-lib').RippleAPI; -const assert = require('assert'); /* Credentials of the account placing the order */ const myAddr = 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn'; @@ -32,7 +31,7 @@ const myInstructions = {maxLedgerVersionOffset: ledgerOffset}; /* Verify a transaction is in a validated XRP Ledger version */ function verifyTransaction(hash, options) { - console.log('Verifing Transaction'); + console.log('Verifying Transaction'); return api.getTransaction(hash, options).then(data => { console.log('Final Result: ', data.outcome.result); console.log('Validated in Ledger: ', data.outcome.ledgerVersion); @@ -58,11 +57,10 @@ function submitTransaction(lastClosedLedgerVersion, prepared, secret) { return api.submit(signedData.signedTransaction).then(data => { console.log('Tentative Result: ', data.resultCode); console.log('Tentative Message: ', data.resultMessage); - /* If transaction was not successfully submitted throw error */ - assert.strictEqual(data.resultCode, 'tesSUCCESS'); - /* 'tesSUCCESS' means the transaction is being considered for the next ledger, and requires validation. */ + /* The tentative result should be ignored. Transactions that succeed here can ultimately fail, + and transactions that fail here can ultimately succeed. */ - /* If successfully submitted, begin validation workflow */ + /* Begin validation workflow */ const options = { minLedgerVersion: lastClosedLedgerVersion, maxLedgerVersion: prepared.instructions.maxLedgerVersion