mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Merge branch 'master_upstream' into fix-bug-with-seed-restore-and-open-offers
This commit is contained in:
commit
00d267e4db
7 changed files with 58 additions and 23 deletions
|
@ -173,4 +173,9 @@ public abstract class PaymentAccount implements PersistablePayload {
|
|||
public String getOwnerId() {
|
||||
return paymentAccountPayload.getOwnerId();
|
||||
}
|
||||
|
||||
public void onAddToUser() {
|
||||
// We are in the process to get added to the user. This is called just before saving the account and the
|
||||
// last moment we could apply some special handling if needed (e.g. as it happens for Revolut)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,22 +37,34 @@ public final class RevolutAccount extends PaymentAccount {
|
|||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
((RevolutAccountPayload) paymentAccountPayload).setUserName(userName);
|
||||
revolutAccountPayload().setUserName(userName);
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return ((RevolutAccountPayload) paymentAccountPayload).getUserName();
|
||||
return (revolutAccountPayload()).getUserName();
|
||||
}
|
||||
|
||||
public String getAccountId() {
|
||||
return ((RevolutAccountPayload) paymentAccountPayload).getAccountId();
|
||||
return (revolutAccountPayload()).getAccountId();
|
||||
}
|
||||
|
||||
public boolean userNameNotSet() {
|
||||
return ((RevolutAccountPayload) paymentAccountPayload).userNameNotSet();
|
||||
return (revolutAccountPayload()).userNameNotSet();
|
||||
}
|
||||
|
||||
public boolean hasOldAccountId() {
|
||||
return ((RevolutAccountPayload) paymentAccountPayload).hasOldAccountId();
|
||||
return (revolutAccountPayload()).hasOldAccountId();
|
||||
}
|
||||
|
||||
private RevolutAccountPayload revolutAccountPayload() {
|
||||
return (RevolutAccountPayload) paymentAccountPayload;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAddToUser() {
|
||||
super.onAddToUser();
|
||||
|
||||
// At save we apply the userName to accountId in case it is empty for backward compatibility
|
||||
revolutAccountPayload().maybeApplyUserNameToAccountId();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public final class RevolutAccountPayload extends PaymentAccountPayload {
|
|||
excludeFromJsonDataMap);
|
||||
|
||||
this.accountId = accountId;
|
||||
setUserName(userName);
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -169,7 +169,11 @@ public final class RevolutAccountPayload extends PaymentAccountPayload {
|
|||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
// We need to set accountId as pre v1.3.8 clients expect the accountId field
|
||||
}
|
||||
|
||||
// In case it is a new account we need to fill the accountId field to support not-updated traders who are not
|
||||
// aware of the new userName field
|
||||
public void maybeApplyUserNameToAccountId() {
|
||||
if (accountId.isEmpty()) {
|
||||
accountId = userName;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,11 @@ public enum AssetTxProofResult {
|
|||
// Any service failed. Might be that the tx is invalid.
|
||||
FAILED;
|
||||
|
||||
// If isTerminal is set it means that we stop the service
|
||||
@Getter
|
||||
private final boolean isTerminal;
|
||||
@Getter
|
||||
private String details = "";
|
||||
@Getter
|
||||
private int numSuccessResults;
|
||||
@Getter
|
||||
|
@ -48,11 +53,7 @@ public enum AssetTxProofResult {
|
|||
private int numConfirmations;
|
||||
@Getter
|
||||
private int numRequiredConfirmations;
|
||||
@Getter
|
||||
private String details = "";
|
||||
// If isTerminal is set it means that we stop the service
|
||||
@Getter
|
||||
private final boolean isTerminal;
|
||||
|
||||
|
||||
AssetTxProofResult() {
|
||||
this(true);
|
||||
|
@ -91,11 +92,12 @@ public enum AssetTxProofResult {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "AssetTxProofResult{" +
|
||||
"\n numSuccessResults=" + numSuccessResults +
|
||||
",\n requiredSuccessResults=" + numRequiredSuccessResults +
|
||||
"\n details='" + details + '\'' +
|
||||
",\n isTerminal=" + isTerminal +
|
||||
",\n numSuccessResults=" + numSuccessResults +
|
||||
",\n numRequiredSuccessResults=" + numRequiredSuccessResults +
|
||||
",\n numConfirmations=" + numConfirmations +
|
||||
",\n numRequiredConfirmations=" + numRequiredConfirmations +
|
||||
",\n details='" + details + '\'' +
|
||||
"\n} " + super.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,6 +147,12 @@ class XmrTxProofRequestsPerTrade implements AssetTxProofRequestsPerTrade {
|
|||
requests.add(request);
|
||||
|
||||
request.requestFromService(result -> {
|
||||
// If we ever received an error or failed result we terminate and do not process any
|
||||
// future result anymore to avoid that we overwrite out state with success.
|
||||
if (wasTerminated()) {
|
||||
return;
|
||||
}
|
||||
|
||||
AssetTxProofResult assetTxProofResult;
|
||||
if (trade.isPayoutPublished()) {
|
||||
assetTxProofResult = AssetTxProofResult.PAYOUT_TX_ALREADY_PUBLISHED;
|
||||
|
@ -205,7 +211,11 @@ class XmrTxProofRequestsPerTrade implements AssetTxProofRequestsPerTrade {
|
|||
}
|
||||
}
|
||||
|
||||
protected void addSettingsListener(Consumer<AssetTxProofResult> resultHandler) {
|
||||
private boolean wasTerminated() {
|
||||
return requests.isEmpty();
|
||||
}
|
||||
|
||||
private void addSettingsListener(Consumer<AssetTxProofResult> resultHandler) {
|
||||
autoConfirmSettingsListener = () -> {
|
||||
if (!autoConfirmSettings.isEnabled()) {
|
||||
callResultHandlerAndMaybeTerminate(resultHandler, AssetTxProofResult.FEATURE_DISABLED);
|
||||
|
@ -214,7 +224,7 @@ class XmrTxProofRequestsPerTrade implements AssetTxProofRequestsPerTrade {
|
|||
autoConfirmSettings.addListener(autoConfirmSettingsListener);
|
||||
}
|
||||
|
||||
protected void setupTradeStateListener(Consumer<AssetTxProofResult> resultHandler) {
|
||||
private void setupTradeStateListener(Consumer<AssetTxProofResult> resultHandler) {
|
||||
tradeStateListener = (observable, oldValue, newValue) -> {
|
||||
if (trade.isPayoutPublished()) {
|
||||
callResultHandlerAndMaybeTerminate(resultHandler, AssetTxProofResult.PAYOUT_TX_ALREADY_PUBLISHED);
|
||||
|
@ -223,8 +233,8 @@ class XmrTxProofRequestsPerTrade implements AssetTxProofRequestsPerTrade {
|
|||
trade.stateProperty().addListener(tradeStateListener);
|
||||
}
|
||||
|
||||
protected void setupArbitrationListener(Consumer<AssetTxProofResult> resultHandler,
|
||||
ObservableList<Dispute> refundDisputes) {
|
||||
private void setupArbitrationListener(Consumer<AssetTxProofResult> resultHandler,
|
||||
ObservableList<Dispute> refundDisputes) {
|
||||
refundListener = c -> {
|
||||
c.next();
|
||||
if (c.wasAdded() && isDisputed(c.getAddedSubList())) {
|
||||
|
@ -234,8 +244,8 @@ class XmrTxProofRequestsPerTrade implements AssetTxProofRequestsPerTrade {
|
|||
refundDisputes.addListener(refundListener);
|
||||
}
|
||||
|
||||
protected void setupMediationListener(Consumer<AssetTxProofResult> resultHandler,
|
||||
ObservableList<Dispute> mediationDisputes) {
|
||||
private void setupMediationListener(Consumer<AssetTxProofResult> resultHandler,
|
||||
ObservableList<Dispute> mediationDisputes) {
|
||||
mediationListener = c -> {
|
||||
c.next();
|
||||
if (c.wasAdded() && isDisputed(c.getAddedSubList())) {
|
||||
|
|
|
@ -190,6 +190,8 @@ public class User implements PersistedDataHost {
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public void addPaymentAccount(PaymentAccount paymentAccount) {
|
||||
paymentAccount.onAddToUser();
|
||||
|
||||
boolean changed = paymentAccountsAsObservable.add(paymentAccount);
|
||||
setCurrentPaymentAccount(paymentAccount);
|
||||
if (changed)
|
||||
|
|
|
@ -596,9 +596,9 @@ portfolio.pending.autoConf.state.PENDING=Success results: {0}/{1}; {2}
|
|||
# suppress inspection "UnusedProperty"
|
||||
portfolio.pending.autoConf.state.COMPLETED=Proof at all services succeeded
|
||||
# suppress inspection "UnusedProperty"
|
||||
portfolio.pending.autoConf.state.ERROR=An error at a service request occurred.
|
||||
portfolio.pending.autoConf.state.ERROR=An error at a service request occurred. No auto-confirm possible.
|
||||
# suppress inspection "UnusedProperty"
|
||||
portfolio.pending.autoConf.state.FAILED=A service returned with a failure.
|
||||
portfolio.pending.autoConf.state.FAILED=A service returned with a failure. No auto-confirm possible.
|
||||
|
||||
portfolio.pending.step1.info=Deposit transaction has been published.\n{0} need to wait for at least one blockchain confirmation before starting the payment.
|
||||
portfolio.pending.step1.warn=The deposit transaction is still not confirmed. This sometimes happens in rare cases when the funding fee of one trader from an external wallet was too low.
|
||||
|
|
Loading…
Add table
Reference in a new issue