use of org.hyperledger.besu.ethereum.privacy.PrivateTransactionEvent in project besu by hyperledger.
the class FlexiblePrivacyPrecompiledContract method sendParticipantRemovedEvent.
private void sendParticipantRemovedEvent(final PrivateTransaction privateTransaction) {
if (isRemovingParticipant(privateTransaction)) {
// get first participant parameter - there is only one for removal transaction
final String removedParticipant = getRemovedParticipantFromParameter(privateTransaction.getPayload());
final PrivateTransactionEvent removalEvent = new PrivateTransactionEvent(privateTransaction.getPrivacyGroupId().get().toBase64String(), removedParticipant);
privateTransactionEventObservers.forEach(sub -> sub.onPrivateTransactionProcessed(removalEvent));
}
}
use of org.hyperledger.besu.ethereum.privacy.PrivateTransactionEvent in project besu by hyperledger.
the class SubscriptionManagerTest method shouldUnsubscribeIfUserRemovedFromPrivacyGroup.
@Test
public void shouldUnsubscribeIfUserRemovedFromPrivacyGroup() {
final String enclavePublicKey = "C1bVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo=";
final FilterParameter filterParameter = new FilterParameter(BlockParameter.EARLIEST, BlockParameter.LATEST, null, null, null, null, null, null, null);
final String privacyGroupId = "ZDmkMK7CyxA1F1rktItzKFTfRwApg7aWzsTtm2IOZ5Y=";
final PrivateSubscribeRequest privateSubscribeRequest = new PrivateSubscribeRequest(SubscriptionType.LOGS, filterParameter, null, CONNECTION_ID, privacyGroupId, enclavePublicKey);
final Long subscriptionId = subscriptionManager.subscribe(privateSubscribeRequest);
assertThat(subscriptionManager.subscriptionsOfType(SubscriptionType.LOGS, PrivateLogsSubscription.class).size()).isEqualTo(1);
subscriptionManager.onPrivateTransactionProcessed(new PrivateTransactionEvent(privacyGroupId, enclavePublicKey));
subscriptionManager.onBlockAdded();
assertThat(subscriptionManager.subscriptionsOfType(SubscriptionType.LOGS, PrivateLogsSubscription.class).size()).isEqualTo(0);
assertThat(subscriptionManager.getSubscriptionById(subscriptionId)).isNull();
}
use of org.hyperledger.besu.ethereum.privacy.PrivateTransactionEvent in project besu by hyperledger.
the class FilterManagerLogFilterTest method privateTransactionEvent.
private void privateTransactionEvent(final String privacyGroupId, final String privacyUserId) {
PrivateTransactionEvent event = new PrivateTransactionEvent(privacyGroupId, privacyUserId);
filterManager.processRemovalEvent(event);
}
Aggregations