From 821eece5d06a787576fc5bbd98325bb1506c7f41 Mon Sep 17 00:00:00 2001 From: HashEngineering Date: Wed, 11 Sep 2024 16:32:23 -0700 Subject: [PATCH] feat: add getMasternodesByVotingKey method to SimplifiedMasternodeList --- .../org/bitcoinj/evolution/SimplifiedMasternodeList.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/src/main/java/org/bitcoinj/evolution/SimplifiedMasternodeList.java b/core/src/main/java/org/bitcoinj/evolution/SimplifiedMasternodeList.java index 34aa986c7..b24988f4e 100644 --- a/core/src/main/java/org/bitcoinj/evolution/SimplifiedMasternodeList.java +++ b/core/src/main/java/org/bitcoinj/evolution/SimplifiedMasternodeList.java @@ -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; @@ -338,6 +339,12 @@ public Masternode getMNByAddress(InetSocketAddress socketAddress) { return null; } + public List getMasternodesByVotingKey(KeyId votingKeyId) { + return mnMap.values().stream() + .filter(simplifiedMasternodeListEntry -> simplifiedMasternodeListEntry.keyIdVoting.equals(votingKeyId)) + .collect(Collectors.toList()); + } + public interface ForeachMNCallback { void processMN(SimplifiedMasternodeListEntry mn); }