New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix KeychainTxOutIndex::lookahead_to_target
#1349
Fix KeychainTxOutIndex::lookahead_to_target
#1349
Conversation
ddd325b
to
e59eec9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated, but going through replenish_lookahead
I realized it could just use self.next_index
instead of let next_reveal_index = self.last_revealed.get(&descriptor_id).map_or(0, |v| *v + 1);
. Can you fix? Or I can open an issue if you prefer!
I don't mind adding to this PR (as it is small). However, I'm not sure what we are trying to fix here? |
e59eec9
to
c151d8f
Compare
Did we consider removing this method? Do we believe there is still a good reason to do lookaheads outside of the lookahead setting? |
I'm currently using it for something 😅 (that's how I found the bug). To be fair, what I'm doing is pretty niche but I don't think it hurts to keep it? |
This is ready for review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK b290b29
The test framework was more complicated to review than the change! but good coverage.
Description
This method was not used (so it was untested) and it was not working. This fixes it.
The old implementation used
.next_store_index
which returned the keychain's last index stored in.inner
(which include lookahead spks). This is WRONG because.replenish_lookahead
needs the difference from last revealed.Changelog notice
Fix
KeychainTxOutIndex::lookahead_to_target
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingBugfixes: