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

Fetch transaction error handling #1565

Merged
merged 1 commit into from
Aug 21, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -2105,13 +2105,15 @@ class CompactBlockProcessor internal constructor(
transactionResult =
when (val response = downloader.fetchTransaction(transactionRequest.txid)) {
is Response.Success -> response.result
is Response.Failure -> {
if (response is Response.Failure.Server.NotFound) {
null
} else {
throw EnhanceTxDownloadError(response.toThrowable())
is Response.Failure ->
when {
response is Response.Failure.Server.NotFound -> null
response.description.orEmpty().contains(NOT_FOUND_MESSAGE_WORKAROUND, true) ->
null
response.description.orEmpty().contains(NOT_FOUND_MESSAGE_WORKAROUND_2, true) ->
null
else -> throw EnhanceTxDownloadError(response.toThrowable())
}
}
}
}
traceScope.end()
Expand Down Expand Up @@ -2583,3 +2585,7 @@ class CompactBlockProcessor internal constructor(
}
}
}

private const val NOT_FOUND_MESSAGE_WORKAROUND = "Transaction not found"
private const val NOT_FOUND_MESSAGE_WORKAROUND_2 =
"No such mempool or blockchain transaction. Use gettransaction for wallet transactions."
Loading