[LiskHQ/lisk] Refactor checkConfirmed function to behave as expected — Closes #1822 (#2299)

SargeKhan requested changes on this pull request.

> @@ -693,9 +690,12 @@ class Transaction {
};

if (checkExists) {
— this.checkConfirmed(transaction, checkConfirmedErr => {
— if (checkConfirmedErr) {
— return setImmediate(cb, checkConfirmedErr);
+ this.checkConfirmed(transaction, (checkConfirmedErr, isConfirmed) => {
+ if (checkConfirmedErr || isConfirmed) {

We should return different error messages to callback based on whether `checkConfirmredErr` had an error value or `isConfirmed` was set to true.

> done();
});
});

— it(‘should return error for transaction which is already confirmed’, done => {
+ it(‘should return true for transaction which is already confirmed’, done => {

Add another case for when there is a `Transaction#countById error` (after making the changes described in the first comment.

Добавить комментарий