Closed holtzman closed 2 months ago
To view this pull requests documentation preview, visit the following URL:
docs.page/mobilecoinofficial/full-service~1007
Documentation is deployed and generated using docs.page.
Attention: Patch coverage is 33.33333%
with 6 lines
in your changes missing coverage. Please review.
Project coverage is 69.03%. Comparing base (
ab2af32
) to head (549ee86
). Report is 208 commits behind head on main.
Files with missing lines | Patch % | Lines |
---|---|---|
full-service/src/db/txo.rs | 33.33% | 6 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Motivation
Full-service is taking spent txos and sometimes clearing their
spent_block_index
in the wallet db, which makes them appear unspent. This causes double spendkey_image
errors when trying to spend funds, and can result in a complete inability for a client to spend any funds in an account.In this PR
Fixes
update_key_image
function to treat aNone
value for thespent_block_index
parameter is an indication that the function should not update thespent_block_index
, rather than setting it tonull
in the database.As the spent_block_index database column starts as null, and is only changed to a
block_index
when the key_image that corresponds to the txo appears in the ledger, there is no need or reason to set it tonull
in this function.Test Plan
without this patch can exercise full-service with a test client that corrupts the wallet db with spent txos that seem to be unspent because their spent_block_index has been reset to null
with this patch, above test client no longer corrupts the wallet db.
todo: unit test(s) for
update_key_image