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

Update bdk to version 1.0.0-alpha.6 #2094

Merged
merged 5 commits into from
Mar 1, 2024
Merged

Update bdk to version 1.0.0-alpha.6 #2094

merged 5 commits into from
Mar 1, 2024

Conversation

luckysori
Copy link
Contributor

@luckysori luckysori commented Feb 26, 2024

Fixes #788.
Fixes #2016.
Fixes #2014.
Fixes #1990.
Fixes #1960 (reopen if not true after testing on public regtest).

  • I removed as much code as possible, although I gave up on making drastic changes to Flutter.
  • I haven't tested the app extensively. Just sending and receiving payments.
  • It would be great to merge this ASAP to avoid having to do any rebasing. Smaller PRs will have an easier time rebasing onto these changes.

@luckysori luckysori self-assigned this Feb 26, 2024
coordinator/Cargo.toml Outdated Show resolved Hide resolved
@holzeis
Copy link
Contributor

holzeis commented Feb 26, 2024

@luckysori will this also fix #1960 and https://github.com/get10101/meta/issues/351 ?

@luckysori
Copy link
Contributor Author

@luckysori will this also fix #1960 and get10101/meta#351 ?

Good point. I will try your repro and report back.

@luckysori luckysori force-pushed the feat/two-bdks branch 2 times, most recently from 64b1529 to 32202c9 Compare February 26, 2024 12:45
@luckysori
Copy link
Contributor Author

@luckysori will this also fix #1960 and get10101/meta#351 ?

Good point. I will try your repro and report back.

@holzeis: really hard to say locally, because the sync is so fast. I didn't run into it though.

Copy link
Contributor

@holzeis holzeis left a comment

Choose a reason for hiding this comment

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

Looks good so far. Didn't manage to look at all changes yet, but will continue tomorrow.

coordinator/src/admin.rs Show resolved Hide resolved
coordinator/src/bin/coordinator.rs Outdated Show resolved Hide resolved
coordinator/src/db/liquidity_options.rs Show resolved Hide resolved
coordinator/src/dlc_handler.rs Show resolved Hide resolved
coordinator/src/lib.rs Show resolved Hide resolved
coordinator/src/node.rs Outdated Show resolved Hide resolved
crates/ln-dlc-node/src/blockchain.rs Outdated Show resolved Hide resolved
@luckysori
Copy link
Contributor Author

@holzeis: I've addressed your early comments here.

Copy link
Contributor

@holzeis holzeis left a comment

Choose a reason for hiding this comment

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

very nice 👍

A lot of feel good changes in there :)

crates/ln-dlc-node/src/dlc_wallet.rs Outdated Show resolved Hide resolved

// This is a standard base weight (without inputs or change outputs) for on-chain DLCs. We
// assume that this value is still correct for DLC channels.
let funding_tx_base_weight = 212;
Copy link
Contributor

Choose a reason for hiding this comment

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

🔧 That would probably be better placed as constant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, although I didn't change this code with this PR.

In any case, I think it disappears with #2062, so we can wait for that one to merge.

};

coin_selector
.run_bnb(metric, 100_000)
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ What is the 100_000 defining?

Copy link
Contributor Author

@luckysori luckysori Mar 1, 2024

Choose a reason for hiding this comment

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

From the docs:

/// The method keeps trying until no better solution can be found, or we reach `max_rounds`.

I just took this value (a long time ago 😛) from the bdk_coin_select docs/examples. I can add a constant for it in a separate commit.

.run_bnb(metric, 100_000)
.map_err(|e| dlc_manager::error::Error::WalletError((format!("{e:#}")).into()))?;

debug_assert!(coin_selector.is_target_met(target));
Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 Is it safe to continue here in prod? since we only debug_assert, or should we also gracefully print an error and return?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Old code. I just copied this from the bdk_coin_select docs/examples. It's safe because a coin selection that didn't meet its target will just fail later.

But I agree that we should fail early. I can add this to #2062.

use std::sync::Arc;
use tokio::sync::watch;

pub type PendingInterceptedHtlcs = Arc<Mutex<HashMap<PublicKey, InterceptionDetails>>>;
pub type EventSender = watch::Sender<Option<Event>>;
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ is this still used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would love to remove it. I remember keeping it on purpose because I wasn't sure. I can try to get rid of it now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAICT, after this PR it's only used by the app to generate an EventType::SpendableOutputs.

The app uses that as one of the triggers to create a new backup. This is obviously completely irrelevant for most of the apps in production, so I wouldn't mind removing it.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will open a separate PR to remove it.

mobile/native/src/api.rs Show resolved Hide resolved
mobile/native/src/destination.rs Outdated Show resolved Hide resolved
mobile/native/src/ln_dlc/mod.rs Show resolved Hide resolved
mobile/native/src/orderbook.rs Outdated Show resolved Hide resolved
@holzeis holzeis linked an issue Feb 28, 2024 that may be closed by this pull request
I'm interested in including a patch[^1] which will forward errors from
the Esplora backend. This will make debugging easier.

[^1]: bitcoindevkit/rust-esplora-client@269360f.
@luckysori luckysori enabled auto-merge March 1, 2024 05:06
@luckysori luckysori added this pull request to the merge queue Mar 1, 2024
Merged via the queue into main with commit 5ce7ec8 Mar 1, 2024
20 checks passed
@luckysori luckysori deleted the feat/two-bdks branch March 1, 2024 05:30
@Restioson Restioson mentioned this pull request Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants