iotexproject / iotex-core

Official implementation of IoTeX blockchain protocol in Go.
https://iotex.io
Apache License 2.0
1.55k stars 322 forks source link

[api] Fix wrong cache for api readState at tip height #4253

Closed envestcc closed 2 months ago

envestcc commented 2 months ago

Description

The key used for interface caching is the "height" string. When an empty value is passed for the height in the query, it means to retrieve the data of the latest height. This causes the data for the latest height to still return the data for the old height.

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Test Configuration:

Checklist:

sonarcloud[bot] commented 2 months ago

Quality Gate Failed Quality Gate failed

Failed conditions
7.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud