@Override public int getNoOfParties() { return network.getNoOfParties(); }
@Override public int getNoOfParties() { return delegate.getNoOfParties(); }
/** * Decorates a regular network with actively secure broadcast functionality. * * @param network raw network * @param validator the broadcast validation protocol */ public BroadcastingNetworkProxy(Network network, BroadcastValidation validator) { if (network.getNoOfParties() < 3) { throw new IllegalArgumentException("Broadcast only needed for three or more parties"); } this.network = network; this.validator = validator; }
/** * Queues up a value to be send to all parties (yourself included). * * @param data The value to send to all parties */ default void sendToAll(byte[] data) { for (int i = 1; i <= getNoOfParties(); i++) { send(i, data); } }
/** * Retrieves input from all players (including yourself) * * @return A list of byte buffers where the data from party 1 resides at * index 0 and so forth. */ default List<byte[]> receiveFromAll() { List<byte[]> res = new ArrayList<>(); for (int i = 1; i <= getNoOfParties(); i++) { res.add(receive(i)); } return res; }