diff --git a/src/main/java/com/sparrowwallet/sparrow/net/BroadcastSource.java b/src/main/java/com/sparrowwallet/sparrow/net/BroadcastSource.java index a376ed46..6d1c9d3d 100644 --- a/src/main/java/com/sparrowwallet/sparrow/net/BroadcastSource.java +++ b/src/main/java/com/sparrowwallet/sparrow/net/BroadcastSource.java @@ -40,6 +40,22 @@ public enum BroadcastSource { return postTransactionData(data); } + protected URL getURL(Proxy proxy) throws MalformedURLException { + if(Network.get() == Network.MAINNET) { + return new URL(getBaseUrl(proxy) + "/api/tx"); + } else if(Network.get() == Network.TESTNET) { + return new URL(getBaseUrl(proxy) + "/testnet/api/tx"); + } else { + throw new IllegalStateException("Cannot broadcast transaction to " + getName() + " on network " + Network.get()); + } + } + }, + MEMPOOL_EMZY_DE("mempool.emzy.de", "https://mempool.emzy.de", "http://mempool4t6mypeemozyterviq3i5de4kpoua65r3qkn5i3kknu5l2cad.onion") { + public Sha256Hash broadcastTransaction(Transaction transaction) throws BroadcastException { + String data = Utils.bytesToHex(transaction.bitcoinSerialize()); + return postTransactionData(data); + } + protected URL getURL(Proxy proxy) throws MalformedURLException { if(Network.get() == Network.MAINNET) { return new URL(getBaseUrl(proxy) + "/api/tx");