Skip to content

Commit 6f742ff

Browse files
committed
Merge #11: Update bdk dependency to 0.22
1bf97ec Add cargo update step to CI Build and Test (Steve Myers) e08ea81 Update bdk dependency to 0.22 (Steve Myers) Pull request description: This update also required recalculating the PSBT proofs due to BDK removing partial signatures, see bitcoindevkit/bdk-cli#118 (review). Once this PR is merged I'll publish a new `bdk-reserves` release version `0.22.0`. Top commit has no ACKs. Tree-SHA512: 972e51e9ab8dbbff869ce1b8916abf7781e3b30ac671bb719e82d8803b8c56aa3cff723762d2c771cb17bc6d71296bff7c9fee93312316d1162d18f99f35fbee
2 parents d4f078e + 1bf97ec commit 6f742ff

File tree

7 files changed

+27
-13
lines changed

7 files changed

+27
-13
lines changed

.github/workflows/cont_integration.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
run: rustup component add clippy
3434
- name: Update toolchain
3535
run: rustup update
36+
- name: Update Cargo.lock
37+
run: cargo update
3638
- name: Build
3739
run: cargo build
3840
- name: Clippy

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bdk-reserves"
3-
version = "0.20.0"
3+
version = "0.22.0"
44
authors = ["Richard Ulrich <richard.ulrich@seba.swiss>"]
55
edition = "2018"
66
description = "Proof of reserves for bitcoin dev kit"
@@ -10,11 +10,11 @@ license = "MIT OR Apache-2.0"
1010
repository = "https://github.com/weareseba/bdk-reserves"
1111

1212
[dependencies]
13-
bdk = { version = "0.20", default-features = false }
13+
bdk = { version = "0.22", default-features = false }
1414
bitcoinconsensus = "0.19.0-3"
1515
log = "^0.4"
1616

1717
[dev-dependencies]
1818
rstest = "^0.11"
1919
bdk-testutils = "^0.4"
20-
bdk = { version = "0.20", default-features = true }
20+
bdk = { version = "0.22", default-features = true }

src/reserves.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ mod test {
348348
let psbt = wallet.create_proof(message).unwrap();
349349
let psbt_ser = serialize(&psbt);
350350
let psbt_b64 = base64::encode(&psbt_ser);
351-
let expected = r#"cHNidP8BAH4BAAAAAmw1RvG4UzfnSafpx62EPTyha6VslP0Er7n3TxjEpeBeAAAAAAD/////FcB9C8LQwqAoYxGcM/YLhUt3XZIQUmFAlaJlBjVmFO8AAAAAAP////8BUMMAAAAAAAAZdqkUn3/QltN+0sDj9/DPySS+70/862iIrAAAAAAAAQEKAAAAAAAAAAABUQEHAAABAR9QwwAAAAAAABYAFOzlJlcQU9qGRUyeBmd56vnRUC5qAAA="#;
351+
let expected = r#"cHNidP8BAH4BAAAAAmw1RvG4UzfnSafpx62EPTyha6VslP0Er7n3TxjEpeBeAAAAAAD/////2johM0znoXIXT1lg+ySrvGrtq1IGXPJzpfi/emkV9iIAAAAAAP////8BUMMAAAAAAAAZdqkUn3/QltN+0sDj9/DPySS+70/862iIrAAAAAAAAQEKAAAAAAAAAAABUQEHAAABAR9QwwAAAAAAABYAFOzlJlcQU9qGRUyeBmd56vnRUC5qAAA="#;
352352
assert_eq!(psbt_b64, expected);
353353
}
354354

@@ -373,7 +373,7 @@ mod test {
373373
}
374374

375375
fn get_signed_proof() -> PSBT {
376-
let psbt = "cHNidP8BAH4BAAAAAmw1RvG4UzfnSafpx62EPTyha6VslP0Er7n3TxjEpeBeAAAAAAD/////FcB9C8LQwqAoYxGcM/YLhUt3XZIQUmFAlaJlBjVmFO8AAAAAAP////8BUMMAAAAAAAAZdqkUn3/QltN+0sDj9/DPySS+70/862iIrAAAAAAAAQEKAAAAAAAAAAABUQEHAAABAR9QwwAAAAAAABYAFOzlJlcQU9qGRUyeBmd56vnRUC5qIgIDKwVYB4vsOGlKhJM9ZZMD4lddrn6RaFkRRUEVv9ZEh+NHMEQCICY1Ikn5FTh1KYCpJz7VHyybI1xIcwdtRzOSzmIn6L7RAiBPEOj74R91LZJot3HQ0QbR2zqJnXQG8iL/s7YSBpSOfwEBBwABCGsCRzBEAiAmNSJJ+RU4dSmAqSc+1R8smyNcSHMHbUczks5iJ+i+0QIgTxDo++EfdS2SaLdx0NEG0ds6iZ10BvIi/7O2EgaUjn8BIQMrBVgHi+w4aUqEkz1lkwPiV12ufpFoWRFFQRW/1kSH4wAA";
376+
let psbt = "cHNidP8BAH4BAAAAAmw1RvG4UzfnSafpx62EPTyha6VslP0Er7n3TxjEpeBeAAAAAAD/////2johM0znoXIXT1lg+ySrvGrtq1IGXPJzpfi/emkV9iIAAAAAAP////8BUMMAAAAAAAAZdqkUn3/QltN+0sDj9/DPySS+70/862iIrAAAAAAAAQEKAAAAAAAAAAABUQEHAAABAR9QwwAAAAAAABYAFOzlJlcQU9qGRUyeBmd56vnRUC5qAQcAAQhrAkcwRAIgDSE4PQ57JDiZ7otGkTqz35bi/e1pexYaYKWaveuvRd4CIFzVB4sAmgtdEVz2vHzs1iXc9iRKJ+KQOQb+C2DtPyvzASEDKwVYB4vsOGlKhJM9ZZMD4lddrn6RaFkRRUEVv9ZEh+MAAA==";
377377
let psbt = base64::decode(&psbt).unwrap();
378378
deserialize(&psbt).unwrap()
379379
}

tests/mempool.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ fn unconfirmed() -> Result<(), ProofError> {
2828
)?;
2929

3030
let balance = wallet.get_balance()?;
31-
assert!(balance > 10_000, "insufficient balance: {}", balance);
31+
assert!(
32+
balance.confirmed > 10_000,
33+
"insufficient balance: {}",
34+
balance.confirmed
35+
);
3236
let addr = wallet.get_address(AddressIndex::New).unwrap();
3337
assert_eq!(
3438
addr.to_string(),
@@ -58,7 +62,11 @@ fn unconfirmed() -> Result<(), ProofError> {
5862
assert!(finalized);
5963

6064
let spendable = wallet.verify_proof(&psbt, message, None)?;
61-
assert_eq!(spendable, new_balance);
65+
dbg!(&new_balance);
66+
assert_eq!(
67+
spendable,
68+
new_balance.untrusted_pending + new_balance.confirmed
69+
);
6270

6371
Ok(())
6472
}
@@ -73,7 +81,11 @@ fn confirmed() {
7381
.unwrap();
7482

7583
let balance = wallet.get_balance().unwrap();
76-
assert!(balance > 10_000, "insufficient balance: {}", balance);
84+
assert!(
85+
balance.confirmed > 10_000,
86+
"insufficient balance: {}",
87+
balance
88+
);
7789
let addr = wallet.get_address(AddressIndex::New).unwrap();
7890
assert_eq!(
7991
addr.to_string(),
@@ -109,5 +121,5 @@ fn confirmed() {
109121
let spendable = wallet
110122
.verify_proof(&psbt, message, Some(max_confirmation_height))
111123
.unwrap();
112-
assert_eq!(spendable, new_balance);
124+
assert_eq!(spendable, new_balance.confirmed);
113125
}

tests/multi_sig.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn test_proof_multisig(
9696
);
9797
let balance = wallet1.get_balance()?;
9898
assert!(
99-
(410000..=420000).contains(&balance),
99+
(410000..=420000).contains(&balance.confirmed),
100100
"balance is {} but should be between 410000 and 420000",
101101
balance
102102
);
@@ -158,7 +158,7 @@ fn test_proof_multisig(
158158
assert!(finalized);
159159

160160
let spendable = wallet1.verify_proof(&psbt, message, None)?;
161-
assert_eq!(spendable, balance);
161+
assert_eq!(spendable, balance.confirmed);
162162

163163
Ok(())
164164
}

tests/single_sig.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn test_proof(#[case] descriptor: &'static str) -> Result<(), ProofError> {
3636
assert!(finalized);
3737

3838
let spendable = wallet.verify_proof(&psbt, message, None)?;
39-
assert_eq!(spendable, balance);
39+
assert_eq!(spendable, balance.confirmed);
4040

4141
Ok(())
4242
}

tests/tampering.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn tampered_proof_message() {
2222
let spendable = wallet
2323
.verify_proof(&psbt_alice, message_alice, None)
2424
.unwrap();
25-
assert_eq!(spendable, balance);
25+
assert_eq!(spendable, balance.confirmed);
2626

2727
// change the message
2828
let message_bob = "This belongs to Bob.";

0 commit comments

Comments
 (0)