Upgrade to bdk 0.10

This fixes #546. I don't know why, but I can't reproduce the problem
with the updated dependency.
This commit is contained in:
Thomas Eizinger 2021-08-12 16:40:52 +10:00
parent 475057abda
commit 0296509110
No known key found for this signature in database
GPG key ID: 651AC83A6C6C8B96
4 changed files with 28 additions and 12 deletions

View file

@ -306,7 +306,8 @@ where
.iter()
.find(|tx| tx.txid == txid)
.context("Could not find tx in bdk wallet when trying to determine fees")?
.fees;
.fee
.expect("fees are always present with Electrum backend");
Ok(Amount::from_sat(fees))
}
@ -394,14 +395,16 @@ where
let mut tx_builder = wallet.build_tx();
let dummy_script = Script::from(vec![0u8; locking_script_size]);
tx_builder.set_single_recipient(dummy_script);
tx_builder.drain_wallet();
tx_builder.drain_to(dummy_script);
tx_builder.fee_rate(fee_rate);
let response = tx_builder.finish();
match response {
Ok((_, details)) => {
let max_giveable = details.sent - details.fees;
let max_giveable = details.sent
- details
.fee
.expect("fees are always present with Electrum backend");
Ok(Amount::from_sat(max_giveable))
}
Err(bdk::Error::InsufficientFunds { .. }) => Ok(Amount::ZERO),
@ -600,7 +603,7 @@ impl WalletBuilder {
pub fn build(self) -> Wallet<(), bdk::database::MemoryDatabase, StaticFeeRate> {
use bdk::database::MemoryDatabase;
use bdk::{LocalUtxo, TransactionDetails};
use bdk::{ConfirmationTime, LocalUtxo, TransactionDetails};
use bitcoin::OutPoint;
use testutils::testutils;