Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BSQ trade fee validation NACK if tx unconfirmed for a long time #6615

Merged
merged 1 commit into from Mar 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions core/src/main/java/bisq/core/provider/mempool/TxValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public class TxValidator {
private Coin amount;
@Nullable
private Boolean isFeeCurrencyBtc;
@Nullable
private Long chainHeight;
@Setter
private String jsonTxt;
Expand All @@ -79,6 +78,7 @@ public TxValidator(DaoStateService daoStateService,
this.amount = amount;
this.isFeeCurrencyBtc = isFeeCurrencyBtc;
this.feePaymentBlockHeight = feePaymentBlockHeight;
this.chainHeight = (long) daoStateService.getChainHeight();
this.filterManager = filterManager;
this.errorList = new ArrayList<>();
this.jsonTxt = "";
Expand Down Expand Up @@ -119,10 +119,19 @@ public TxValidator parseJsonValidateMakerFeeTx(String jsonTxt, List<String> btcF

public TxValidator validateBsqFeeTx(boolean isMaker) {
Optional<Tx> tx = daoStateService.getTx(txId);
String statusStr = isMaker ? "Maker" : "Taker" + " tx validation";
String statusStr = (isMaker ? "Maker" : "Taker") + " tx validation";
if (tx.isEmpty()) {
log.info("DAO does not yet have the tx {}, bypassing check of burnt BSQ amount.", txId);
return endResult(statusStr, true);
long txAge = this.chainHeight - this.feePaymentBlockHeight;
if (txAge > 48) {
// still unconfirmed after 8 hours grace period we assume there may be SPV wallet issue.
// see github.com/bisq-network/bisq/issues/6603
statusStr = String.format("BSQ tx %s not found, age=%d: FAIL.", txId, txAge);
log.warn(statusStr);
return endResult(statusStr, false);
} else {
log.info("DAO does not yet have the tx {} (age={}), bypassing check of burnt BSQ amount.", txId, txAge);
return endResult(statusStr, true);
}
} else {
return endResult(statusStr, checkFeeAmountBSQ(tx.get(), amount, isMaker, feePaymentBlockHeight));
}
Expand Down