Correctly map lastRequest timestamp

The lastRequest timestamp is changed to show the last request to a
pricenode.

The previous approach of using the "last provider request timestamp"
does not make sense in the new setup. Each currency rate is based on
rates from several providers, each with their own "request timestamps".
In addition, the pricenode returns the timestamp each rate was
calculated. On top of that comes the timestamp when the Bisq node
queries the pricenode.

Since what is most relevant for the Bisq node is the "freshness" of a
specific rate, the timestamp most indicative of that is the moment when
the pricenode is queried.
This commit is contained in:
cd2357 2020-08-08 21:00:45 +02:00
parent b8a76b0e92
commit 189431ed7e
No known key found for this signature in database
GPG Key ID: F26C56748514D0D3

View File

@ -400,7 +400,12 @@ public class PriceFeedService {
UserThread.execute(() -> {
checkNotNull(result, "Result must not be null at requestAllPrices");
timeStampMap = result.first;
epochInSecondAtLastRequest = timeStampMap.get("btcAverageTs");
// Each currency rate has a different timestamp, depending on when
// the pricenode aggregate rate was calculated
// However, the request timestamp is when the pricenode was queried
epochInSecondAtLastRequest = System.currentTimeMillis() / 1000L;
final Map<String, MarketPrice> priceMap = result.second;
cache.putAll(priceMap);