diff --git a/wallets/bitcoind/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/BitcoindRawTxProcessor.java b/wallets/bitcoind/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/BitcoindRawTxProcessor.java index 9f2d868818..2bd4c177a4 100644 --- a/wallets/bitcoind/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/BitcoindRawTxProcessor.java +++ b/wallets/bitcoind/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/BitcoindRawTxProcessor.java @@ -17,9 +17,9 @@ package bisq.wallets.bitcoind.zmq; -import bisq.common.encoding.Hex; import bisq.wallets.bitcoind.rpc.BitcoindDaemon; import bisq.wallets.bitcoind.rpc.responses.BitcoindDecodeRawTransactionResponse; +import com.google.common.io.BaseEncoding; public class BitcoindRawTxProcessor implements ZmqRawTxProcessor { @@ -33,7 +33,7 @@ public BitcoindRawTxProcessor(BitcoindDaemon daemon, ZmqListeners listeners) { @Override public void processRawTx(byte[] serializedTx, byte[] sequenceNumber) { - String txInHex = Hex.encode(serializedTx); + String txInHex = BaseEncoding.base16().lowerCase().encode(serializedTx); BitcoindDecodeRawTransactionResponse.Result rawTransaction = daemon.decodeRawTransaction(txInHex).getResult(); listeners.fireTxOutputAddressesListeners(rawTransaction); listeners.fireTxIdInputListeners(rawTransaction); diff --git a/wallets/bitcoind/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/ZmqConnection.java b/wallets/bitcoind/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/ZmqConnection.java index 57776ce28c..ec45ba8eb5 100644 --- a/wallets/bitcoind/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/ZmqConnection.java +++ b/wallets/bitcoind/bitcoind/src/main/java/bisq/wallets/bitcoind/zmq/ZmqConnection.java @@ -17,10 +17,10 @@ package bisq.wallets.bitcoind.zmq; -import bisq.common.threading.ExecutorFactory; import bisq.wallets.bitcoind.rpc.responses.BitcoindGetZmqNotificationsResponse; import bisq.wallets.bitcoind.zmq.exceptions.CannotFindZmqAddressException; import bisq.wallets.bitcoind.zmq.exceptions.CannotFindZmqTopicException; +import com.google.common.util.concurrent.ThreadFactoryBuilder; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.zeromq.SocketType; @@ -33,6 +33,8 @@ import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; import java.util.stream.Collectors; @Slf4j @@ -45,8 +47,8 @@ public class ZmqConnection implements AutoCloseable { @Getter private final ZmqListeners listeners; - private final ExecutorService executorService = ExecutorFactory - .newFixedThreadPool("wallet-zeromq-notification-thread-pool", 2); + private final ExecutorService executorService = + newFixedThreadPool("wallet-zeromq-notification-thread-pool", 2); private ZContext context; @@ -151,4 +153,12 @@ private boolean isSocketClosed(int errorCode) { private boolean isZeroMqContextTerminated(int errorCode) { return errorCode == ERROR_CODE_CONTEXT_TERMINATED; } + + public ExecutorService newFixedThreadPool(String name, int numThreads) { + ThreadFactory threadFactory = new ThreadFactoryBuilder() + .setNameFormat(name + "-%d") + .setDaemon(true) + .build(); + return Executors.newFixedThreadPool(numThreads, threadFactory); + } }