mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Use getSignedWitnessSet instead of
iterations over getSignedWitnessMapValues
This commit is contained in:
parent
aea904d24f
commit
1462673e57
1 changed files with 3 additions and 6 deletions
|
@ -74,6 +74,7 @@ public class SignedWitnessService {
|
|||
private final P2PService p2PService;
|
||||
private final ArbitratorManager arbitratorManager;
|
||||
private final User user;
|
||||
private final FilterManager filterManager;
|
||||
|
||||
private final Map<P2PDataStorage.ByteArray, SignedWitness> signedWitnessMap = new HashMap<>();
|
||||
|
||||
|
@ -81,8 +82,6 @@ public class SignedWitnessService {
|
|||
// This avoids iterations over the signedWitnessMap for getting the set of such SignedWitnesses.
|
||||
private final Map<P2PDataStorage.ByteArray, Set<SignedWitness>> signedWitnessSetByAccountAgeWitnessHash = new HashMap<>();
|
||||
|
||||
private final FilterManager filterManager;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
|
@ -360,17 +359,15 @@ public class SignedWitnessService {
|
|||
|
||||
// SignedWitness objects signed by arbitrators
|
||||
public Set<SignedWitness> getArbitratorsSignedWitnessSet(AccountAgeWitness accountAgeWitness) {
|
||||
return getSignedWitnessMapValues().stream()
|
||||
return getSignedWitnessSet(accountAgeWitness).stream()
|
||||
.filter(SignedWitness::isSignedByArbitrator)
|
||||
.filter(e -> Arrays.equals(e.getAccountAgeWitnessHash(), accountAgeWitness.getHash()))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
// SignedWitness objects signed by any other peer
|
||||
public Set<SignedWitness> getTrustedPeerSignedWitnessSet(AccountAgeWitness accountAgeWitness) {
|
||||
return getSignedWitnessMapValues().stream()
|
||||
return getSignedWitnessSet(accountAgeWitness).stream()
|
||||
.filter(e -> !e.isSignedByArbitrator())
|
||||
.filter(e -> Arrays.equals(e.getAccountAgeWitnessHash(), accountAgeWitness.getHash()))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue