The intent of the spv instance cache is to improve the performance of the JSON-RPC API getTxProof, so that each time it is called by the user, if the spv instance in the cache can be satisfied, there is no need to query the network for the current spv instance (a time-consuming operation).
But the spv instance cache is not properly invalidated. This pr was accidentally merged but not deployed. The expiration of the cache is completely dependent on a hard-coded expiration time(10 minutes). In other words, if the current cache is not hit, instead of getting the latest spv client instance via ckb_cli, the API will just return a failure each time until the cache expires.
A simple idea for a fix would be to get the latest spv instance over the network and update the cache as soon as a suitable spv client does not exist in the cache.
The intent of the spv instance cache is to improve the performance of the JSON-RPC API
getTxProof
, so that each time it is called by the user, if the spv instance in the cache can be satisfied, there is no need to query the network for the current spv instance (a time-consuming operation).It was introduced from the following pr
But the spv instance cache is not properly invalidated. This pr was accidentally merged but not deployed. The expiration of the cache is completely dependent on a hard-coded expiration time(10 minutes). In other words, if the current cache is not hit, instead of getting the latest spv client instance via
ckb_cli
, the API will just return a failure each time until the cache expires.A simple idea for a fix would be to get the latest spv instance over the network and update the cache as soon as a suitable spv client does not exist in the cache.