diff --git a/core/src/main/java/com/google/bitcoin/core/PeerGroup.java b/core/src/main/java/com/google/bitcoin/core/PeerGroup.java index e8b475b3..04cb83b7 100644 --- a/core/src/main/java/com/google/bitcoin/core/PeerGroup.java +++ b/core/src/main/java/com/google/bitcoin/core/PeerGroup.java @@ -450,6 +450,14 @@ public class PeerGroup extends AbstractIdleService implements TransactionBroadca return ListenerRegistration.removeFromList(listener, peerEventListeners); } + /** + * Removes all event listeners simultaneously. Note that this includes listeners added internally by the framework + * so it's generally not advised to use this - it exists for special purposes only. + */ + public void clearEventListeners() { + peerEventListeners.clear(); + } + /** * Returns a newly allocated list containing the currently connected peers. If all you care about is the count, * use numConnectedPeers().