Skip to content

Commit 633e96a

Browse files
committed
Fixed deposit_transaction so we're compiling again after upstream merge
1 parent 2209462 commit 633e96a

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

crates/wallet/examples/descriptor_with_plan.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#![allow(unused)]
2-
use std::str::FromStr;
3-
2+
use bdk_chain::{BlockId, CheckPoint};
43
use bdk_wallet::bitcoin::bip32::Xpriv;
54
use bdk_wallet::bitcoin::hashes::Hash;
65
use bdk_wallet::bitcoin::key::Secp256k1;
6+
use std::str::FromStr;
77

88
use bdk_wallet::bitcoin::{
99
self, psbt, Address, Network, OutPoint, Psbt, Script, Sequence, Transaction, TxIn, TxOut, Txid,
@@ -29,6 +29,7 @@ use bitcoin::{absolute, transaction, Amount};
2929
// 7. Finalize the psbt. At this point, miniscript will check whether the transaction
3030
// satisfies the descriptor, and will notify you if it doesn't.
3131
// 8. If desired, extract the transaction from the psbt and broadcast it.
32+
#[allow(clippy::print_stdout)]
3233
fn main() {
3334
// In order to try out descriptors, let's define a Bitcoin vault with two spend paths.
3435
//
@@ -132,9 +133,11 @@ fn main() {
132133
let fees = Amount::from_sat(500);
133134

134135
// Calculate the change amount (total balance minus the amount sent in txout1)
135-
let change_amount = emergency_wallet
136-
.balance()
137-
.confirmed
136+
let vault_balance = vault.balance();
137+
println!("vault balance is {vault_balance}");
138+
139+
let change_amount = vault_balance
140+
.untrusted_pending
138141
.checked_sub(txout1.value)
139142
.expect("failed to generate change amount")
140143
.checked_sub(fees)
@@ -323,6 +326,7 @@ fn blank_transaction_with(lock_time: absolute::LockTime) -> bitcoin::Transaction
323326
}
324327

325328
fn deposit_transaction(wallet: &mut Wallet, tx: Transaction) -> OutPoint {
329+
use bdk_chain::TxUpdate;
326330
use bdk_chain::{ConfirmationBlockTime, TxGraph};
327331
use bdk_wallet::Update;
328332

@@ -332,7 +336,7 @@ fn deposit_transaction(wallet: &mut Wallet, tx: Transaction) -> OutPoint {
332336
let _ = graph.insert_seen_at(txid, 42);
333337
wallet
334338
.apply_update(Update {
335-
graph,
339+
tx_update: graph.into(),
336340
..Default::default()
337341
})
338342
.unwrap();

0 commit comments

Comments
 (0)