mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-24 23:00:36 -04:00
Use bitcoinJ fork
This commit is contained in:
parent
a80733d771
commit
c4905baef3
13 changed files with 110 additions and 77 deletions
12
core/pom.xml
12
core/pom.xml
|
@ -93,18 +93,6 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>sonatype-oss-snapshot</id>
|
|
||||||
<snapshots/>
|
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>repository.tomp2p.net</id>
|
|
||||||
<url>http://tomp2p.net/dev/mvn</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ch.qos.logback</groupId>
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
|
|
@ -112,7 +112,7 @@ public class TradeWalletService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastCreateOfferFeeTx(Transaction createOfferFeeTx, FutureCallback<Transaction> callback) {
|
public void broadcastCreateOfferFeeTx(Transaction createOfferFeeTx, FutureCallback<Transaction> callback) {
|
||||||
ListenableFuture<Transaction> future = walletAppKit.peerGroup().broadcastTransaction(createOfferFeeTx);
|
ListenableFuture<Transaction> future = walletAppKit.peerGroup().broadcastTransaction(createOfferFeeTx).future();
|
||||||
Futures.addCallback(future, callback);
|
Futures.addCallback(future, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ public class TradeWalletService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastTakeOfferFeeTx(Transaction takeOfferFeeTx, FutureCallback<Transaction> callback) throws InsufficientMoneyException {
|
public void broadcastTakeOfferFeeTx(Transaction takeOfferFeeTx, FutureCallback<Transaction> callback) throws InsufficientMoneyException {
|
||||||
ListenableFuture<Transaction> future = walletAppKit.peerGroup().broadcastTransaction(takeOfferFeeTx);
|
ListenableFuture<Transaction> future = walletAppKit.peerGroup().broadcastTransaction(takeOfferFeeTx).future();
|
||||||
Futures.addCallback(future, callback);
|
Futures.addCallback(future, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ public class TradeWalletService {
|
||||||
|
|
||||||
// Broadcast depositTx
|
// Broadcast depositTx
|
||||||
printTxWithInputs("depositTx", depositTx);
|
printTxWithInputs("depositTx", depositTx);
|
||||||
ListenableFuture<Transaction> broadcastComplete = walletAppKit.peerGroup().broadcastTransaction(depositTx);
|
ListenableFuture<Transaction> broadcastComplete = walletAppKit.peerGroup().broadcastTransaction(depositTx).future();
|
||||||
Futures.addCallback(broadcastComplete, callback);
|
Futures.addCallback(broadcastComplete, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ public class TradeWalletService {
|
||||||
|
|
||||||
printTxWithInputs("payoutTx", payoutTx);
|
printTxWithInputs("payoutTx", payoutTx);
|
||||||
|
|
||||||
ListenableFuture<Transaction> broadcastComplete = walletAppKit.peerGroup().broadcastTransaction(payoutTx);
|
ListenableFuture<Transaction> broadcastComplete = walletAppKit.peerGroup().broadcastTransaction(payoutTx).future();
|
||||||
Futures.addCallback(broadcastComplete, callback);
|
Futures.addCallback(broadcastComplete, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.bitcoinj.core.AbstractWalletEventListener;
|
||||||
import org.bitcoinj.core.Address;
|
import org.bitcoinj.core.Address;
|
||||||
import org.bitcoinj.core.AddressFormatException;
|
import org.bitcoinj.core.AddressFormatException;
|
||||||
import org.bitcoinj.core.Coin;
|
import org.bitcoinj.core.Coin;
|
||||||
import org.bitcoinj.core.DownloadListener;
|
import org.bitcoinj.core.DownloadProgressTracker;
|
||||||
import org.bitcoinj.core.InsufficientMoneyException;
|
import org.bitcoinj.core.InsufficientMoneyException;
|
||||||
import org.bitcoinj.core.NetworkParameters;
|
import org.bitcoinj.core.NetworkParameters;
|
||||||
import org.bitcoinj.core.Transaction;
|
import org.bitcoinj.core.Transaction;
|
||||||
|
@ -54,7 +54,6 @@ import java.io.Serializable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -420,7 +419,7 @@ public class WalletService {
|
||||||
return wallet != null ? getBalance(wallet.calculateAllSpendCandidates(true), address) : Coin.ZERO;
|
return wallet != null ? getBalance(wallet.calculateAllSpendCandidates(true), address) : Coin.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Coin getBalance(LinkedList<TransactionOutput> transactionOutputs, Address address) {
|
private Coin getBalance(List<TransactionOutput> transactionOutputs, Address address) {
|
||||||
Coin balance = Coin.ZERO;
|
Coin balance = Coin.ZERO;
|
||||||
for (TransactionOutput transactionOutput : transactionOutputs) {
|
for (TransactionOutput transactionOutput : transactionOutputs) {
|
||||||
if (transactionOutput.getScriptPubKey().isSentToAddress() || transactionOutput.getScriptPubKey().isPayToScriptHash()) {
|
if (transactionOutput.getScriptPubKey().isSentToAddress() || transactionOutput.getScriptPubKey().isPayToScriptHash()) {
|
||||||
|
@ -560,7 +559,7 @@ public class WalletService {
|
||||||
// Inner classes
|
// Inner classes
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private static class ObservableDownloadListener extends DownloadListener {
|
private static class ObservableDownloadListener extends DownloadProgressTracker {
|
||||||
|
|
||||||
private final Subject<Double, Double> subject = BehaviorSubject.create(0d);
|
private final Subject<Double, Double> subject = BehaviorSubject.create(0d);
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ import javax.crypto.NoSuchPaddingException;
|
||||||
import javax.crypto.SecretKey;
|
import javax.crypto.SecretKey;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
|
||||||
|
// TODO consider to use SealedObject
|
||||||
public class EncryptionService<T> {
|
public class EncryptionService<T> {
|
||||||
private static final Logger log = LoggerFactory.getLogger(EncryptionService.class);
|
private static final Logger log = LoggerFactory.getLogger(EncryptionService.class);
|
||||||
private static final String ALGO_SYM = "AES";
|
private static final String ALGO_SYM = "AES";
|
||||||
|
|
|
@ -324,8 +324,7 @@ public class ArbitratorRegistrationView extends ActivatableView<AnchorPane, Void
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onScriptsAdded(Wallet wallet, List<Script> scripts) {
|
public void onScriptsChanged(Wallet var1, List<Script> scripts, boolean isAddingScripts) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -108,6 +108,11 @@ class PendingTradesDataModel implements Activatable, DataModel {
|
||||||
|
|
||||||
// we sort by date, earliest first
|
// we sort by date, earliest first
|
||||||
list.sort((o1, o2) -> o2.getTrade().getDate().compareTo(o1.getTrade().getDate()));
|
list.sort((o1, o2) -> o2.getTrade().getDate().compareTo(o1.getTrade().getDate()));
|
||||||
|
|
||||||
|
if (list.size() > 0) {
|
||||||
|
selectTrade(list.get(0));
|
||||||
|
selectedIndex.set(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void selectTrade(PendingTradesListItem item) {
|
void selectTrade(PendingTradesListItem item) {
|
||||||
|
|
|
@ -280,7 +280,7 @@ public class PendingTradesView extends ActivatableViewAndModel<AnchorPane, Pendi
|
||||||
private void applyOffererState(PendingTradesViewModel.State state) {
|
private void applyOffererState(PendingTradesViewModel.State state) {
|
||||||
setPaymentsControlsVisible(false);
|
setPaymentsControlsVisible(false);
|
||||||
setSummaryControlsVisible(false);
|
setSummaryControlsVisible(false);
|
||||||
|
log.debug("applyOffererState " + state);
|
||||||
processBar.reset();
|
processBar.reset();
|
||||||
|
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
|
@ -357,7 +357,7 @@ public class PendingTradesView extends ActivatableViewAndModel<AnchorPane, Pendi
|
||||||
setSummaryControlsVisible(false);
|
setSummaryControlsVisible(false);
|
||||||
|
|
||||||
processBar.reset();
|
processBar.reset();
|
||||||
log.debug("applyTakerState "+state);
|
log.debug("applyTakerState " + state);
|
||||||
|
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
@ -506,7 +506,7 @@ public class PendingTradesView extends ActivatableViewAndModel<AnchorPane, Pendi
|
||||||
if (visible)
|
if (visible)
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
withdrawAddressTextField.requestFocus();
|
withdrawAddressTextField.requestFocus();
|
||||||
|
|
||||||
// delay it once more as it does not get applied at first runLater
|
// delay it once more as it does not get applied at first runLater
|
||||||
Platform.runLater(() -> scrollPane.setVvalue(scrollPane.getVmax()));
|
Platform.runLater(() -> scrollPane.setVvalue(scrollPane.getVmax()));
|
||||||
});
|
});
|
||||||
|
|
|
@ -22,8 +22,15 @@ import io.bitsquare.p2p.Peer;
|
||||||
|
|
||||||
import org.bitcoinj.core.Coin;
|
import org.bitcoinj.core.Coin;
|
||||||
import org.bitcoinj.core.Transaction;
|
import org.bitcoinj.core.Transaction;
|
||||||
|
import org.bitcoinj.core.TransactionConfidence;
|
||||||
import org.bitcoinj.utils.Fiat;
|
import org.bitcoinj.utils.Fiat;
|
||||||
|
|
||||||
|
import com.google.common.base.Throwables;
|
||||||
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
|
import com.google.common.util.concurrent.Futures;
|
||||||
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -31,8 +38,12 @@ import java.util.Date;
|
||||||
import javafx.beans.property.ObjectProperty;
|
import javafx.beans.property.ObjectProperty;
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class Trade implements Serializable {
|
public class Trade implements Serializable {
|
||||||
private static final long serialVersionUID = -8275323072940974077L;
|
private static final long serialVersionUID = -8275323072940974077L;
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(Trade.class);
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -84,6 +95,7 @@ public class Trade implements Serializable {
|
||||||
private Transaction depositTx;
|
private Transaction depositTx;
|
||||||
private Transaction payoutTx;
|
private Transaction payoutTx;
|
||||||
private Peer tradingPeer;
|
private Peer tradingPeer;
|
||||||
|
private int depthInBlocks = 0;
|
||||||
|
|
||||||
// For changing values we use properties to get binding support in the UI (table)
|
// For changing values we use properties to get binding support in the UI (table)
|
||||||
// When serialized those transient properties are not instantiated, so we instantiate them in the getters at first
|
// When serialized those transient properties are not instantiated, so we instantiate them in the getters at first
|
||||||
|
@ -103,6 +115,43 @@ public class Trade implements Serializable {
|
||||||
date = new Date();
|
date = new Date();
|
||||||
|
|
||||||
setProcessState(ProcessState.INIT);
|
setProcessState(ProcessState.INIT);
|
||||||
|
log.debug("Trade ");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
|
||||||
|
log.debug("Trade writeObject");
|
||||||
|
out.defaultWriteObject();
|
||||||
|
log.debug("Trade writeObject");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
|
||||||
|
log.debug("Trade readObject");
|
||||||
|
in.defaultReadObject();
|
||||||
|
//TODO cannot call yet as persistence need to be refactored first. cann be called only after bitcoinJ is initialized as serialized tx objects throw
|
||||||
|
// exceptions
|
||||||
|
//setConfidenceListener();
|
||||||
|
log.debug("Trade readObject");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setConfidenceListener() {
|
||||||
|
// log.debug("setConfidenceListener called. depthInBlocks=" + depthInBlocks + " / depositTx != null ? " + (depositTx.toString() != null));
|
||||||
|
if (depositTx != null && depthInBlocks == 0) {
|
||||||
|
TransactionConfidence transactionConfidence = depositTx.getConfidence();
|
||||||
|
ListenableFuture<TransactionConfidence> future = transactionConfidence.getDepthFuture(1);
|
||||||
|
Futures.addCallback(future, new FutureCallback<TransactionConfidence>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(TransactionConfidence result) {
|
||||||
|
setProcessState(Trade.ProcessState.DEPOSIT_CONFIRMED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable t) {
|
||||||
|
t.printStackTrace();
|
||||||
|
log.error(t.getMessage());
|
||||||
|
Throwables.propagate(t);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,6 +195,7 @@ public class Trade implements Serializable {
|
||||||
|
|
||||||
public void setDepositTx(Transaction tx) {
|
public void setDepositTx(Transaction tx) {
|
||||||
this.depositTx = tx;
|
this.depositTx = tx;
|
||||||
|
setConfidenceListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPayoutTx(Transaction tx) {
|
public void setPayoutTx(Transaction tx) {
|
||||||
|
|
|
@ -378,7 +378,9 @@ public class TradeManager {
|
||||||
persistPendingTrades();
|
persistPendingTrades();
|
||||||
|
|
||||||
TakerAsSellerProtocol sellerTakesOfferProtocol = createTakerAsSellerProtocol(trade);
|
TakerAsSellerProtocol sellerTakesOfferProtocol = createTakerAsSellerProtocol(trade);
|
||||||
|
//trade.setProtocol(sellerTakesOfferProtocol);
|
||||||
sellerTakesOfferProtocol.takeAvailableOffer();
|
sellerTakesOfferProtocol.takeAvailableOffer();
|
||||||
|
|
||||||
return trade;
|
return trade;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,10 +22,12 @@ import io.bitsquare.common.taskrunner.TaskRunner;
|
||||||
import io.bitsquare.trade.Trade;
|
import io.bitsquare.trade.Trade;
|
||||||
import io.bitsquare.trade.protocol.trade.offerer.models.OffererAsBuyerModel;
|
import io.bitsquare.trade.protocol.trade.offerer.models.OffererAsBuyerModel;
|
||||||
|
|
||||||
import org.bitcoinj.core.Transaction;
|
|
||||||
import org.bitcoinj.core.TransactionConfidence;
|
import org.bitcoinj.core.TransactionConfidence;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import com.google.common.base.Throwables;
|
||||||
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
|
import com.google.common.util.concurrent.Futures;
|
||||||
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -33,35 +35,28 @@ import org.slf4j.LoggerFactory;
|
||||||
public class SetupListenerForBlockChainConfirmation extends Task<OffererAsBuyerModel> {
|
public class SetupListenerForBlockChainConfirmation extends Task<OffererAsBuyerModel> {
|
||||||
private static final Logger log = LoggerFactory.getLogger(SetupListenerForBlockChainConfirmation.class);
|
private static final Logger log = LoggerFactory.getLogger(SetupListenerForBlockChainConfirmation.class);
|
||||||
|
|
||||||
private TransactionConfidence.Listener transactionConfidenceListener;
|
|
||||||
private TransactionConfidence transactionConfidence;
|
|
||||||
|
|
||||||
public SetupListenerForBlockChainConfirmation(TaskRunner taskHandler, OffererAsBuyerModel model) {
|
public SetupListenerForBlockChainConfirmation(TaskRunner taskHandler, OffererAsBuyerModel model) {
|
||||||
super(taskHandler, model);
|
super(taskHandler, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doRun() {
|
protected void doRun() {
|
||||||
transactionConfidence = model.trade.getDepositTx().getConfidence();
|
TransactionConfidence transactionConfidence = model.trade.getDepositTx().getConfidence();
|
||||||
transactionConfidenceListener = new TransactionConfidence.Listener() {
|
ListenableFuture<TransactionConfidence> future = transactionConfidence.getDepthFuture(1);
|
||||||
|
Futures.addCallback(future, new FutureCallback<TransactionConfidence>() {
|
||||||
@Override
|
@Override
|
||||||
public void onConfidenceChanged(Transaction tx, ChangeReason reason) {
|
public void onSuccess(TransactionConfidence result) {
|
||||||
log.trace("onConfidenceChanged " + tx.getConfidence());
|
model.trade.setProcessState(Trade.ProcessState.DEPOSIT_CONFIRMED);
|
||||||
if (reason == ChangeReason.TYPE && tx.getConfidence().getConfidenceType() == TransactionConfidence.ConfidenceType.BUILDING) {
|
|
||||||
model.trade.setProcessState(Trade.ProcessState.DEPOSIT_CONFIRMED);
|
|
||||||
|
|
||||||
// transactionConfidence use CopyOnWriteArrayList as listeners, but be safe and delay remove a bit.
|
|
||||||
Platform.runLater(() -> removeEventListener());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
transactionConfidence.addEventListener(transactionConfidenceListener);
|
@Override
|
||||||
|
public void onFailure(Throwable t) {
|
||||||
|
t.printStackTrace();
|
||||||
|
log.error(t.getMessage());
|
||||||
|
Throwables.propagate(t);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
complete();
|
complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeEventListener() {
|
|
||||||
if (!transactionConfidence.removeEventListener(transactionConfidenceListener))
|
|
||||||
log.error("Remove transactionConfidenceListener failed at SetupListenerForBlockChainConfirmation.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,12 @@ import io.bitsquare.common.taskrunner.TaskRunner;
|
||||||
import io.bitsquare.trade.Trade;
|
import io.bitsquare.trade.Trade;
|
||||||
import io.bitsquare.trade.protocol.trade.taker.models.TakerAsSellerModel;
|
import io.bitsquare.trade.protocol.trade.taker.models.TakerAsSellerModel;
|
||||||
|
|
||||||
import org.bitcoinj.core.Transaction;
|
|
||||||
import org.bitcoinj.core.TransactionConfidence;
|
import org.bitcoinj.core.TransactionConfidence;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import com.google.common.base.Throwables;
|
||||||
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
|
import com.google.common.util.concurrent.Futures;
|
||||||
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -33,40 +35,28 @@ import org.slf4j.LoggerFactory;
|
||||||
public class SetupListenerForBlockChainConfirmation extends Task<TakerAsSellerModel> {
|
public class SetupListenerForBlockChainConfirmation extends Task<TakerAsSellerModel> {
|
||||||
private static final Logger log = LoggerFactory.getLogger(SetupListenerForBlockChainConfirmation.class);
|
private static final Logger log = LoggerFactory.getLogger(SetupListenerForBlockChainConfirmation.class);
|
||||||
|
|
||||||
private TransactionConfidence.Listener transactionConfidenceListener;
|
|
||||||
private TransactionConfidence transactionConfidence;
|
|
||||||
|
|
||||||
public SetupListenerForBlockChainConfirmation(TaskRunner taskHandler, TakerAsSellerModel model) {
|
public SetupListenerForBlockChainConfirmation(TaskRunner taskHandler, TakerAsSellerModel model) {
|
||||||
super(taskHandler, model);
|
super(taskHandler, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doRun() {
|
protected void doRun() {
|
||||||
try {
|
TransactionConfidence transactionConfidence = model.trade.getDepositTx().getConfidence();
|
||||||
transactionConfidence = model.trade.getDepositTx().getConfidence();
|
ListenableFuture<TransactionConfidence> future = transactionConfidence.getDepthFuture(1);
|
||||||
transactionConfidenceListener = new TransactionConfidence.Listener() {
|
Futures.addCallback(future, new FutureCallback<TransactionConfidence>() {
|
||||||
@Override
|
@Override
|
||||||
public void onConfidenceChanged(Transaction tx, ChangeReason reason) {
|
public void onSuccess(TransactionConfidence result) {
|
||||||
log.trace("onConfidenceChanged " + tx.getConfidence());
|
model.trade.setProcessState(Trade.ProcessState.DEPOSIT_CONFIRMED);
|
||||||
if (reason == ChangeReason.TYPE && tx.getConfidence().getConfidenceType() == TransactionConfidence.ConfidenceType.BUILDING) {
|
}
|
||||||
model.trade.setProcessState(Trade.ProcessState.DEPOSIT_CONFIRMED);
|
|
||||||
|
|
||||||
// transactionConfidence use CopyOnWriteArrayList as listeners, but be safe and delay remove a bit.
|
@Override
|
||||||
Platform.runLater(() -> removeEventListener());
|
public void onFailure(Throwable t) {
|
||||||
}
|
t.printStackTrace();
|
||||||
}
|
log.error(t.getMessage());
|
||||||
};
|
Throwables.propagate(t);
|
||||||
transactionConfidence.addEventListener(transactionConfidenceListener);
|
}
|
||||||
|
});
|
||||||
|
|
||||||
complete();
|
complete();
|
||||||
} catch (Throwable t) {
|
|
||||||
t.printStackTrace();
|
|
||||||
log.error(t.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void removeEventListener() {
|
|
||||||
if (!transactionConfidence.removeEventListener(transactionConfidenceListener))
|
|
||||||
log.error("Remove transactionConfidenceListener failed at SetupListenerForBlockChainConfirmation.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
0
doc/update_fork_tomp2p.sh
Executable file → Normal file
0
doc/update_fork_tomp2p.sh
Executable file → Normal file
6
pom.xml
6
pom.xml
|
@ -86,13 +86,17 @@
|
||||||
<id>repository.tomp2p.net</id>
|
<id>repository.tomp2p.net</id>
|
||||||
<url>http://tomp2p.net/dev/mvn</url>
|
<url>http://tomp2p.net/dev/mvn</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>partnerdemo.artifactoryonline.com</id>
|
||||||
|
<url>http://partnerdemo.artifactoryonline.com/partnerdemo/libs-snapshots-local</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bitcoinj</groupId>
|
<groupId>org.bitcoinj</groupId>
|
||||||
<artifactId>bitcoinj-core</artifactId>
|
<artifactId>bitcoinj-core</artifactId>
|
||||||
<version>0.12.2</version>
|
<version>0.13.d13665c-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- <dependency>
|
<!-- <dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue