Skip to content

Commit 4728b11

Browse files
authored
Merge branch 'bitcoindevkit:master' into master
2 parents 28375ab + c39ce79 commit 4728b11

File tree

28 files changed

+2586
-2266
lines changed

28 files changed

+2586
-2266
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/wallet/ @ValuedMammal

examples/example_wallet_electrum/src/main.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn main() -> Result<(), anyhow::Error> {
3939

4040
let address = wallet.next_unused_address(KeychainKind::External);
4141
wallet.persist(&mut db)?;
42-
println!("Generated Address: {}", address);
42+
println!("Generated Address: {address}");
4343

4444
let balance = wallet.balance();
4545
println!("Wallet balance before syncing: {}", balance.total());
@@ -56,9 +56,9 @@ fn main() -> Result<(), anyhow::Error> {
5656
let mut once = HashSet::<KeychainKind>::new();
5757
move |k, spk_i, _| {
5858
if once.insert(k) {
59-
print!("\nScanning keychain [{:?}]", k);
59+
print!("\nScanning keychain [{k:?}]");
6060
}
61-
print!(" {:<3}", spk_i);
61+
print!(" {spk_i:<3}");
6262
stdout.flush().expect("must flush");
6363
}
6464
});
@@ -74,10 +74,7 @@ fn main() -> Result<(), anyhow::Error> {
7474
println!("Wallet balance after syncing: {}", balance.total());
7575

7676
if balance.total() < SEND_AMOUNT {
77-
println!(
78-
"Please send at least {} to the receiving address",
79-
SEND_AMOUNT
80-
);
77+
println!("Please send at least {SEND_AMOUNT} to the receiving address");
8178
std::process::exit(0);
8279
}
8380

examples/example_wallet_esplora_async/src/main.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ async fn main() -> Result<(), anyhow::Error> {
5050
let mut once = BTreeSet::<KeychainKind>::new();
5151
move |keychain, spk_i, _| {
5252
if once.insert(keychain) {
53-
print!("\nScanning keychain [{:?}]", keychain);
53+
print!("\nScanning keychain [{keychain:?}]");
5454
}
55-
print!(" {:<3}", spk_i);
55+
print!(" {spk_i:<3}");
5656
stdout.flush().expect("must flush")
5757
}
5858
});
@@ -69,10 +69,7 @@ async fn main() -> Result<(), anyhow::Error> {
6969
println!("Wallet balance after syncing: {}", balance.total());
7070

7171
if balance.total() < SEND_AMOUNT {
72-
println!(
73-
"Please send at least {} to the receiving address",
74-
SEND_AMOUNT
75-
);
72+
println!("Please send at least {SEND_AMOUNT} to the receiving address");
7673
std::process::exit(0);
7774
}
7875

examples/example_wallet_esplora_blocking/src/main.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ fn main() -> Result<(), anyhow::Error> {
5252
let mut once = BTreeSet::<KeychainKind>::new();
5353
move |keychain, spk_i, _| {
5454
if once.insert(keychain) {
55-
print!("\nScanning keychain [{:?}] ", keychain);
55+
print!("\nScanning keychain [{keychain:?}] ");
5656
}
57-
print!(" {:<3}", spk_i);
57+
print!(" {spk_i:<3}");
5858
stdout.flush().expect("must flush")
5959
}
6060
});
@@ -69,10 +69,7 @@ fn main() -> Result<(), anyhow::Error> {
6969
println!("Wallet balance after syncing: {}", balance.total());
7070

7171
if balance.total() < SEND_AMOUNT {
72-
println!(
73-
"Please send at least {} to the receiving address",
74-
SEND_AMOUNT
75-
);
72+
println!("Please send at least {SEND_AMOUNT} to the receiving address");
7673
std::process::exit(0);
7774
}
7875

examples/example_wallet_rpc/src/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,7 @@ fn main() -> anyhow::Result<()> {
166166
wallet.apply_block_connected_to(&block_emission.block, height, connected_to)?;
167167
wallet.persist(&mut db)?;
168168
let elapsed = start_apply_block.elapsed().as_secs_f32();
169-
println!(
170-
"Applied block {} at height {} in {}s",
171-
hash, height, elapsed
172-
);
169+
println!("Applied block {hash} at height {height} in {elapsed}s");
173170
}
174171
Emission::Mempool(event) => {
175172
let start_apply_mempool = Instant::now();

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.87.0
1+
1.88.0

wallet/examples/compiler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn main() -> Result<(), Box<dyn Error>> {
4545
)"
4646
.replace(&[' ', '\n', '\t'][..], "");
4747

48-
println!("Compiling policy: \n{}", policy_str);
48+
println!("Compiling policy: \n{policy_str}");
4949

5050
// Parse the string as a [`Concrete`] type miniscript policy.
5151
let policy = Concrete::<String>::from_str(&policy_str)?;
@@ -54,7 +54,7 @@ fn main() -> Result<(), Box<dyn Error>> {
5454
// `policy.compile()` returns the resulting miniscript from the policy.
5555
let descriptor = Descriptor::new_wsh(policy.compile()?)?.to_string();
5656

57-
println!("Compiled into Descriptor: \n{}", descriptor);
57+
println!("Compiled into Descriptor: \n{descriptor}");
5858

5959
// Create a new wallet from descriptors
6060
let mut wallet = Wallet::create_single(descriptor)

wallet/examples/mnemonic_to_descriptors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ fn main() -> Result<(), anyhow::Error> {
4545
descriptor!(tr((mnemonic_with_passphrase, internal_path)))?
4646
.into_wallet_descriptor(&secp, Network::Testnet)?;
4747

48-
println!("tpub external descriptor: {}", external_descriptor);
49-
println!("tpub internal descriptor: {}", internal_descriptor);
48+
println!("tpub external descriptor: {external_descriptor}");
49+
println!("tpub internal descriptor: {internal_descriptor}");
5050
println!(
5151
"tprv external descriptor: {}",
5252
external_descriptor.to_string_with_secret(&ext_keymap)

wallet/examples/policy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn main() -> Result<(), Box<dyn Error>> {
4242
// But they can be used as independent tools also.
4343
let (wallet_desc, keymap) = desc.into_wallet_descriptor(&secp, Network::Testnet)?;
4444

45-
println!("Example Descriptor for policy analysis : {}", wallet_desc);
45+
println!("Example Descriptor for policy analysis : {wallet_desc}");
4646

4747
// Create the signer with the keymap and descriptor.
4848
let signers_container = SignersContainer::build(keymap, &wallet_desc, &secp);
@@ -54,7 +54,7 @@ fn main() -> Result<(), Box<dyn Error>> {
5454
.extract_policy(&signers_container, BuildSatisfaction::None, &secp)?
5555
.expect("We expect a policy");
5656

57-
println!("Derived Policy for the descriptor {:#?}", policy);
57+
println!("Derived Policy for the descriptor {policy:#?}");
5858

5959
Ok(())
6060
}

wallet/src/descriptor/checksum.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ mod test {
7676
#[test]
7777
fn test_calc_checksum_invalid_character() {
7878
let sparkle_heart = unsafe { core::str::from_utf8_unchecked(&[240, 159, 146, 150]) };
79-
let invalid_desc = format!("wpkh(tprv8ZgxMBicQKsPdpkqS7Eair4YxjcuuvDPNYmKX3sCniCf16tHEVrjjiSXEkFRnUH77yXc6ZcwHHcL{}fjdi5qUvw3VDfgYiH5mNsj5izuiu2N/1/2/*)", sparkle_heart);
79+
let invalid_desc = format!("wpkh(tprv8ZgxMBicQKsPdpkqS7Eair4YxjcuuvDPNYmKX3sCniCf16tHEVrjjiSXEkFRnUH77yXc6ZcwHHcL{sparkle_heart}fjdi5qUvw3VDfgYiH5mNsj5izuiu2N/1/2/*)");
8080

8181
assert_matches!(
8282
calc_checksum(&invalid_desc),
83-
Err(DescriptorError::Miniscript(miniscript::Error::BadDescriptor(e))) if e == format!("Invalid character in checksum: '{}'", sparkle_heart)
83+
Err(DescriptorError::Miniscript(miniscript::Error::BadDescriptor(e))) if e == format!("Invalid character in checksum: '{sparkle_heart}'")
8484
);
8585
}
8686
}

0 commit comments

Comments
 (0)