project-origin / wallet

OpenSource project to host wallets that contain Granular Certificates in the registries.
https://project-origin.github.io/docs/wallet
Apache License 2.0
4 stars 2 forks source link

bug: Added extra guard for reserving slice #369

Closed MartinSchmidt closed 2 months ago

MartinSchmidt commented 2 months ago

This commit updates the CertificateRepository by changing the logic for setting the state of wallet slices. Instead of using the SetWalletSliceState method, it now directly executes an SQL query to update the state column in the wallet_slices table. The new query sets the state to WalletSliceState.Reserved only if the current state is WalletSliceState.Available. If the number of rows changed by the query is not equal to 1, an InvalidOperationException is thrown with a corresponding error message.

This change should insure extra guard against double reserving the same slice.

sonarcloud[bot] commented 2 months ago

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
66.7% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud