Skip to content

upgrade(swap): Upgrade bdk library #180

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

Draft
wants to merge 124 commits into
base: master
Choose a base branch
from
Draft

Conversation

Einliterflasche
Copy link

@Einliterflasche Einliterflasche commented Nov 16, 2024

This closes #98.

The new dependencies are part of the bdk upgrade and
include the improved wallet code.
They, too, depend on sqlite3.
However, they use a newer version than we currently use via sqlx.
This necessitated the sqlx upgrade.
This entailed trivial changes (use Pool directly instead of pool.acquire()).
We might have to fix the CI as well, I kept getting compile
errors from the macro until I ran swap/sqlx_dev_setup.sh.
@Einliterflasche Einliterflasche self-assigned this Nov 16, 2024
@Einliterflasche
Copy link
Author

Einliterflasche commented Nov 16, 2024

Oh boy. It looks like we'll have to upgrade bitcoin as well, since [email protected] uses [email protected] but we use [email protected]. I did that and instantly received ~500 compile errors. This upgrade is not at all trivial.

@binarybaron
Copy link

binarybaron commented Nov 16, 2024

Oh boy. It looks like we'll have to upgrade bitcoin as well, since [email protected] uses [email protected] but we use [email protected]. I did that and instantly received ~500 compile errors. This upgrade is not at all trivial.

That's a bummer but I'd assume it's mostly a few API changes that propogate through the codebase. The Bitcoin protocol hasn't changed.

@Einliterflasche
Copy link
Author

Probably. The changelog isn't very clear on that, sadly.

@binarybaron
Copy link

We also have to consider that this upgrade could be a breaking network upgrade if the serde serialization structures have changed.

@binarybaron
Copy link

I haven't looked too much what you are doing here but fyi you do not really need to do any backwards compatability stuff. Our descriptor is derived from our seed.pem which does not change, and we can just re-scan our wallet at first startup.

@Einliterflasche
Copy link
Author

The docs recommended that we get the revelation indices of the wallet to speed up the migration, so that's why I kept some of the old wallet code around

@Einliterflasche
Copy link
Author

I fixed almost all compile errors now. Only left are Wallet::new and Client::new and how their used, some wallet testing code, as well as migrating to the new wallet when needed.

@binarybaron
Copy link

Some bugs:

  • amount has a too high precision when sweeping Bitcoin wallet? I haven't been able to find this anywhere in the codebase. Neither our nor bdks?

  • Wallet syncing sometimes fails with Made one or multiple attempts ... unexpected end of file

  • max_giveable(...) sporadically fails with Failed to build transaction to figure out max giveable

All of these occur only sometimes?

I'm thinking that the way we clone the Arc> client might not be safe

Fixed first (and maybe last) issue. Was a rounding issue in how we were parsing the fee returned by the Electrum server

@binarybaron
Copy link

binarybaron commented May 13, 2025

The docker tests pass locally. Not sure why they don't in the CI.

Another issue is that if the user interrupt the initial full scan, we will not try again.. (I'm fixing this right now)

…ull scan, transmit assumed_total for full scan to tauri, add some icons to progress displays
@binarybaron
Copy link

Another issue is that if the user interrupt the initial full scan, we will not try again...

Fixed

@binarybaron
Copy link

Integration tests are failing. I've manually done a successful swap.

Some issue with the Electrum server I believe...

@binarybaron
Copy link

I tried doing a mainnet swap with this as a client and an old asb as a maker. swap_setup fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 Priority 1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade bdk library
2 participants