tmpim / Krist

Krist is a centralized-database economy system for Minecraft servers. Krist does not use a block-chain, or any similar technology. Krist is not a "cryptocurrency".
https://krist.dev/
GNU General Public License v3.0
24 stars 19 forks source link

feat: add requestId parameter and relevant validation #62

Closed emmachase closed 4 months ago

emmachase commented 4 months ago

Adds a new requestId parameter to the makeTransaction APIs. This id is used to ensure that even if the request is re-sent by the client, so long as the id stays consistent, it is guaranteed that at most 1 transaction will be created.

For now, the requestId is not populated into the model returned by the transaction APIs as it shouldn't be necessary for any consumers to know a particular transactions requestId, as well as to keep the change simple and backwards-compatible. This may change in the future if a good use-case is found for this.

If a request is made with a requestId that has been used previously, but any of the transaction details differ from the original, (e.g. from, to, amount, metadata) then the request will fail with error code transaction_conflict. If clients receive this error, they should pick a new requestId.