Skip to content

Commit a2d9401

Browse files
committed
Merge #1393: fix(export): add tr descriptor
1b7c6df fix(export): add tr descriptor (rustaceanrob) Pull request description: ### Description Resolves #860 by adding export of taproot descriptors ### Notes to the reviewers Allows export as Core accepts taproot. ### Changelog notice - Export taproot descriptors ### 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 #### New Features: * [x] I've added tests for the new feature * [ ] I've added docs for the new feature #### Bugfixes: * [ ] This pull request breaks the existing API * [ ] I've added tests to reproduce the issue which are now passing * [x] I'm linking the issue being fixed by this PR ACKs for top commit: notmandatory: ACK 1b7c6df Tree-SHA512: 80bee93a1ec531717e79a5e7a91e840532ae4d3daf677a207bc53162c69410e47db4893024b3eccfd848f1628062e7c49f0e92ebeb7230e2ebb9b47eb84b9e56
2 parents 2a055de + 1b7c6df commit a2d9401

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

crates/wallet/src/wallet/export.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ impl FullyNodedExport {
189189
WshInner::SortedMulti(_) => Ok(()),
190190
WshInner::Ms(ms) => check_ms(&ms.node),
191191
},
192+
Descriptor::Tr(_) => Ok(()),
192193
_ => Err("The descriptor is not compatible with Bitcoin Core"),
193194
}
194195
}
@@ -314,6 +315,18 @@ mod test {
314315
assert_eq!(export.label, "Test Label");
315316
}
316317

318+
#[test]
319+
fn test_export_tr() {
320+
let descriptor = "tr([73c5da0a/86'/0'/0']tprv8fMn4hSKPRC1oaCPqxDb1JWtgkpeiQvZhsr8W2xuy3GEMkzoArcAWTfJxYb6Wj8XNNDWEjfYKK4wGQXh3ZUXhDF2NcnsALpWTeSwarJt7Vc/0/*)";
321+
let change_descriptor = "tr([73c5da0a/86'/0'/0']tprv8fMn4hSKPRC1oaCPqxDb1JWtgkpeiQvZhsr8W2xuy3GEMkzoArcAWTfJxYb6Wj8XNNDWEjfYKK4wGQXh3ZUXhDF2NcnsALpWTeSwarJt7Vc/1/*)";
322+
let wallet = get_test_wallet(descriptor, Some(change_descriptor), Network::Testnet);
323+
let export = FullyNodedExport::export_wallet(&wallet, "Test Label", true).unwrap();
324+
assert_eq!(export.descriptor(), descriptor);
325+
assert_eq!(export.change_descriptor(), Some(change_descriptor.into()));
326+
assert_eq!(export.blockheight, 5000);
327+
assert_eq!(export.label, "Test Label");
328+
}
329+
317330
#[test]
318331
fn test_export_to_json() {
319332
let descriptor = "wpkh(xprv9s21ZrQH143K4CTb63EaMxja1YiTnSEWKMbn23uoEnAzxjdUJRQkazCAtzxGm4LSoTSVTptoV9RbchnKPW9HxKtZumdyxyikZFDLhogJ5Uj/44'/0'/0'/0/*)";

0 commit comments

Comments
 (0)