Skip to content

Update fee rate cache on startup and make sync interval configurable #102

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

Merged
merged 7 commits into from
Jun 5, 2023

Conversation

tnull
Copy link
Collaborator

@tnull tnull commented May 19, 2023

Based on #93.
Based on #108.

So far we'd immediately start background syncing upon start() which would work fine, except when these initial syncs failed, in which case we'd use our fallback fee. This might lead to being disconnected from peers as our fallback values are likely out of current fee ranges.

To mitigate this we here simply enforce that an initial update of our fee rate cache in start() is successful and hence we'd at least once got a recent fee estimation update.

Moreover, we make the background syncing intervals configurable, however enforcing a floor of 10 seconds.

@tnull tnull added this to the 0.1 milestone May 19, 2023
@tnull tnull mentioned this pull request May 19, 2023
47 tasks
@tnull tnull force-pushed the 2023-05-fee-fix branch 4 times, most recently from 65bb071 to af9028c Compare May 23, 2023 11:22
@tnull
Copy link
Collaborator Author

tnull commented May 23, 2023

Rebased on #108.

@tnull tnull force-pushed the 2023-05-fee-fix branch 11 times, most recently from 984d936 to 6b1f2ff Compare May 25, 2023 09:57
@tnull
Copy link
Collaborator Author

tnull commented May 25, 2023

Rebased on #108 after #101 landed.

@tnull tnull force-pushed the 2023-05-fee-fix branch 2 times, most recently from db655e8 to 5053096 Compare May 27, 2023 06:57
@tnull
Copy link
Collaborator Author

tnull commented May 27, 2023

Rebased on #108 after #88 landed.

@tnull tnull force-pushed the 2023-05-fee-fix branch 5 times, most recently from c4f3fe4 to 575c9f7 Compare May 31, 2023 18:03
@tnull tnull changed the title Enforce successful initial wallet sync and make sync interval configurable Enforce successful initial fee rate cache update and make sync interval configurable May 31, 2023
@tnull tnull force-pushed the 2023-05-fee-fix branch from 575c9f7 to 356a079 Compare May 31, 2023 18:09
@tnull tnull force-pushed the 2023-05-fee-fix branch from 356a079 to c4d1d29 Compare May 31, 2023 18:20
@tnull tnull changed the title Enforce successful initial fee rate cache update and make sync interval configurable Update fee rate cache on startup and make sync interval configurable May 31, 2023
@tnull tnull force-pushed the 2023-05-fee-fix branch 2 times, most recently from 0393a8f to d218da2 Compare June 1, 2023 09:53
@jkczyz jkczyz self-requested a review June 1, 2023 13:10
@tnull tnull force-pushed the 2023-05-fee-fix branch from d218da2 to 987506a Compare June 1, 2023 19:53
@tnull
Copy link
Collaborator Author

tnull commented Jun 1, 2023

Rebased on main.

@tnull tnull force-pushed the 2023-05-fee-fix branch from 987506a to a568d5c Compare June 2, 2023 07:03
We improve the docs, in particular mentioning now that users should
always prefer background syncing over blocking sync if possible.

Moreover, as we already have a current thread runtime setup for the BDK
wallet, we now also use it to sync the LDK wallet. This is a good idea
as we want to avoid calling `block_on` on our main runtime where
possible, which is always in danger of (temporarily or permanently)
blocking the world if something goes wrong.
@tnull tnull force-pushed the 2023-05-fee-fix branch from a568d5c to 82141b6 Compare June 2, 2023 07:11
Copy link
Contributor

@jkczyz jkczyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please squash.

tnull added 2 commits June 3, 2023 01:21
So far we'd immediately start background syncing wallets and the fee
cache upon `start()` which
would work fine, except when these initial syncs failed, in which case
we'd use our fallback fee. This might lead to being disconnected
from peers as our fallback values are likely out of current fee ranges.

To mitigate this we here simply enforce that an initial fee rate update in
`start()` is successful.

Additionally, we make the fee rate cache update
interval configurable.
@tnull tnull force-pushed the 2023-05-fee-fix branch from a6390e4 to 53ef7ed Compare June 2, 2023 23:21
@tnull
Copy link
Collaborator Author

tnull commented Jun 2, 2023

LGTM. Please squash.

Squashed without further changes.

@tnull tnull merged commit e95f04e into lightningdevkit:main Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants