mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
We do not need to lookup in getSignedWitnessMapValues
anymore as we maintain the signedWitnessSetByAccountAgeWitnessHash at each add/remove operation.
This commit is contained in:
parent
b6a01d0ac7
commit
aea904d24f
1 changed files with 3 additions and 16 deletions
|
@ -353,22 +353,9 @@ public class SignedWitnessService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<SignedWitness> getSignedWitnessSet(AccountAgeWitness accountAgeWitness) {
|
public Set<SignedWitness> getSignedWitnessSet(AccountAgeWitness accountAgeWitness) {
|
||||||
byte[] accountAgeWitnessHash = accountAgeWitness.getHash();
|
P2PDataStorage.ByteArray key = new P2PDataStorage.ByteArray(accountAgeWitness.getHash());
|
||||||
P2PDataStorage.ByteArray key = new P2PDataStorage.ByteArray(accountAgeWitnessHash);
|
return signedWitnessSetByAccountAgeWitnessHash.getOrDefault(key, new HashSet<>());
|
||||||
// In case we get a new entry added to signedWitnessMap with our hash we remove the entry from the cache so
|
|
||||||
// that we use the updated signedWitnessMap to fill the cache new.
|
|
||||||
if (signedWitnessSetByAccountAgeWitnessHash.containsKey(key)) {
|
|
||||||
return signedWitnessSetByAccountAgeWitnessHash.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
Set<SignedWitness> result = getSignedWitnessMapValues().stream()
|
|
||||||
.filter(signedWitness -> Arrays.equals(signedWitness.getAccountAgeWitnessHash(), accountAgeWitnessHash))
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
|
|
||||||
signedWitnessSetByAccountAgeWitnessHash.put(key, result);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SignedWitness objects signed by arbitrators
|
// SignedWitness objects signed by arbitrators
|
||||||
|
|
Loading…
Add table
Reference in a new issue