mirror of
https://github.com/bisq-network/bisq.git
synced 2025-03-04 03:03:48 +01:00
Merge pull request #4736 from jmacxx/add_autoconf_service_filter
Admin filter for auto-confirmation service addresses
This commit is contained in:
commit
9ab65459df
9 changed files with 43 additions and 10 deletions
|
@ -48,6 +48,7 @@ import javax.annotation.Nullable;
|
||||||
public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
||||||
private final List<String> bannedOfferIds;
|
private final List<String> bannedOfferIds;
|
||||||
private final List<String> bannedNodeAddress;
|
private final List<String> bannedNodeAddress;
|
||||||
|
private final List<String> bannedAutoConfExplorers;
|
||||||
private final List<PaymentAccountFilter> bannedPaymentAccounts;
|
private final List<PaymentAccountFilter> bannedPaymentAccounts;
|
||||||
private final List<String> bannedCurrencies;
|
private final List<String> bannedCurrencies;
|
||||||
private final List<String> bannedPaymentMethods;
|
private final List<String> bannedPaymentMethods;
|
||||||
|
@ -115,7 +116,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
||||||
signatureAsBase64,
|
signatureAsBase64,
|
||||||
filter.getSignerPubKeyAsHex(),
|
filter.getSignerPubKeyAsHex(),
|
||||||
filter.getBannedPrivilegedDevPubKeys(),
|
filter.getBannedPrivilegedDevPubKeys(),
|
||||||
filter.isDisableAutoConf());
|
filter.isDisableAutoConf(),
|
||||||
|
filter.getBannedAutoConfExplorers());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used for signature verification as we created the sig without the signatureAsBase64 field we set it to null again
|
// Used for signature verification as we created the sig without the signatureAsBase64 field we set it to null again
|
||||||
|
@ -143,7 +145,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
||||||
null,
|
null,
|
||||||
filter.getSignerPubKeyAsHex(),
|
filter.getSignerPubKeyAsHex(),
|
||||||
filter.getBannedPrivilegedDevPubKeys(),
|
filter.getBannedPrivilegedDevPubKeys(),
|
||||||
filter.isDisableAutoConf());
|
filter.isDisableAutoConf(),
|
||||||
|
filter.getBannedAutoConfExplorers());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Filter(List<String> bannedOfferIds,
|
public Filter(List<String> bannedOfferIds,
|
||||||
|
@ -166,7 +169,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
||||||
PublicKey ownerPubKey,
|
PublicKey ownerPubKey,
|
||||||
String signerPubKeyAsHex,
|
String signerPubKeyAsHex,
|
||||||
List<String> bannedPrivilegedDevPubKeys,
|
List<String> bannedPrivilegedDevPubKeys,
|
||||||
boolean disableAutoConf) {
|
boolean disableAutoConf,
|
||||||
|
List<String> bannedAutoConfExplorers) {
|
||||||
this(bannedOfferIds,
|
this(bannedOfferIds,
|
||||||
bannedNodeAddress,
|
bannedNodeAddress,
|
||||||
bannedPaymentAccounts,
|
bannedPaymentAccounts,
|
||||||
|
@ -190,7 +194,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
||||||
null,
|
null,
|
||||||
signerPubKeyAsHex,
|
signerPubKeyAsHex,
|
||||||
bannedPrivilegedDevPubKeys,
|
bannedPrivilegedDevPubKeys,
|
||||||
disableAutoConf);
|
disableAutoConf,
|
||||||
|
bannedAutoConfExplorers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -222,7 +227,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
||||||
@Nullable String signatureAsBase64,
|
@Nullable String signatureAsBase64,
|
||||||
String signerPubKeyAsHex,
|
String signerPubKeyAsHex,
|
||||||
List<String> bannedPrivilegedDevPubKeys,
|
List<String> bannedPrivilegedDevPubKeys,
|
||||||
boolean disableAutoConf) {
|
boolean disableAutoConf,
|
||||||
|
List<String> bannedAutoConfExplorers) {
|
||||||
this.bannedOfferIds = bannedOfferIds;
|
this.bannedOfferIds = bannedOfferIds;
|
||||||
this.bannedNodeAddress = bannedNodeAddress;
|
this.bannedNodeAddress = bannedNodeAddress;
|
||||||
this.bannedPaymentAccounts = bannedPaymentAccounts;
|
this.bannedPaymentAccounts = bannedPaymentAccounts;
|
||||||
|
@ -247,6 +253,7 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
||||||
this.signerPubKeyAsHex = signerPubKeyAsHex;
|
this.signerPubKeyAsHex = signerPubKeyAsHex;
|
||||||
this.bannedPrivilegedDevPubKeys = bannedPrivilegedDevPubKeys;
|
this.bannedPrivilegedDevPubKeys = bannedPrivilegedDevPubKeys;
|
||||||
this.disableAutoConf = disableAutoConf;
|
this.disableAutoConf = disableAutoConf;
|
||||||
|
this.bannedAutoConfExplorers = bannedAutoConfExplorers;
|
||||||
|
|
||||||
// ownerPubKeyBytes can be null when called from tests
|
// ownerPubKeyBytes can be null when called from tests
|
||||||
if (ownerPubKeyBytes != null) {
|
if (ownerPubKeyBytes != null) {
|
||||||
|
@ -283,7 +290,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
||||||
.setSignerPubKeyAsHex(signerPubKeyAsHex)
|
.setSignerPubKeyAsHex(signerPubKeyAsHex)
|
||||||
.setCreationDate(creationDate)
|
.setCreationDate(creationDate)
|
||||||
.addAllBannedPrivilegedDevPubKeys(bannedPrivilegedDevPubKeys)
|
.addAllBannedPrivilegedDevPubKeys(bannedPrivilegedDevPubKeys)
|
||||||
.setDisableAutoConf(disableAutoConf);
|
.setDisableAutoConf(disableAutoConf)
|
||||||
|
.addAllBannedAutoConfExplorers(bannedAutoConfExplorers);
|
||||||
|
|
||||||
Optional.ofNullable(signatureAsBase64).ifPresent(builder::setSignatureAsBase64);
|
Optional.ofNullable(signatureAsBase64).ifPresent(builder::setSignatureAsBase64);
|
||||||
Optional.ofNullable(extraDataMap).ifPresent(builder::putAllExtraData);
|
Optional.ofNullable(extraDataMap).ifPresent(builder::putAllExtraData);
|
||||||
|
@ -320,7 +328,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
||||||
proto.getSignatureAsBase64(),
|
proto.getSignatureAsBase64(),
|
||||||
proto.getSignerPubKeyAsHex(),
|
proto.getSignerPubKeyAsHex(),
|
||||||
ProtoUtil.protocolStringListToList(proto.getBannedPrivilegedDevPubKeysList()),
|
ProtoUtil.protocolStringListToList(proto.getBannedPrivilegedDevPubKeysList()),
|
||||||
proto.getDisableAutoConf()
|
proto.getDisableAutoConf(),
|
||||||
|
ProtoUtil.protocolStringListToList(proto.getBannedAutoConfExplorersList())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,6 +370,7 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
||||||
",\n creationDate=" + creationDate +
|
",\n creationDate=" + creationDate +
|
||||||
",\n extraDataMap=" + extraDataMap +
|
",\n extraDataMap=" + extraDataMap +
|
||||||
",\n disableAutoConf=" + disableAutoConf +
|
",\n disableAutoConf=" + disableAutoConf +
|
||||||
|
",\n bannedAutoConfExplorers=" + bannedAutoConfExplorers +
|
||||||
"\n}";
|
"\n}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -398,6 +398,12 @@ public class FilterManager {
|
||||||
.anyMatch(e -> e.equals(nodeAddress.getFullAddress()));
|
.anyMatch(e -> e.equals(nodeAddress.getFullAddress()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAutoConfExplorerBanned(String address) {
|
||||||
|
return getFilter() != null &&
|
||||||
|
getFilter().getBannedAutoConfExplorers().stream()
|
||||||
|
.anyMatch(e -> e.equals(address));
|
||||||
|
}
|
||||||
|
|
||||||
public boolean requireUpdateToNewVersionForTrading() {
|
public boolean requireUpdateToNewVersionForTrading() {
|
||||||
if (getFilter() == null) {
|
if (getFilter() == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package bisq.core.trade.txproof.xmr;
|
package bisq.core.trade.txproof.xmr;
|
||||||
|
|
||||||
|
import bisq.core.filter.FilterManager;
|
||||||
import bisq.core.locale.Res;
|
import bisq.core.locale.Res;
|
||||||
import bisq.core.support.dispute.Dispute;
|
import bisq.core.support.dispute.Dispute;
|
||||||
import bisq.core.support.dispute.mediation.MediationManager;
|
import bisq.core.support.dispute.mediation.MediationManager;
|
||||||
|
@ -54,6 +55,7 @@ class XmrTxProofRequestsPerTrade implements AssetTxProofRequestsPerTrade {
|
||||||
private final Trade trade;
|
private final Trade trade;
|
||||||
private final AutoConfirmSettings autoConfirmSettings;
|
private final AutoConfirmSettings autoConfirmSettings;
|
||||||
private final MediationManager mediationManager;
|
private final MediationManager mediationManager;
|
||||||
|
private final FilterManager filterManager;
|
||||||
private final RefundManager refundManager;
|
private final RefundManager refundManager;
|
||||||
private final Socks5ProxyProvider socks5ProxyProvider;
|
private final Socks5ProxyProvider socks5ProxyProvider;
|
||||||
|
|
||||||
|
@ -74,11 +76,13 @@ class XmrTxProofRequestsPerTrade implements AssetTxProofRequestsPerTrade {
|
||||||
Trade trade,
|
Trade trade,
|
||||||
AutoConfirmSettings autoConfirmSettings,
|
AutoConfirmSettings autoConfirmSettings,
|
||||||
MediationManager mediationManager,
|
MediationManager mediationManager,
|
||||||
|
FilterManager filterManager,
|
||||||
RefundManager refundManager) {
|
RefundManager refundManager) {
|
||||||
this.socks5ProxyProvider = socks5ProxyProvider;
|
this.socks5ProxyProvider = socks5ProxyProvider;
|
||||||
this.trade = trade;
|
this.trade = trade;
|
||||||
this.autoConfirmSettings = autoConfirmSettings;
|
this.autoConfirmSettings = autoConfirmSettings;
|
||||||
this.mediationManager = mediationManager;
|
this.mediationManager = mediationManager;
|
||||||
|
this.filterManager = filterManager;
|
||||||
this.refundManager = refundManager;
|
this.refundManager = refundManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,6 +144,10 @@ class XmrTxProofRequestsPerTrade implements AssetTxProofRequestsPerTrade {
|
||||||
numRequiredSuccessResults = serviceAddresses.size();
|
numRequiredSuccessResults = serviceAddresses.size();
|
||||||
|
|
||||||
for (String serviceAddress : serviceAddresses) {
|
for (String serviceAddress : serviceAddresses) {
|
||||||
|
if (filterManager.isAutoConfExplorerBanned(serviceAddress)) {
|
||||||
|
log.warn("Filtered out auto-confirmation address: {}", serviceAddress);
|
||||||
|
continue; // #4683: filter for auto-confirm explorers
|
||||||
|
}
|
||||||
XmrTxProofModel model = new XmrTxProofModel(trade, serviceAddress, autoConfirmSettings);
|
XmrTxProofModel model = new XmrTxProofModel(trade, serviceAddress, autoConfirmSettings);
|
||||||
XmrTxProofRequest request = new XmrTxProofRequest(socks5ProxyProvider, model);
|
XmrTxProofRequest request = new XmrTxProofRequest(socks5ProxyProvider, model);
|
||||||
|
|
||||||
|
|
|
@ -257,6 +257,7 @@ public class XmrTxProofService implements AssetTxProofService {
|
||||||
trade,
|
trade,
|
||||||
autoConfirmSettings,
|
autoConfirmSettings,
|
||||||
mediationManager,
|
mediationManager,
|
||||||
|
filterManager,
|
||||||
refundManager);
|
refundManager);
|
||||||
servicesByTradeId.put(trade.getId(), service);
|
servicesByTradeId.put(trade.getId(), service);
|
||||||
service.requestFromAllServices(
|
service.requestFromAllServices(
|
||||||
|
|
|
@ -2595,6 +2595,7 @@ filterWindow.btcNode=Filtered Bitcoin nodes (comma sep. addresses + port)
|
||||||
filterWindow.preventPublicBtcNetwork=Prevent usage of public Bitcoin network
|
filterWindow.preventPublicBtcNetwork=Prevent usage of public Bitcoin network
|
||||||
filterWindow.disableDao=Disable DAO
|
filterWindow.disableDao=Disable DAO
|
||||||
filterWindow.disableAutoConf=Disable auto-confirm
|
filterWindow.disableAutoConf=Disable auto-confirm
|
||||||
|
filterWindow.autoConfExplorers=Filtered auto-confirm explorers (comma sep. addresses)
|
||||||
filterWindow.disableDaoBelowVersion=Min. version required for DAO
|
filterWindow.disableDaoBelowVersion=Min. version required for DAO
|
||||||
filterWindow.disableTradeBelowVersion=Min. version required for trading
|
filterWindow.disableTradeBelowVersion=Min. version required for trading
|
||||||
filterWindow.add=Add filter
|
filterWindow.add=Add filter
|
||||||
|
|
|
@ -63,7 +63,8 @@ public class UserPayloadModelVOTest {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
false));
|
false,
|
||||||
|
Lists.newArrayList()));
|
||||||
|
|
||||||
vo.setRegisteredArbitrator(ArbitratorTest.getArbitratorMock());
|
vo.setRegisteredArbitrator(ArbitratorTest.getArbitratorMock());
|
||||||
vo.setRegisteredMediator(MediatorTest.getMediatorMock());
|
vo.setRegisteredMediator(MediatorTest.getMediatorMock());
|
||||||
|
|
|
@ -122,6 +122,7 @@ public class FeeReceiverSelectorTest {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
false);
|
false,
|
||||||
|
Lists.newArrayList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,8 @@ public class FilterWindow extends Overlay<FilterWindow> {
|
||||||
Res.get("filterWindow.disableTradeBelowVersion"));
|
Res.get("filterWindow.disableTradeBelowVersion"));
|
||||||
InputTextField bannedPrivilegedDevPubKeysTF = addTopLabelInputTextField(gridPane, ++rowIndex,
|
InputTextField bannedPrivilegedDevPubKeysTF = addTopLabelInputTextField(gridPane, ++rowIndex,
|
||||||
Res.get("filterWindow.bannedPrivilegedDevPubKeys")).second;
|
Res.get("filterWindow.bannedPrivilegedDevPubKeys")).second;
|
||||||
|
InputTextField autoConfExplorersTF = addTopLabelInputTextField(gridPane, ++rowIndex,
|
||||||
|
Res.get("filterWindow.autoConfExplorers")).second;
|
||||||
|
|
||||||
Filter filter = filterManager.getDevFilter();
|
Filter filter = filterManager.getDevFilter();
|
||||||
if (filter != null) {
|
if (filter != null) {
|
||||||
|
@ -178,6 +180,7 @@ public class FilterWindow extends Overlay<FilterWindow> {
|
||||||
setupFieldFromList(priceRelayNodesTF, filter.getPriceRelayNodes());
|
setupFieldFromList(priceRelayNodesTF, filter.getPriceRelayNodes());
|
||||||
setupFieldFromList(btcNodesTF, filter.getBtcNodes());
|
setupFieldFromList(btcNodesTF, filter.getBtcNodes());
|
||||||
setupFieldFromList(bannedPrivilegedDevPubKeysTF, filter.getBannedPrivilegedDevPubKeys());
|
setupFieldFromList(bannedPrivilegedDevPubKeysTF, filter.getBannedPrivilegedDevPubKeys());
|
||||||
|
setupFieldFromList(autoConfExplorersTF, filter.getBannedAutoConfExplorers());
|
||||||
|
|
||||||
preventPublicBtcNetworkCheckBox.setSelected(filter.isPreventPublicBtcNetwork());
|
preventPublicBtcNetworkCheckBox.setSelected(filter.isPreventPublicBtcNetwork());
|
||||||
disableDaoCheckBox.setSelected(filter.isDisableDao());
|
disableDaoCheckBox.setSelected(filter.isDisableDao());
|
||||||
|
@ -215,7 +218,8 @@ public class FilterWindow extends Overlay<FilterWindow> {
|
||||||
filterManager.getOwnerPubKey(),
|
filterManager.getOwnerPubKey(),
|
||||||
signerPubKeyAsHex,
|
signerPubKeyAsHex,
|
||||||
readAsList(bannedPrivilegedDevPubKeysTF),
|
readAsList(bannedPrivilegedDevPubKeysTF),
|
||||||
disableAutoConfCheckBox.isSelected()
|
disableAutoConfCheckBox.isSelected(),
|
||||||
|
readAsList(autoConfExplorersTF)
|
||||||
);
|
);
|
||||||
|
|
||||||
// We remove first the old filter
|
// We remove first the old filter
|
||||||
|
|
|
@ -660,6 +660,7 @@ message Filter {
|
||||||
string signer_pub_key_as_hex = 22;
|
string signer_pub_key_as_hex = 22;
|
||||||
repeated string bannedPrivilegedDevPubKeys = 23;
|
repeated string bannedPrivilegedDevPubKeys = 23;
|
||||||
bool disable_auto_conf = 24;
|
bool disable_auto_conf = 24;
|
||||||
|
repeated string banned_auto_conf_explorers = 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated
|
// Deprecated
|
||||||
|
|
Loading…
Add table
Reference in a new issue