Merge bitcoindevkit/bdk#1503: feat(wallet): simplify public_descriptor fn and remove `get_descriptor_for_keych…

e7ec5a8733 refactor(wallet)!: remove redundant get_descriptor_for_keychain (Giovanni Napoli)

Pull request description:

  Fixes #1501

  ### Description

  Simplifies `public_descriptor` function by using `get_descriptor` and removes `get_descriptor_for_keychain`.

  ### Notes to the reviewers

  Tested with `cargo test --all-features`.

  ### Changelog notice

  - Simplifies `public_descriptor` function and removes `get_descriptor_for_keychain`

  ### Checklists

  #### All Submissions:

  * [X] I've signed all my commits
  * [X] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [X] I ran `cargo fmt` and `cargo clippy` before committing

ACKs for top commit:
  notmandatory:
    ACK e7ec5a8733
  storopoli:
    ACK e7ec5a8733

Tree-SHA512: 5981190ac882e08e42b1be53c55afb70c4ba7e7a99a8ae2a4e05f0618d0eb23849ce544024bb406e6a6918d9e9757d9ff6ad5a701cd9814b686e36f1ea16b44a
This commit is contained in:
Steve Myers
2024-07-07 23:20:20 -05:00
4 changed files with 22 additions and 28 deletions

View File

@@ -153,7 +153,7 @@ fn load_recovers_wallet() -> anyhow::Result<()> {
);
let secp = Secp256k1::new();
assert_eq!(
*wallet.get_descriptor_for_keychain(KeychainKind::External),
*wallet.public_descriptor(KeychainKind::External),
desc.into_wallet_descriptor(&secp, wallet.network())
.unwrap()
.0
@@ -1423,7 +1423,7 @@ fn test_add_foreign_utxo() {
.assume_checked();
let utxo = wallet2.list_unspent().next().expect("must take!");
let foreign_utxo_satisfaction = wallet2
.get_descriptor_for_keychain(KeychainKind::External)
.public_descriptor(KeychainKind::External)
.max_weight_to_satisfy()
.unwrap();
@@ -1499,7 +1499,7 @@ fn test_calculate_fee_with_missing_foreign_utxo() {
.assume_checked();
let utxo = wallet2.list_unspent().next().expect("must take!");
let foreign_utxo_satisfaction = wallet2
.get_descriptor_for_keychain(KeychainKind::External)
.public_descriptor(KeychainKind::External)
.max_weight_to_satisfy()
.unwrap();
@@ -1524,7 +1524,7 @@ fn test_add_foreign_utxo_invalid_psbt_input() {
let (mut wallet, _) = get_funded_wallet_wpkh();
let outpoint = wallet.list_unspent().next().expect("must exist").outpoint;
let foreign_utxo_satisfaction = wallet
.get_descriptor_for_keychain(KeychainKind::External)
.public_descriptor(KeychainKind::External)
.max_weight_to_satisfy()
.unwrap();
@@ -1545,7 +1545,7 @@ fn test_add_foreign_utxo_where_outpoint_doesnt_match_psbt_input() {
let tx2 = wallet2.get_tx(txid2).unwrap().tx_node.tx.clone();
let satisfaction_weight = wallet2
.get_descriptor_for_keychain(KeychainKind::External)
.public_descriptor(KeychainKind::External)
.max_weight_to_satisfy()
.unwrap();
@@ -1589,7 +1589,7 @@ fn test_add_foreign_utxo_only_witness_utxo() {
let utxo2 = wallet2.list_unspent().next().unwrap();
let satisfaction_weight = wallet2
.get_descriptor_for_keychain(KeychainKind::External)
.public_descriptor(KeychainKind::External)
.max_weight_to_satisfy()
.unwrap();
@@ -3421,7 +3421,7 @@ fn test_taproot_foreign_utxo() {
let utxo = wallet2.list_unspent().next().unwrap();
let psbt_input = wallet2.get_psbt_input(utxo.clone(), None, false).unwrap();
let foreign_utxo_satisfaction = wallet2
.get_descriptor_for_keychain(KeychainKind::External)
.public_descriptor(KeychainKind::External)
.max_weight_to_satisfy()
.unwrap();