diff --git a/core/src/main/java/com/google/bitcoin/protocols/channels/PaymentChannelServer.java b/core/src/main/java/com/google/bitcoin/protocols/channels/PaymentChannelServer.java index 945d417e..6eee72d6 100644 --- a/core/src/main/java/com/google/bitcoin/protocols/channels/PaymentChannelServer.java +++ b/core/src/main/java/com/google/bitcoin/protocols/channels/PaymentChannelServer.java @@ -26,6 +26,7 @@ import net.jcip.annotations.GuardedBy; import org.bitcoin.paymentchannel.Protos; import org.slf4j.LoggerFactory; +import javax.annotation.Nullable; import java.math.BigInteger; import java.util.concurrent.locks.ReentrantLock; @@ -157,6 +158,15 @@ public class PaymentChannelServer { 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") private void receiveVersionMessage(Protos.TwoWayChannelMessage msg) throws VerificationException { Protos.ServerVersion.Builder versionNegotiationBuilder = Protos.ServerVersion.newBuilder()