mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
Do not return non-validated transaction from RippleAPI#getTransaction
This commit is contained in:
@@ -57,6 +57,11 @@ function getTransactionAsync(identifier: string, options: TransactionOptions,
|
||||
|
||||
function callbackWrapper(error_?: Error, tx?: Object) {
|
||||
let error = error_;
|
||||
|
||||
if (!error && tx && tx.validated !== true) {
|
||||
return callback(new errors.NotFoundError('Transaction not found'));
|
||||
}
|
||||
|
||||
if (error instanceof RippleError && error.remote &&
|
||||
error.remote.error === 'txnNotFound') {
|
||||
error = new errors.NotFoundError('Transaction not found');
|
||||
|
||||
@@ -217,9 +217,11 @@ describe('RippleAPI', function() {
|
||||
it('getTransaction - not validated', function() {
|
||||
const hash =
|
||||
'4FB3ADF22F3C605E23FAEFAA185F3BD763C4692CAC490D9819D117CD33BFAA10';
|
||||
return this.api.getTransaction(hash).then(
|
||||
_.partial(checkResult, responses.getTransaction.notValidated,
|
||||
'getTransaction'));
|
||||
return this.api.getTransaction(hash).then(() => {
|
||||
assert(false, 'Should throw NotFoundError');
|
||||
}).catch(error => {
|
||||
assert(error instanceof this.api.errors.NotFoundError);
|
||||
});
|
||||
});
|
||||
|
||||
it('getTransaction - tracking on', function() {
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
],
|
||||
"TransactionIndex": 5,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
}
|
||||
},
|
||||
"validated": false
|
||||
}
|
||||
}
|
||||
|
||||
3
test/fixtures/api/rippled/tx/payment.json
vendored
3
test/fixtures/api/rippled/tx/payment.json
vendored
@@ -181,6 +181,7 @@
|
||||
],
|
||||
"TransactionIndex": 0,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
}
|
||||
},
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user