diff --git a/content/code_samples/rippleapi_quickstart/submit-and-verify.js b/content/code_samples/rippleapi_quickstart/submit-and-verify.js index c7ec4a916d..6f3db8f2ba 100644 --- a/content/code_samples/rippleapi_quickstart/submit-and-verify.js +++ b/content/code_samples/rippleapi_quickstart/submit-and-verify.js @@ -1,5 +1,5 @@ 'use strict'; -/* import RippleAPI and support libraies*/ +/* import RippleAPI and support libraries */ const RippleAPI = require('ripple-lib').RippleAPI; const assert = require('assert'); @@ -90,4 +90,3 @@ api.connect().then(() => { process.exit(); }); }).catch(console.error); - diff --git a/tutorial-rippleapi-beginners-guide.html b/tutorial-rippleapi-beginners-guide.html index 402b9e6b88..fb20e0b7d6 100644 --- a/tutorial-rippleapi-beginners-guide.html +++ b/tutorial-rippleapi-beginners-guide.html @@ -281,7 +281,7 @@ const RippleAPI = require('ripple-lib').RippleAPI;

Waiting for Validation

One of the biggest challenges in using the Ripple Consensus Ledger (or any decentralized system) is knowing the final, immutable transaction results. Even if you follow the best practices you still have to wait for the consensus process to finally accept or reject your transaction. The following example code demonstrates how to wait for the final outcome of a transaction:

'use strict';
-/* import RippleAPI and support libraies*/
+/* import RippleAPI and support libraries */
 const RippleAPI = require('ripple-lib').RippleAPI;
 const assert = require('assert');
 
@@ -372,7 +372,6 @@ api.connect().then(() => {
     process.exit();
   });
 }).catch(console.error);
-
 

This code creates and submits an order transaction, although the same principles apply to other types of transactions as well. After submitting the transaction, the code uses a new Promise, which queries the ledger again after using setTimeout to wait a fixed amount of time, to see if the transaction has been verified. If it hasn't been verified, the process repeats until either the transaction is found in a validated ledger or the returned ledger is higher than the LastLedgerSequence parameter.

In rare cases (particularly with a large delay or a loss of power), the rippled server may be missing a ledger version between when you submitted the transaction and when you determined that the network has passed the maxLedgerVersion. In this case, you cannot be definitively sure whether the transaction has failed, or has been included in one of the missing ledger versions. RippleAPI returns MissingLedgerHistoryError in this case.