XRPLF / clio

An XRP Ledger API Server
https://xrpl.org
ISC License
55 stars 47 forks source link

fix: Support deleted object in ledger_entry #1483

Open Kassaking7 opened 1 week ago

Kassaking7 commented 1 week ago

Fixes #1306

codecov[bot] commented 3 days ago

Codecov Report

Attention: Patch coverage is 78.94737% with 4 lines in your changes missing coverage. Please review.

Project coverage is 67.99%. Comparing base (b2eacf9) to head (fedd174). Report is 5 commits behind head on develop.

Files Patch % Lines
src/data/BackendInterface.cpp 60.00% 1 Missing and 1 partial :warning:
src/rpc/handlers/LedgerEntry.cpp 85.71% 0 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #1483 +/- ## =========================================== + Coverage 67.81% 67.99% +0.18% =========================================== Files 233 234 +1 Lines 9423 9506 +83 Branches 5256 5287 +31 =========================================== + Hits 6390 6464 +74 - Misses 1654 1658 +4 - Partials 1379 1384 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Kassaking7 commented 9 hours ago

I give a change on the logic:

  1. Try to fetch the object with a given sequence
  2. If failed, it means the sequence it deleted is at least <= current given sequence
  3. Use a new created function to fetch the sequence that the object deleted (no need for new CQL statement)
  4. Use the new sequence-1 to fetch the latest object that is not deleted

Hope this time it works good :) I created a unit test for this case and looks good to me.