mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Refactor trade transactions
This commit is contained in:
parent
6e3f83b8e0
commit
12b130cbd0
@ -812,7 +812,9 @@ public class WalletService {
|
||||
log.trace("inputs: ");
|
||||
log.trace("depositTx=" + depositTx);
|
||||
// If not recreate the tx we get a null pointer at receivePending
|
||||
//depositTx = new Transaction(params, depositTx.bitcoinSerialize());
|
||||
log.debug("tx id "+depositTx.getHashAsString());
|
||||
depositTx = new Transaction(params, depositTx.bitcoinSerialize());
|
||||
log.debug("tx id "+depositTx.getHashAsString());
|
||||
log.trace("depositTx=" + depositTx);
|
||||
// boolean isAlreadyInWallet = wallet.maybeCommitTx(depositTx);
|
||||
//log.trace("isAlreadyInWallet=" + isAlreadyInWallet);
|
||||
|
@ -19,6 +19,7 @@ package io.bitsquare.trade.protocol.trade.offerer;
|
||||
|
||||
import io.bitsquare.network.Message;
|
||||
import io.bitsquare.network.Peer;
|
||||
import io.bitsquare.trade.Trade;
|
||||
import io.bitsquare.trade.handlers.MessageHandler;
|
||||
import io.bitsquare.trade.protocol.trade.TradeMessage;
|
||||
import io.bitsquare.trade.protocol.trade.offerer.tasks.GetOffererDepositTxInputs;
|
||||
@ -41,6 +42,11 @@ import io.bitsquare.trade.protocol.trade.taker.messages.RequestOffererPublishDep
|
||||
import io.bitsquare.trade.protocol.trade.taker.messages.RequestTakeOfferMessage;
|
||||
import io.bitsquare.trade.protocol.trade.taker.messages.TakeOfferFeePayedMessage;
|
||||
|
||||
import org.bitcoinj.core.Transaction;
|
||||
import org.bitcoinj.core.TransactionConfidence;
|
||||
|
||||
import javafx.application.Platform;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -121,7 +127,21 @@ public class BuyerAsOffererProtocol {
|
||||
|
||||
BuyerAsOffererTaskRunner<BuyerAsOffererModel> taskRunner = new BuyerAsOffererTaskRunner<>(model,
|
||||
() -> {
|
||||
log.debug("sequence at handleRequestOffererPublishDepositTxMessage completed");
|
||||
log.debug("taskRunner at handleRequestOffererPublishDepositTxMessage completed");
|
||||
TransactionConfidence confidence = model.getTrade().getDepositTx().getConfidence();
|
||||
confidence.addEventListener(new TransactionConfidence.Listener() {
|
||||
@Override
|
||||
public void onConfidenceChanged(Transaction tx, ChangeReason reason) {
|
||||
log.trace("onConfidenceChanged " + tx.getConfidence());
|
||||
if (reason == ChangeReason.TYPE && tx.getConfidence().getConfidenceType() == TransactionConfidence.ConfidenceType.BUILDING) {
|
||||
|
||||
model.getTrade().setState(Trade.State.DEPOSIT_CONFIRMED);
|
||||
|
||||
//TODO not sure if that works
|
||||
Platform.runLater(() -> confidence.removeEventListener(this));
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
(errorMessage) -> {
|
||||
log.error(errorMessage);
|
||||
|
Loading…
Reference in New Issue
Block a user