Skip to content

Commit e19c44b

Browse files
committed
reset state to deposit txs failed if unseen after published
1 parent 79057e9 commit e19c44b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

core/src/main/java/haveno/core/trade/Trade.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,6 +2302,10 @@ public boolean isInPreparation() {
23022302
return getState().getPhase().ordinal() == Phase.INIT.ordinal();
23032303
}
23042304

2305+
public boolean isFundsLockedIn() {
2306+
return isDepositsPublished() && !isPayoutPublished();
2307+
}
2308+
23052309
public boolean isDepositRequested() {
23062310
return getState().getPhase().ordinal() >= Phase.DEPOSIT_REQUESTED.ordinal();
23072311
}
@@ -2315,8 +2319,8 @@ public boolean isDepositsPublished() {
23152319
return getState().getPhase().ordinal() >= Phase.DEPOSITS_PUBLISHED.ordinal() && getMaker().getDepositTxHash() != null && (getTaker().getDepositTxHash() != null || hasBuyerAsTakerWithoutDeposit());
23162320
}
23172321

2318-
public boolean isFundsLockedIn() {
2319-
return isDepositsPublished() && !isPayoutPublished();
2322+
public boolean isDepositsSeen() {
2323+
return isDepositsPublished() && getState().ordinal() >= State.DEPOSIT_TXS_SEEN_IN_NETWORK.ordinal();
23202324
}
23212325

23222326
public boolean isDepositsConfirmed() {
@@ -2836,6 +2840,9 @@ private void doPollWallet() {
28362840
if (getMaker().getDepositTx().getNumConfirmations() >= NUM_BLOCKS_DEPOSITS_FINALIZED && (hasBuyerAsTakerWithoutDeposit() || getTaker().getDepositTx().getNumConfirmations() >= NUM_BLOCKS_DEPOSITS_FINALIZED)) {
28372841
setStateDepositsFinalized();
28382842
}
2843+
} else if (isDepositsSeen()) {
2844+
log.warn("Resetting state to deposit txs failed for {} {} because one or both deposit txs no longer seen as valid", getClass().getSimpleName(), getShortId());
2845+
setState(Trade.State.PUBLISH_DEPOSIT_TX_REQUEST_FAILED);
28392846
}
28402847
}
28412848

0 commit comments

Comments
 (0)