3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-12 10:15:52 +00:00

Payment channels: expose server state object via PaymentChannelServer property

This commit is contained in:
Mike Hearn 2013-11-13 16:42:40 +01:00
parent 6c40363c3d
commit bba5e2b449

View File

@ -26,6 +26,7 @@ import net.jcip.annotations.GuardedBy;
import org.bitcoin.paymentchannel.Protos; import org.bitcoin.paymentchannel.Protos;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
@ -157,6 +158,15 @@ public class PaymentChannelServer {
this.conn = checkNotNull(conn); this.conn = checkNotNull(conn);
} }
/**
* Returns the underlying {@link PaymentChannelServerState} object that is being manipulated. This object allows
* you to learn how much money has been transferred, etc. May be null if the channel wasn't negotiated yet.
*/
@Nullable
public PaymentChannelServerState state() {
return state;
}
@GuardedBy("lock") @GuardedBy("lock")
private void receiveVersionMessage(Protos.TwoWayChannelMessage msg) throws VerificationException { private void receiveVersionMessage(Protos.TwoWayChannelMessage msg) throws VerificationException {
Protos.ServerVersion.Builder versionNegotiationBuilder = Protos.ServerVersion.newBuilder() Protos.ServerVersion.Builder versionNegotiationBuilder = Protos.ServerVersion.newBuilder()