Merge pull request #5030 from chimp1984/fix-incorrect-map-lookup-forhistorical-data-stores

[1.5.4] We need to use the getMapOfAllData method for HistoricalDataStoreServices
This commit is contained in:
sqrrm 2020-12-31 11:28:30 +01:00 committed by GitHub
commit 4c14d4e232
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,7 +78,12 @@ public class AppendOnlyDataStoreService {
public Map<P2PDataStorage.ByteArray, PersistableNetworkPayload> getMap() {
return services.stream()
.flatMap(service -> service.getMap().entrySet().stream())
.flatMap(service -> {
Map<P2PDataStorage.ByteArray, PersistableNetworkPayload> map = service instanceof HistoricalDataStoreService ?
((HistoricalDataStoreService) service).getMapOfAllData() :
service.getMap();
return map.entrySet().stream();
})
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}