Skip to content

Commit

Permalink
Merge pull request #4981 from chimp1984/fix-wrong-account-age-data-ac…
Browse files Browse the repository at this point in the history
…cess

[1.5.2] Fix wrong account age data access
  • Loading branch information
sqrrm authored Dec 21, 2020
2 parents 402c8ef + 264a844 commit c801a57
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ public String getDisplayString() {
private final User user;
private final SignedWitnessService signedWitnessService;
private final ChargeBackRisk chargeBackRisk;
private final AccountAgeWitnessStorageService accountAgeWitnessStorageService;
private final FilterManager filterManager;
@Getter
private final AccountAgeWitnessUtils accountAgeWitnessUtils;

@Getter
private final Map<P2PDataStorage.ByteArray, AccountAgeWitness> accountAgeWitnessMap = new HashMap<>();

Expand All @@ -162,6 +162,7 @@ public AccountAgeWitnessService(KeyRing keyRing,
this.user = user;
this.signedWitnessService = signedWitnessService;
this.chargeBackRisk = chargeBackRisk;
this.accountAgeWitnessStorageService = accountAgeWitnessStorageService;
this.filterManager = filterManager;

accountAgeWitnessUtils = new AccountAgeWitnessUtils(
Expand All @@ -185,10 +186,10 @@ public void onAllServicesInitialized() {
});

// At startup the P2PDataStorage initializes earlier, otherwise we get the listener called.
p2PService.getP2PDataStorage().getAppendOnlyDataStoreMap().values().forEach(e -> {
if (e instanceof AccountAgeWitness)
addToMap((AccountAgeWitness) e);
});
accountAgeWitnessStorageService.getMapOfAllData().values().stream()
.filter(e -> e instanceof AccountAgeWitness)
.map(e -> (AccountAgeWitness) e)
.forEach(this::addToMap);

if (p2PService.isBootstrapped()) {
onBootStrapped();
Expand Down

0 comments on commit c801a57

Please sign in to comment.