package network.thunder.core.communication;

import network.thunder.core.communication.objects.subobjects.AuthenticationObject;

public class Node {
	private byte[] pubkey;
	private boolean isAuth;
	private boolean sentAuth;
	private boolean authFinished;
	private boolean isReady;
	private boolean hasOpenChannel;

	public boolean processAuthentication (AuthenticationObject authentication) {
		//TODO: Check authentication based on the supplied pubkey

		return true;
	}

	public AuthenticationObject getAuthenticationObject () {
		//TODO: Produce a proper authentication object..

		return new AuthenticationObject();
	}

	public boolean hasSentAuth () {
		return sentAuth;
	}

	public boolean isAuth () {
		return isAuth;
	}

	public boolean allowsAuth () {
		return !isAuth;
	}

	public void finishAuth () {
		authFinished = true;
	}

	public boolean isAuthFinished () {
		return authFinished;
	}
}

@@ -448,16 +448,79 @@
 pubkey%0A%0A
+%09%09isAuth = true;%0A%09%09if (sentAuth) %7B%0A%09%09%09authFinished = true;%0A%09%09%7D%0A
 %09%09return
@@ -640,16 +640,35 @@
 ject..%0A%0A
+%09%09sentAuth = true;%0A
 %09%09return

Fix node to set sentAuth whenever the object was generated