Merge bitcoindevkit/bdk#2417: fix(core): generalize is_empty for SyncResponse and FullScanResponse and derive Clone, PartialEq
cb1deabcac7a1ad19742f117656ebc08bb14d2ab fix(core): generalize is_empty for SyncResponse and FullScanResponse and derive Clone, PartialEq (bhuvan-somisetty)
Pull request description:
### Description
Fixes #2416.
`SyncResponse` and `FullScanResponse` support custom checkpoint data types via their second generic parameter `D`:
```rust
pub struct SyncResponse<A = ConfirmationBlockTime, D = BlockHash>
pub struct FullScanResponse<K, A = ConfirmationBlockTime, D = BlockHash>
```
While their `Default` implementations are generic over `D`, their `is_empty()` methods were previously declared as:
```rust
impl<A> SyncResponse<A>
impl<K, A> FullScanResponse<K, A>
```
which constrained `is_empty()` to `D = BlockHash`, causing compilation failures when called on responses with custom checkpoint data types.
This PR:
- Changes `impl<A> SyncResponse<A>` to `impl<A, D> SyncResponse<A, D>`, making `is_empty()` available for any checkpoint type `D`.
- Changes `impl<K, A> FullScanResponse<K, A>` to `impl<K, A, D> FullScanResponse<K, A, D>`.
- Adds `Clone` and `PartialEq` derives to `SyncResponse`, `FullScanResponse`, and `TxUpdate`.
- Adds `test_empty` assertions calling `is_empty()` on responses with a custom checkpoint type (these fail to compile without the fix).
### Notes to the reviewers
Non-breaking change. Existing code using the default `D = BlockHash` continues to work unchanged.
### Changelog notice
### Fixed
- `bdk_core`: `SyncResponse::is_empty` and `FullScanResponse::is_empty` are now generic over all checkpoint data types `D`. #2417
### Added
- `bdk_core`: Derived `Clone` and `PartialEq` on `SyncResponse`, `FullScanResponse`, and `TxUpdate`. #2417
### Checklists
#### All Submissions:
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
#### 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
* [x] I've added tests to reproduce the issue which are now passing
* [x] I'm linking the issue being fixed by this PR
Signed-off-by: bhuvan-somisetty <somisettybhuvan5@gmail.com>
ACKs for top commit:
evanlinjin:
ACK
cb1deabcac7a1ad19742f117656ebc08bb14d2ab
Tree-SHA512: 150678735eaddf929c051c0eeef112edee8d70344c17c2846d85dc89baa7075e92273536b6bdf84120d481ca726f45b26452c062683664536fc09ab1394146f3