mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-17 19:54:35 -05:00
set payout tx hash on payment received unless unlocked
This commit is contained in:
parent
d3949614c6
commit
4c7075b0bd
@ -816,7 +816,7 @@ public abstract class Trade implements Tradable, Model {
|
||||
// submit payout tx
|
||||
if (publish) {
|
||||
multisigWallet.submitMultisigTxHex(payoutTxHex);
|
||||
setPayoutState(Trade.PayoutState.PAYOUT_PUBLISHED);
|
||||
pollWallet();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1447,7 +1447,7 @@ public abstract class Trade implements Tradable, Model {
|
||||
}
|
||||
}
|
||||
|
||||
// check for outgoing txs (appears on payout confirmed)
|
||||
// check for outgoing txs (appears after wallet submits payout tx or on payout confirmed)
|
||||
List<MoneroTxWallet> outgoingTxs = getWallet().getTxs(new MoneroTxQuery().setIsOutgoing(true));
|
||||
if (!outgoingTxs.isEmpty()) {
|
||||
MoneroTxWallet payoutTx = outgoingTxs.get(0);
|
||||
|
@ -59,6 +59,32 @@ public class ProcessPaymentReceivedMessage extends TradeTask {
|
||||
trade.getSeller().setNodeAddress(processModel.getTempTradingPeerNodeAddress());
|
||||
if (trade.getSeller().getNodeAddress().equals(trade.getBuyer().getNodeAddress())) trade.getBuyer().setNodeAddress(null); // tests can reuse addresses
|
||||
|
||||
// process payout tx unless already unlocked
|
||||
if (!trade.isPayoutUnlocked()) {
|
||||
processPayoutTx(message);
|
||||
complete();
|
||||
return;
|
||||
}
|
||||
|
||||
SignedWitness signedWitness = message.getSignedWitness();
|
||||
if (signedWitness != null) {
|
||||
// We received the signedWitness from the seller and publish the data to the network.
|
||||
// The signer has published it as well but we prefer to re-do it on our side as well to achieve higher
|
||||
// resilience.
|
||||
processModel.getAccountAgeWitnessService().publishOwnSignedWitness(signedWitness);
|
||||
}
|
||||
|
||||
// complete
|
||||
trade.setStateIfProgress(Trade.State.SELLER_SENT_PAYMENT_RECEIVED_MSG); // arbitrator auto completes when payout published
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
complete();
|
||||
} catch (Throwable t) {
|
||||
failed(t);
|
||||
}
|
||||
}
|
||||
|
||||
private void processPayoutTx(PaymentReceivedMessage message) {
|
||||
|
||||
// import multisig hex
|
||||
List<String> updatedMultisigHexes = new ArrayList<String>();
|
||||
if (trade.getSeller().getUpdatedMultisigHex() != null) updatedMultisigHexes.add(trade.getSeller().getUpdatedMultisigHex());
|
||||
@ -97,22 +123,7 @@ public class ProcessPaymentReceivedMessage extends TradeTask {
|
||||
}
|
||||
} else {
|
||||
log.info("Payout tx already published for {} {}", trade.getClass().getSimpleName(), trade.getId());
|
||||
}
|
||||
|
||||
SignedWitness signedWitness = message.getSignedWitness();
|
||||
if (signedWitness != null) {
|
||||
// We received the signedWitness from the seller and publish the data to the network.
|
||||
// The signer has published it as well but we prefer to re-do it on our side as well to achieve higher
|
||||
// resilience.
|
||||
processModel.getAccountAgeWitnessService().publishOwnSignedWitness(signedWitness);
|
||||
}
|
||||
|
||||
// complete
|
||||
trade.setStateIfProgress(Trade.State.SELLER_SENT_PAYMENT_RECEIVED_MSG); // arbitrator auto completes when payout published
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
complete();
|
||||
} catch (Throwable t) {
|
||||
failed(t);
|
||||
if (message.getSignedPayoutTxHex() != null && !trade.isPayoutConfirmed()) trade.verifyPayoutTx(message.getSignedPayoutTxHex(), false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user