diff --git a/cj-btc-rx-jsonrpc/src/main/java/org/consensusj/bitcoin/rx/jsonrpc/PollingChainTipService.java b/cj-btc-rx-jsonrpc/src/main/java/org/consensusj/bitcoin/rx/jsonrpc/PollingChainTipService.java index 5bce81b3e..d86a6a643 100644 --- a/cj-btc-rx-jsonrpc/src/main/java/org/consensusj/bitcoin/rx/jsonrpc/PollingChainTipService.java +++ b/cj-btc-rx-jsonrpc/src/main/java/org/consensusj/bitcoin/rx/jsonrpc/PollingChainTipService.java @@ -5,13 +5,17 @@ import io.reactivex.rxjava3.core.Maybe; import io.reactivex.rxjava3.core.Observable; import org.consensusj.bitcoin.json.pojo.ChainTip; +import org.consensusj.bitcoin.jsonrpc.ChainTipClient; +import org.consensusj.bitcoin.rx.ChainTipService; +import org.consensusj.rx.jsonrpc.RxJsonRpcClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +//TODO: Merge with PollingChainTipServiceImpl /** * Interface with {@link PollingChainTipService#pollForDistinctChainTip()} method. */ -public interface PollingChainTipService extends RxJsonChainTipClient { +public interface PollingChainTipService extends ChainTipService, ChainTipClient, RxJsonRpcClient { Logger log = LoggerFactory.getLogger(PollingChainTipService.class); /** diff --git a/cj-btc-rx-jsonrpc/src/main/java/org/consensusj/bitcoin/rx/jsonrpc/PollingChainTipServiceImpl.java b/cj-btc-rx-jsonrpc/src/main/java/org/consensusj/bitcoin/rx/jsonrpc/PollingChainTipServiceImpl.java index 90895d610..180be862e 100644 --- a/cj-btc-rx-jsonrpc/src/main/java/org/consensusj/bitcoin/rx/jsonrpc/PollingChainTipServiceImpl.java +++ b/cj-btc-rx-jsonrpc/src/main/java/org/consensusj/bitcoin/rx/jsonrpc/PollingChainTipServiceImpl.java @@ -7,6 +7,7 @@ import io.reactivex.rxjava3.processors.BehaviorProcessor; import io.reactivex.rxjava3.processors.FlowableProcessor; import org.consensusj.bitcoin.jsonrpc.BitcoinClient; +import org.consensusj.bitcoin.rx.ChainTipService; import org.consensusj.jsonrpc.JsonRpcStatusException; import org.reactivestreams.Publisher; import org.slf4j.Logger; @@ -18,11 +19,12 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; +//TODO: Merge with PollingChainTipService /** * Implementation of {@link PollingChainTipService} using a {@link BitcoinClient} and a polling interval. * This can be used as a fallback if ZeroMQ is not available */ -public class PollingChainTipServiceImpl implements Closeable, PollingChainTipService { +public class PollingChainTipServiceImpl implements ChainTipService, PollingChainTipService, Closeable { private static final Logger log = LoggerFactory.getLogger(PollingChainTipServiceImpl.class); private final BitcoinClient client; private final Observable interval; diff --git a/cj-btc-rx-jsonrpc/src/main/java/org/consensusj/bitcoin/rx/jsonrpc/RxBitcoinClient.java b/cj-btc-rx-jsonrpc/src/main/java/org/consensusj/bitcoin/rx/jsonrpc/RxBitcoinClient.java index d9cedc28b..8031ba334 100644 --- a/cj-btc-rx-jsonrpc/src/main/java/org/consensusj/bitcoin/rx/jsonrpc/RxBitcoinClient.java +++ b/cj-btc-rx-jsonrpc/src/main/java/org/consensusj/bitcoin/rx/jsonrpc/RxBitcoinClient.java @@ -7,13 +7,14 @@ import org.consensusj.bitcoin.jsonrpc.BitcoinExtendedClient; import org.consensusj.bitcoin.rx.ChainTipService; import org.consensusj.bitcoin.rx.zeromq.RxBitcoinZmqService; +import org.consensusj.rx.jsonrpc.RxJsonRpcClient; import javax.net.ssl.SSLContext; import java.net.URI; /** * A {@link BitcoinClient} enhanced with Reactive features. Can use either ZeroMQ or polling - * to implement {@link RxJsonChainTipClient}. + * to implement {@link ChainTipService}. *

* TODO: answer the below questions *

@@ -23,7 +24,7 @@ * Should this class be renamed to {@code RxBitcoinJsonRpcClient} and the {@code RxBitcoinClient} interface be moved * to {@code cj-btc-rx?} */ -public class RxBitcoinClient extends BitcoinExtendedClient implements RxJsonChainTipClient { +public class RxBitcoinClient extends BitcoinExtendedClient implements ChainTipService, RxJsonRpcClient { private final ChainTipService chainTipService; public RxBitcoinClient(Network network, URI server, String rpcuser, String rpcpassword) { diff --git a/cj-btc-rx-jsonrpc/src/main/java/org/consensusj/bitcoin/rx/jsonrpc/RxJsonChainTipClient.java b/cj-btc-rx-jsonrpc/src/main/java/org/consensusj/bitcoin/rx/jsonrpc/RxJsonChainTipClient.java index 5f7ff159f..c21a53073 100644 --- a/cj-btc-rx-jsonrpc/src/main/java/org/consensusj/bitcoin/rx/jsonrpc/RxJsonChainTipClient.java +++ b/cj-btc-rx-jsonrpc/src/main/java/org/consensusj/bitcoin/rx/jsonrpc/RxJsonChainTipClient.java @@ -1,7 +1,6 @@ package org.consensusj.bitcoin.rx.jsonrpc; import io.reactivex.rxjava3.core.Flowable; -import org.consensusj.bitcoin.jsonrpc.ChainTipClient; import org.consensusj.bitcoin.rx.ChainTipService; import org.consensusj.jsonrpc.AsyncSupport; import org.consensusj.rx.jsonrpc.RxJsonRpcClient; @@ -12,7 +11,8 @@ /** * A JSON-RPC client interface that provides ChainTipService */ -public interface RxJsonChainTipClient extends ChainTipService, ChainTipClient, RxJsonRpcClient { +@Deprecated +public interface RxJsonChainTipClient extends ChainTipService, RxJsonRpcClient { /** * Repeatedly once-per-new-block poll a method