Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Blockbook not responding #957

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/common/store/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ export enum PegStatus {
ERROR_NOT_A_PEGIN = 'ERROR_NOT_A_PEGIN',
ERROR_BELOW_MIN = 'ERROR_BELOW_MIN',
ERROR_UNEXPECTED = 'ERROR_UNEXPECTED',
BLOCKBOOK_FAILED = 'BLOCKBOOK_FAILED',
}

export enum FlyoverStatus {
Expand Down
1 change: 1 addition & 0 deletions src/common/types/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export enum TxStatusType {
UNEXPECTED_ERROR = 'UNEXPECTED_ERROR',
UNSET_STATUS = 'UNSET_STATUS',
NOT_FOUND = 'NOT_FOUND',
BLOCKBOOK_FAILED = 'BLOCKBOOK_FAILED',
}

export interface TxStatus {
Expand Down
5 changes: 5 additions & 0 deletions src/common/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ export function setStatusMessage(txType: string, status: string): TxStatusMessag
error = true;
errorMessage = 'The input transaction is not valid, please check it and try again';
break;
case TxStatusType.BLOCKBOOK_FAILED:
activeMessageStyle = 'statusRejected';
error = true;
errorMessage = 'Blockbook service is not responding';
break;
default:
error = true;
errorMessage = 'The input transaction is not valid, please check it and try again';
Expand Down
1 change: 1 addition & 0 deletions src/status/store/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const getters: GetterTree<TxStatus, RootState> = {
|| state.txDetails.status === constants.PegStatus.ERROR_BELOW_MIN
|| state.txDetails.status === constants.PegStatus.REJECTED_NO_REFUND
|| state.txDetails.status === constants.PegStatus.REJECTED_REFUND
|| state.type === TxStatusType.BLOCKBOOK_FAILED
|| state.type === TxStatusType.UNEXPECTED_ERROR;
}
return isRejected;
Expand Down
12 changes: 10 additions & 2 deletions src/status/views/Status.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export default defineComponent({

const invalidData = computed(() => status.value.type === TxStatusType.INVALID_DATA);
const unexpectedError = computed(() => status.value.type === TxStatusType.UNEXPECTED_ERROR);
const blockBookError = computed(() => status.value.type === TxStatusType.BLOCKBOOK_FAILED);

const isFlyover = computed((): boolean => status.value.type === TxStatusType.FLYOVER_PEGOUT
|| status.value.type === TxStatusType.FLYOVER_PEGIN);
Expand All @@ -101,14 +102,21 @@ export default defineComponent({

const txNotFound = computed((): boolean => invalidData.value
|| unexpectedError.value
|| quoteNotFound.value);
|| quoteNotFound.value
|| blockBookError.value);

const isRejected = computed(() => status.value.txDetails?.status === 'REJECTED' || txNotFound.value);

const rejectionMsg = computed(() => {
const details = txDetails.value as PegoutStatusDataModel;
const { LOW_AMOUNT, CALLER_CONTRACT, FEE_ABOVE_VALUE } = constants.RejectedPegoutReasons;
if (txNotFound.value) return 'Your transaction is not processed yet, search again in a few minutes';
if (txNotFound.value) {
if (blockBookError.value) {
return 'We are experiencing technical issues and therefore were unable to retrieve and'
+ ' display the transaction status. Please try again later.';
}
return 'Your transaction is not processed yet, search again in a few minutes';
}
switch (details.reason) {
case LOW_AMOUNT:
return 'The transaction was rejected because the amount is less than the minimum required.';
Expand Down
Loading