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

Optimize handling of non-existing transactions in the Electrum client #3809

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

lukasz-zimnoch
Copy link
Member

Electrum client exposes two methods for getting entire transactions and transaction confirmations from the Bitcoin blockchain. Those methods retry Electrum requests in case of any error. Retries are done in the exponential backoff scheme until a timeout of 2 minutes is hit.

However, when the given transaction does not exist on the chain, there is no point to retry. This can be harmful for scenarios like deposit sweep generation that need to check multiple transactions in a limited time window. If there are multiple non-existing transactions that are checked during the process, 2 minutes per such transaction is wasted.

Here we improve the situation by introducing an error type check. If the error says about not found transaction, retries are not executed.

Electrum client exposes two methods for getting entire transactions
and transaction confirmations from the Bitcoin blockchain. Those
methods retry Electrum requests in case of any error. Retries are
done in the exponential backoff scheme until a timeout of 2 minutes is hit.

However, when the given transaction does not exist on the chain, there
is no point to retry. This can be harmful for scenarios like deposit
sweep generation that need to check multiple transactions in a limited
time window. If there are multiple non-existing transactions that are
checked during the process, 2 minutes per such transaction is wasted.

Here we improve the situation by introducing an error type check.
If the error says about not found transaction, retries are not executed.
@tomaszslabon tomaszslabon merged commit efa643f into main Apr 23, 2024
28 of 29 checks passed
@tomaszslabon tomaszslabon deleted the optimize-electrum-tx-lookup branch April 23, 2024 14:15
@lukasz-zimnoch lukasz-zimnoch added this to the v2.1.0 milestone Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants