Updated on 2026-08-14
This commit is contained in:
parent
1c45b2980f
commit
9ac6554dec
4 changed files with 27 additions and 45 deletions
|
|
@ -54,9 +54,8 @@ public class ElectrumTask extends AsyncTask<ElectrumRequest, Integer, List<Elect
|
|||
result.add(requests[i]);
|
||||
}
|
||||
try {
|
||||
|
||||
InetAddress serverAddress = InetAddress.getByName(Host);
|
||||
Log.v(logTag, "Connecting..."+Host);
|
||||
Log.v(logTag, "Connecting..." + Host);
|
||||
// Socket socket = new Socket(serverAddress, Port);
|
||||
Socket socket = new Socket();
|
||||
socket.setSoTimeout(5000);
|
||||
|
|
@ -102,8 +101,8 @@ public class ElectrumTask extends AsyncTask<ElectrumRequest, Integer, List<Elect
|
|||
out.flush();
|
||||
|
||||
request.answerData = in.readLine();
|
||||
request.Host=Host;
|
||||
request.Port=Port;
|
||||
request.Host = Host;
|
||||
request.Port = Port;
|
||||
if (request.answerData != null) {
|
||||
Log.v(logTag, ">> " + request.answerData);
|
||||
} else {
|
||||
|
|
@ -116,7 +115,7 @@ public class ElectrumTask extends AsyncTask<ElectrumRequest, Integer, List<Elect
|
|||
}
|
||||
|
||||
public String getValidationNodeDescription() {
|
||||
return "Electrum, "+Host+":"+String.valueOf(Port);
|
||||
return "Electrum, " + Host + ":" + String.valueOf(Port);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -59,9 +59,7 @@ public class UpdateWalletInfoTask extends ElectrumTask {
|
|||
// loadedWallet.updateTasks.remove(this);
|
||||
|
||||
try {
|
||||
CoinEngine engine = CoinEngineFactory.create(
|
||||
loadedWallet.getCard().getBlockchain());
|
||||
|
||||
CoinEngine engine = CoinEngineFactory.create(loadedWallet.getCard().getBlockchain());
|
||||
for (ElectrumRequest request : requests) {
|
||||
try {
|
||||
if (request.error == null) {
|
||||
|
|
@ -73,7 +71,7 @@ public class UpdateWalletInfoTask extends ElectrumTask {
|
|||
loadedWallet.getCard().setBalanceReceived(true);
|
||||
|
||||
if (sharedCounter != null) {
|
||||
boolean notEqualBalance = sharedCounter.UpdatePayload(new BigDecimal(String.valueOf(confBalance)));
|
||||
boolean notEqualBalance = sharedCounter.updatePayload(new BigDecimal(String.valueOf(confBalance)));
|
||||
if (notEqualBalance)
|
||||
loadedWallet.getCard().setIsBalanceEqual(false);
|
||||
int counter = sharedCounter.requestCounter.incrementAndGet();
|
||||
|
|
@ -82,7 +80,6 @@ public class UpdateWalletInfoTask extends ElectrumTask {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
loadedWallet.getCard().setBalanceConfirmed(confBalance);
|
||||
loadedWallet.getCard().setBalanceUnconfirmed(unconf);
|
||||
loadedWallet.getCard().setDecimalBalance(String.valueOf(confBalance));
|
||||
|
|
@ -206,13 +203,10 @@ public class UpdateWalletInfoTask extends ElectrumTask {
|
|||
JSONObject jsHeader = request.getResult();
|
||||
try {
|
||||
loadedWallet.getCard().getHaedersInfo();
|
||||
loadedWallet.getCard().UpdateHeaderInfo(new TangemCard.HeaderInfo(
|
||||
jsHeader.getInt("block_height"),
|
||||
jsHeader.getInt("timestamp")));
|
||||
loadedWallet.getCard().UpdateHeaderInfo(new TangemCard.HeaderInfo(jsHeader.getInt("block_height"), jsHeader.getInt("timestamp")));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
engine.switchNode(loadedWallet.getCard());
|
||||
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
|
|
@ -228,9 +222,8 @@ public class UpdateWalletInfoTask extends ElectrumTask {
|
|||
|
||||
List<TangemCard.UnspentTransaction> listTx = loadedWallet.getCard().getUnspentTransactions();
|
||||
for (TangemCard.UnspentTransaction tx : listTx) {
|
||||
if (tx.txID.equals(txHash)) {
|
||||
if (tx.txID.equals(txHash))
|
||||
tx.Raw = raw;
|
||||
}
|
||||
}
|
||||
|
||||
List<TangemCard.HistoryTransaction> listHTx = loadedWallet.getCard().getHistoryTransactions();
|
||||
|
|
@ -239,14 +232,12 @@ public class UpdateWalletInfoTask extends ElectrumTask {
|
|||
tx.Raw = raw;
|
||||
try {
|
||||
ArrayList<byte[]> prevHashes = BTCUtils.getPrevTX(raw);
|
||||
|
||||
boolean isOur = false;
|
||||
for (byte[] hash : prevHashes) {
|
||||
String checkID = BTCUtils.toHex(hash);
|
||||
for (TangemCard.HistoryTransaction txForCheck : listHTx) {
|
||||
if (txForCheck.txID == checkID) {
|
||||
if (txForCheck.txID.equals(checkID))
|
||||
isOur = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue