Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use options.limit as upper limit for note-getter loop (#7253)
Using the `options.limit` as the upper limit for the loop in `constrain_get_notes_internal` in the `note_getter` to ensure that we don't waste constraints going over the full potential 32 notes for cases where we don't even accept this many. When limiting number of notes with the option, it is now heavily reducing the number of hashes etc. Adds a smaller loop over `limit..N` to ensure that nothing have been added after the limit. For a function like `redeem_shield` this cuts down 40K constraints instantly which is fairly neat, it already had a limit of 1, so now that is used. Unclear how the cost is still as high for it as it is though. For a `transfer` function it is more apparent though, with a limit of 8, we save around 400K 🤷 vs no limit. So fairly easy to straight forward to do a big change which is neat.
- Loading branch information