From: 志宇 Date: Thu, 11 Jan 2024 02:59:45 +0000 (+0800) Subject: Merge bitcoindevkit/bdk#1261: Refactor `reveal_to_target` and `next_store_index` X-Git-Tag: v1.0.0-alpha.4~6 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/struct.EncoderStringWriter.html?a=commitdiff_plain;h=264bb85efc9cb6568ac89deee71c42f3617a9778;p=bdk Merge bitcoindevkit/bdk#1261: Refactor `reveal_to_target` and `next_store_index` 761189ab2b679fbfee45b33435d66ed98a135e2a feat(chain): debug_assert non-wildcard desc. to only cache index 0 (志宇) 887e112e8f4ee5300bf09a0f3590861bff7fd053 ref(chain): Refactor reveal_to_target (Daniela Brozzoni) 21d88758262bfbc3d9d2109aac9883f23ab651c4 ref(chain): Refactor next_store_index (Daniela Brozzoni) Pull request description: ### Description As a part of #1203, I found myself having to modify `reveal_to_target`, but had some troubles understanding exactly what the method was doing. This PR refactors `reveal_to_target` to be, in my opinion, a bit clearer. We now exist prematurely if `next_reveal_index` < `target_index`; this way, we don't need to keep track of `next_reveal_index`, as it would always be equal to `Some(target_index)`. As a part of trying to understand `reveal_to_target` I had to read through `next_store_index`, I slightly improved it for clarity reasons as well. ### Changelog notice ### 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: evanlinjin: ACK 761189ab2b679fbfee45b33435d66ed98a135e2a Tree-SHA512: 17f70bccbfa1cccf718ece0eeb61f4944c9108776cf1d606ef823ae9ff58bf52114750927ac99561644ece598f8131ee7f7605071d42c91e5e88e05035e74836 --- 264bb85efc9cb6568ac89deee71c42f3617a9778