Skip to content

Commit

Permalink
feat: add getMasternodesByVotingKey method to SimplifiedMasternodeList
Browse files Browse the repository at this point in the history
  • Loading branch information
HashEngineering committed Sep 11, 2024
1 parent a6a6eb7 commit 821eece
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.nio.ByteBuffer;
import java.util.*;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static java.lang.Math.min;
Expand Down Expand Up @@ -338,6 +339,12 @@ public Masternode getMNByAddress(InetSocketAddress socketAddress) {
return null;
}

public List<Masternode> getMasternodesByVotingKey(KeyId votingKeyId) {
return mnMap.values().stream()
.filter(simplifiedMasternodeListEntry -> simplifiedMasternodeListEntry.keyIdVoting.equals(votingKeyId))
.collect(Collectors.toList());
}

public interface ForeachMNCallback {
void processMN(SimplifiedMasternodeListEntry mn);
}
Expand Down

0 comments on commit 821eece

Please sign in to comment.