mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-12-16 16:24:29 -05:00
recreate unsigned payout tx on payment received nack even if published
This commit is contained in:
parent
c1e8c4fd33
commit
e7d39f9bdf
1 changed files with 30 additions and 33 deletions
|
|
@ -40,51 +40,48 @@ public class SellerPreparePaymentReceivedMessage extends TradeTask {
|
||||||
// check connection
|
// check connection
|
||||||
trade.verifyDaemonConnection();
|
trade.verifyDaemonConnection();
|
||||||
|
|
||||||
if (!trade.isPayoutPublished()) {
|
// prepare payout info for payment received message
|
||||||
|
if (!trade.isPayoutPublished() || (!trade.isPayoutFinalized() && trade.getPayoutTxHex() == null)) {
|
||||||
|
|
||||||
// process or create payout tx
|
// synchronize on lock for wallet operations
|
||||||
if (trade.getPayoutTxHex() == null) {
|
synchronized (trade.getWalletLock()) {
|
||||||
|
synchronized (HavenoUtils.getWalletFunctionLock()) {
|
||||||
|
|
||||||
// synchronize on lock for wallet operations
|
// import multisig hex unless already signed
|
||||||
synchronized (trade.getWalletLock()) {
|
if (trade.getPayoutTxHex() == null) {
|
||||||
synchronized (HavenoUtils.getWalletFunctionLock()) {
|
trade.importMultisigHex();
|
||||||
|
}
|
||||||
|
|
||||||
// import multisig hex unless already signed
|
// verify, sign, and publish payout tx if given
|
||||||
if (trade.getPayoutTxHex() == null) {
|
if (trade.getBuyer().getPaymentSentMessage().getPayoutTxHex() != null && !trade.getProcessModel().isPaymentSentPayoutTxStale()) {
|
||||||
trade.importMultisigHex();
|
try {
|
||||||
}
|
if (trade.getPayoutTxHex() == null) {
|
||||||
|
log.info("Seller verifying, signing, and publishing payout tx for trade {}", trade.getId());
|
||||||
// verify, sign, and publish payout tx if given
|
trade.processPayoutTx(trade.getBuyer().getPaymentSentMessage().getPayoutTxHex(), true, true);
|
||||||
if (trade.getBuyer().getPaymentSentMessage().getPayoutTxHex() != null && !trade.getProcessModel().isPaymentSentPayoutTxStale()) {
|
} else {
|
||||||
try {
|
log.warn("Seller publishing previously signed payout tx for trade {}", trade.getId());
|
||||||
if (trade.getPayoutTxHex() == null) {
|
trade.processPayoutTx(trade.getPayoutTxHex(), false, true);
|
||||||
log.info("Seller verifying, signing, and publishing payout tx for trade {}", trade.getId());
|
|
||||||
trade.processPayoutTx(trade.getBuyer().getPaymentSentMessage().getPayoutTxHex(), true, true);
|
|
||||||
} else {
|
|
||||||
log.warn("Seller publishing previously signed payout tx for trade {}", trade.getId());
|
|
||||||
trade.processPayoutTx(trade.getPayoutTxHex(), false, true);
|
|
||||||
}
|
|
||||||
} catch (IllegalArgumentException | IllegalStateException e) {
|
|
||||||
log.warn("Illegal state or argument verifying, signing, and publishing payout tx for {} {}. Creating new unsigned payout tx. error={}. ", trade.getClass().getSimpleName(), trade.getId(), e.getMessage(), e);
|
|
||||||
createUnsignedPayoutTx();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.warn("Error verifying, signing, and publishing payout tx for trade {}: {}", trade.getId(), e.getMessage(), e);
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
}
|
} catch (IllegalArgumentException | IllegalStateException e) {
|
||||||
|
log.warn("Illegal state or argument verifying, signing, and publishing payout tx for {} {}. Creating new unsigned payout tx. error={}. ", trade.getClass().getSimpleName(), trade.getId(), e.getMessage(), e);
|
||||||
// otherwise create unsigned payout tx
|
|
||||||
else if (trade.getSelf().getUnsignedPayoutTxHex() == null) {
|
|
||||||
createUnsignedPayoutTx();
|
createUnsignedPayoutTx();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("Error verifying, signing, and publishing payout tx for trade {}: {}", trade.getId(), e.getMessage(), e);
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// otherwise create unsigned payout tx
|
||||||
|
else if (trade.getSelf().getUnsignedPayoutTxHex() == null) {
|
||||||
|
createUnsignedPayoutTx();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
} else if (!trade.isPayoutPublished() && trade.getPayoutTxHex() != null) {
|
||||||
|
|
||||||
// republish payout tx from previous message
|
// republish payout tx from previous message
|
||||||
log.info("Seller re-verifying and publishing signed payout tx for trade {}", trade.getId());
|
log.info("Seller re-verifying and publishing signed payout tx for trade {}", trade.getId());
|
||||||
trade.processPayoutTx(trade.getPayoutTxHex(), false, true);
|
trade.processPayoutTx(trade.getPayoutTxHex(), false, true);
|
||||||
}
|
|
||||||
} else if (!trade.isPayoutFinalized() && (trade.getArbitrator().getPaymentReceivedMessage() == null || trade.getBuyer().getPaymentReceivedMessage() == null)) {
|
} else if (!trade.isPayoutFinalized() && (trade.getArbitrator().getPaymentReceivedMessage() == null || trade.getBuyer().getPaymentReceivedMessage() == null)) {
|
||||||
|
|
||||||
// update multisig info if payout not finalized and recreating messages
|
// update multisig info if payout not finalized and recreating messages
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue