|
1 | 1 | package byzzbench.simulator.transport;
|
2 | 2 |
|
3 |
| -import java.io.Serializable; |
4 |
| - |
5 | 3 | import lombok.Getter;
|
6 | 4 |
|
| 5 | +import java.io.Serializable; |
| 6 | + |
7 | 7 | /**
|
8 | 8 | * Interface for the payload of a {@link MessageEvent}.
|
9 | 9 | */
|
10 | 10 | @Getter
|
11 | 11 | public abstract class MessagePayload implements Serializable {
|
12 |
| - // Could be removed as we can just check |
13 |
| - // signedBy != null |
14 |
| - private boolean signed; |
15 |
| - private String signedBy; |
16 |
| - |
17 |
| - /** |
18 |
| - * A string representation of the message type. |
19 |
| - */ |
20 |
| - public abstract String getType(); |
21 |
| - |
22 |
| - |
23 |
| - /* |
24 |
| - * Dummy function to validate the signature of the |
25 |
| - * message instance. Returns true if the message was |
26 |
| - * signed by @param id. |
27 |
| - */ |
28 |
| - public boolean isSignedBy(String id) { |
29 |
| - return this.signed && this.signedBy.equals(id); |
30 |
| - } |
31 |
| - |
32 |
| - /* |
33 |
| - * Dummy function to sign the message with the public |
34 |
| - * key of the @param sender. |
35 |
| - */ |
36 |
| - public void sign(String sender) { |
37 |
| - this.signed = true; |
38 |
| - this.signedBy = sender; |
39 |
| - } |
| 12 | + private String signedBy; |
| 13 | + |
| 14 | + /** |
| 15 | + * A string representation of the message type. |
| 16 | + */ |
| 17 | + public abstract String getType(); |
| 18 | + |
| 19 | + |
| 20 | + /* |
| 21 | + * Dummy function to validate the signature of the |
| 22 | + * message instance. Returns true if the message was |
| 23 | + * signed by @param id. |
| 24 | + */ |
| 25 | + public boolean isSignedBy(String id) { |
| 26 | + return this.isSigned() && this.signedBy.equals(id); |
| 27 | + } |
| 28 | + |
| 29 | + /* |
| 30 | + * Dummy function to sign the message with the public |
| 31 | + * key of the @param sender. |
| 32 | + */ |
| 33 | + public void sign(String sender) { |
| 34 | + this.signedBy = sender; |
| 35 | + } |
| 36 | + |
| 37 | + public boolean isSigned() { |
| 38 | + return this.signedBy != null; |
| 39 | + } |
40 | 40 | }
|
0 commit comments