Merge bitcoindevkit/bdk#1486: refactor(chain): calculate DescriptorId as the sha256 hash of the spk at index 0
8f5b172e59test(wallet): verify wallet panics in dev mode if using keychains with duplicate spks (Steve Myers)46c6f18cc3refactor(chain): calculate DescriptorId as sha256 hash of spk at index 0 (Steve Myers) Pull request description: ### Description Rename `DescriptorId` to `KeychainId` and `descriptor_id()` to `keychain_id()`. Calculate keychain ids as the hash of the spk derived from its descriptor as index 0. Added docs to `Wallet` and `KeychainTxOutIndex::insert_descriptor()` explaining that it's the users responsibility not to use wildcard and non-wildcard descriptors that can derive the same script pubkey. I also recommended for `Wallet` that legacy non-wildcard descriptors be added to a temporary `Wallet` and swept into a modern wildcard descriptor. ### Notes to the reviewers fixes #1483 ### Changelog notice changed - Renamed DescriptorId to KeychainId, DescriptorExt::descriptor_id() to keychain_id(). ### 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 #### 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: LLFourn: ACK8f5b172e59oleonardolima: Concept ACK8f5b172e59Tree-SHA512: 07defa208d9cfcd61bc6e31ded06a287c392c51bcc4949f601ecfac635c3443e7d08c62d92618ed894dc5ef13cdcf784771a6bf8904a5397110bedb1563f52d4
This commit is contained in:
@@ -94,6 +94,9 @@ const COINBASE_MATURITY: u32 = 100;
|
||||
/// [`ChangeSet`]s (see [`take_staged`]). Also see individual functions and example for instructions
|
||||
/// on when [`Wallet`] state needs to be persisted.
|
||||
///
|
||||
/// The `Wallet` descriptor (external) and change descriptor (internal) must not derive the same
|
||||
/// script pubkeys. See [`KeychainTxOutIndex::insert_descriptor()`] for more details.
|
||||
///
|
||||
/// [`signer`]: crate::signer
|
||||
/// [`take_staged`]: Wallet::take_staged
|
||||
#[derive(Debug)]
|
||||
|
||||
Reference in New Issue
Block a user