fix(api): skip malformed notes during shielded scans
What does this PR do?
Skip notes with unsupported plaintext headers or negative decoded values in both note decryption paths. Add regression coverage for native shielded and TRC20 IVK/OVK scans, including valid notes before and after malformed entries.
Why are these changes required?
An authenticated but malformed note currently throws during decoding or value validation and aborts the entire requested scan range. Returning an empty result for that note lets scanning continue while preserving commitment checks and errors for invalid API inputs.
This PR has been tested by:
- JDK 8 direct compilation of the current Note, NoteEncryption and Wallet sources against an existing local FullNode build, followed by JUnit: all 5 new regression tests and 2 existing SaplingNoteTest tests passed. Against the original Note implementation, 4 of the 5 new tests failed.
- Direct Checkstyle 8.7 validation of both changed files using the repository configuration passed; the forbidden Math usage check and git diff whitespace check passed.
- Offline Gradle clean build, full tests, focused tests and the CI Checkstyle task set were blocked during dependency resolution by missing cached commons-lang3:3.20.0, javax.annotation-api:1.3.2, httpclient:4.5.13 and httpcore:4.4.13. The direct tests do not replace a clean build or full-suite validation.
Follow up
Require successful standard build, tests and CI checks before merging. A complete signed-transaction-to-block-to-scan integration test has not been run.
Extra details
Limited to scan-time note decryption and regression tests. Public Note.decode behavior and consensus transaction validation are unchanged. The scanner tests use real note encryption with mocked block and transaction-info retrieval.
Summary by cubic
Skips malformed notes during shielded note scans so a single bad note no longer aborts the entire requested range. Notes with unsupported plaintext headers or negative decoded values are now discarded in both IVK and OVK decryption paths, while valid scan results, commitment checks, and errors for invalid API inputs are preserved.
- Adds regression tests for native shielded and TRC20 IVK/OVK scans, covering valid notes on both sides of malformed entries.
- Public
Note.decodebehavior and consensus transaction validation are unchanged.