Updated on 2026-08-14
This commit is contained in:
parent
4d5cc7255b
commit
439f4f927a
4 changed files with 16 additions and 15 deletions
|
|
@ -28,13 +28,12 @@ import io.reactivex.observers.DefaultObserver;
|
|||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class ServerApiHelperElectrum {
|
||||
// private static String TAG = ServerApiHelper.class.getSimpleName();
|
||||
// private static String TAG = ServerApiHelper.class.getSimpleName();
|
||||
private static String TAG = ServerApiHelperElectrum.class.getSimpleName();
|
||||
|
||||
/**
|
||||
* TCP
|
||||
* Used in BTC
|
||||
* https://sidstudio.com.ua/sidstudio-blog/%D0%BF%D0%B5%D1%80%D0%B5%D0%B4%D0%B0%D1%87%D0%B0-%D0%B4%D0%B0%D0%BD%D0%BD%D1%8B%D1%85-%D0%BF%D0%BE-%D1%81%D0%B5%D1%82%D0%B8-%D0%BF%D1%80%D0%B8-%D0%BF%D0%BE%D0%BC%D0%BE%D1%89%D0%B8-socket-%D0%BF%D1%80%D0%B8-%D1%80%D0%B0%D0%B7%D1%80%D0%B0%D0%B1%D0%BE%D1%82%D0%BA%D0%B5-android-%D0%BF%D1%80%D0%B8%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D1%8F
|
||||
*/
|
||||
private String host;
|
||||
private int port;
|
||||
|
|
@ -65,7 +64,7 @@ public class ServerApiHelperElectrum {
|
|||
|
||||
.retryWhen(errors -> errors
|
||||
.filter(throwable -> throwable instanceof NullPointerException)
|
||||
.zipWith(Observable.range(1, 2), (n, i) -> i))
|
||||
.zipWith(Observable.range(1, 4), (n, i) -> i))
|
||||
|
||||
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
|
@ -112,13 +111,15 @@ public class ServerApiHelperElectrum {
|
|||
Collections.addAll(result, electrumRequest);
|
||||
|
||||
try {
|
||||
// Socket socket = App.getComponent().getSocket();
|
||||
Socket socket = App.getComponent().getSocket();
|
||||
|
||||
Socket socket = new Socket();
|
||||
socket.setSoTimeout(5000);
|
||||
socket.bind(new InetSocketAddress(0));
|
||||
// Socket socket = new Socket();
|
||||
// socket.setSoTimeout(5000);
|
||||
// socket.bind(new InetSocketAddress(0));
|
||||
|
||||
|
||||
Log.i(TAG, host + " " + port);
|
||||
|
||||
socket.connect(new InetSocketAddress(InetAddress.getByName(host), port));
|
||||
try {
|
||||
OutputStream os = socket.getOutputStream();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ enum class BitcoinNode(val host: String, val port: Int) {
|
|||
n14("electrum.vom-stausee.de", 50001),
|
||||
n15("helicarrier.bauerj.eu", 50001),
|
||||
n16("kirsche.emzy.de", 50001),
|
||||
n17("spv.48.org", 50003),
|
||||
n18("vps.hsmiths.com", 50001),
|
||||
// n17("spv.48.org", 50003),
|
||||
// n18("vps.hsmiths.com", 50001),
|
||||
}
|
||||
|
|
@ -33,8 +33,8 @@ public class BtcEngine extends CoinEngine {
|
|||
BitcoinNode.n14.getHost(),
|
||||
BitcoinNode.n15.getHost(),
|
||||
BitcoinNode.n16.getHost(),
|
||||
BitcoinNode.n17.getHost(),
|
||||
BitcoinNode.n18.getHost(),
|
||||
// BitcoinNode.n17.getHost(),
|
||||
// BitcoinNode.n18.getHost(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -44,8 +44,8 @@ public class BtcEngine extends CoinEngine {
|
|||
BitcoinNode.n14.getPort(),
|
||||
BitcoinNode.n15.getPort(),
|
||||
BitcoinNode.n16.getPort(),
|
||||
BitcoinNode.n17.getPort(),
|
||||
BitcoinNode.n18.getPort(),
|
||||
// BitcoinNode.n17.getPort(),
|
||||
// BitcoinNode.n18.getPort(),
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
val height = jsUnspent.getInt("height")
|
||||
val hash = jsUnspent.getString("tx_hash")
|
||||
if (height != -1) {
|
||||
// requestElectrum(card!!, ElectrumRequest.getTransaction(walletAddress, hash))
|
||||
requestElectrum(card!!, ElectrumRequest.getTransaction(walletAddress, hash))
|
||||
}
|
||||
}
|
||||
} catch (e: JSONException) {
|
||||
|
|
@ -869,7 +869,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific
|
|||
card!!.setIsBalanceEqual(true)
|
||||
|
||||
requestElectrum(card!!, ElectrumRequest.checkBalance(card!!.wallet))
|
||||
// requestElectrum(card!!, ElectrumRequest.listUnspent(card!!.wallet))
|
||||
requestElectrum(card!!, ElectrumRequest.listUnspent(card!!.wallet))
|
||||
requestRateInfo("bitcoin")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue