mirror of
https://github.com/bisq-network/bisq.git
synced 2025-03-03 10:46:54 +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 {
|
||||
private final List<String> bannedOfferIds;
|
||||
private final List<String> bannedNodeAddress;
|
||||
private final List<String> bannedAutoConfExplorers;
|
||||
private final List<PaymentAccountFilter> bannedPaymentAccounts;
|
||||
private final List<String> bannedCurrencies;
|
||||
private final List<String> bannedPaymentMethods;
|
||||
|
@ -115,7 +116,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
|||
signatureAsBase64,
|
||||
filter.getSignerPubKeyAsHex(),
|
||||
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
|
||||
|
@ -143,7 +145,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
|||
null,
|
||||
filter.getSignerPubKeyAsHex(),
|
||||
filter.getBannedPrivilegedDevPubKeys(),
|
||||
filter.isDisableAutoConf());
|
||||
filter.isDisableAutoConf(),
|
||||
filter.getBannedAutoConfExplorers());
|
||||
}
|
||||
|
||||
public Filter(List<String> bannedOfferIds,
|
||||
|
@ -166,7 +169,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
|||
PublicKey ownerPubKey,
|
||||
String signerPubKeyAsHex,
|
||||
List<String> bannedPrivilegedDevPubKeys,
|
||||
boolean disableAutoConf) {
|
||||
boolean disableAutoConf,
|
||||
List<String> bannedAutoConfExplorers) {
|
||||
this(bannedOfferIds,
|
||||
bannedNodeAddress,
|
||||
bannedPaymentAccounts,
|
||||
|
@ -190,7 +194,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
|||
null,
|
||||
signerPubKeyAsHex,
|
||||
bannedPrivilegedDevPubKeys,
|
||||
disableAutoConf);
|
||||
disableAutoConf,
|
||||
bannedAutoConfExplorers);
|
||||
}
|
||||
|
||||
|
||||
|
@ -222,7 +227,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
|||
@Nullable String signatureAsBase64,
|
||||
String signerPubKeyAsHex,
|
||||
List<String> bannedPrivilegedDevPubKeys,
|
||||
boolean disableAutoConf) {
|
||||
boolean disableAutoConf,
|
||||
List<String> bannedAutoConfExplorers) {
|
||||
this.bannedOfferIds = bannedOfferIds;
|
||||
this.bannedNodeAddress = bannedNodeAddress;
|
||||
this.bannedPaymentAccounts = bannedPaymentAccounts;
|
||||
|
@ -247,6 +253,7 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
|||
this.signerPubKeyAsHex = signerPubKeyAsHex;
|
||||
this.bannedPrivilegedDevPubKeys = bannedPrivilegedDevPubKeys;
|
||||
this.disableAutoConf = disableAutoConf;
|
||||
this.bannedAutoConfExplorers = bannedAutoConfExplorers;
|
||||
|
||||
// ownerPubKeyBytes can be null when called from tests
|
||||
if (ownerPubKeyBytes != null) {
|
||||
|
@ -283,7 +290,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
|||
.setSignerPubKeyAsHex(signerPubKeyAsHex)
|
||||
.setCreationDate(creationDate)
|
||||
.addAllBannedPrivilegedDevPubKeys(bannedPrivilegedDevPubKeys)
|
||||
.setDisableAutoConf(disableAutoConf);
|
||||
.setDisableAutoConf(disableAutoConf)
|
||||
.addAllBannedAutoConfExplorers(bannedAutoConfExplorers);
|
||||
|
||||
Optional.ofNullable(signatureAsBase64).ifPresent(builder::setSignatureAsBase64);
|
||||
Optional.ofNullable(extraDataMap).ifPresent(builder::putAllExtraData);
|
||||
|
@ -320,7 +328,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
|
|||
proto.getSignatureAsBase64(),
|
||||
proto.getSignerPubKeyAsHex(),
|
||||
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 extraDataMap=" + extraDataMap +
|
||||
",\n disableAutoConf=" + disableAutoConf +
|
||||
",\n bannedAutoConfExplorers=" + bannedAutoConfExplorers +
|
||||
"\n}";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -398,6 +398,12 @@ public class FilterManager {
|
|||
.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() {
|
||||
if (getFilter() == null) {
|
||||
return false;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package bisq.core.trade.txproof.xmr;
|
||||
|
||||
import bisq.core.filter.FilterManager;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.support.dispute.Dispute;
|
||||
import bisq.core.support.dispute.mediation.MediationManager;
|
||||
|
@ -54,6 +55,7 @@ class XmrTxProofRequestsPerTrade implements AssetTxProofRequestsPerTrade {
|
|||
private final Trade trade;
|
||||
private final AutoConfirmSettings autoConfirmSettings;
|
||||
private final MediationManager mediationManager;
|
||||
private final FilterManager filterManager;
|
||||
private final RefundManager refundManager;
|
||||
private final Socks5ProxyProvider socks5ProxyProvider;
|
||||
|
||||
|
@ -74,11 +76,13 @@ class XmrTxProofRequestsPerTrade implements AssetTxProofRequestsPerTrade {
|
|||
Trade trade,
|
||||
AutoConfirmSettings autoConfirmSettings,
|
||||
MediationManager mediationManager,
|
||||
FilterManager filterManager,
|
||||
RefundManager refundManager) {
|
||||
this.socks5ProxyProvider = socks5ProxyProvider;
|
||||
this.trade = trade;
|
||||
this.autoConfirmSettings = autoConfirmSettings;
|
||||
this.mediationManager = mediationManager;
|
||||
this.filterManager = filterManager;
|
||||
this.refundManager = refundManager;
|
||||
}
|
||||
|
||||
|
@ -140,6 +144,10 @@ class XmrTxProofRequestsPerTrade implements AssetTxProofRequestsPerTrade {
|
|||
numRequiredSuccessResults = serviceAddresses.size();
|
||||
|
||||
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);
|
||||
XmrTxProofRequest request = new XmrTxProofRequest(socks5ProxyProvider, model);
|
||||
|
||||
|
|
|
@ -257,6 +257,7 @@ public class XmrTxProofService implements AssetTxProofService {
|
|||
trade,
|
||||
autoConfirmSettings,
|
||||
mediationManager,
|
||||
filterManager,
|
||||
refundManager);
|
||||
servicesByTradeId.put(trade.getId(), service);
|
||||
service.requestFromAllServices(
|
||||
|
|
|
@ -2595,6 +2595,7 @@ filterWindow.btcNode=Filtered Bitcoin nodes (comma sep. addresses + port)
|
|||
filterWindow.preventPublicBtcNetwork=Prevent usage of public Bitcoin network
|
||||
filterWindow.disableDao=Disable DAO
|
||||
filterWindow.disableAutoConf=Disable auto-confirm
|
||||
filterWindow.autoConfExplorers=Filtered auto-confirm explorers (comma sep. addresses)
|
||||
filterWindow.disableDaoBelowVersion=Min. version required for DAO
|
||||
filterWindow.disableTradeBelowVersion=Min. version required for trading
|
||||
filterWindow.add=Add filter
|
||||
|
|
|
@ -63,7 +63,8 @@ public class UserPayloadModelVOTest {
|
|||
null,
|
||||
null,
|
||||
null,
|
||||
false));
|
||||
false,
|
||||
Lists.newArrayList()));
|
||||
|
||||
vo.setRegisteredArbitrator(ArbitratorTest.getArbitratorMock());
|
||||
vo.setRegisteredMediator(MediatorTest.getMediatorMock());
|
||||
|
|
|
@ -122,6 +122,7 @@ public class FeeReceiverSelectorTest {
|
|||
null,
|
||||
null,
|
||||
null,
|
||||
false);
|
||||
false,
|
||||
Lists.newArrayList());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,6 +161,8 @@ public class FilterWindow extends Overlay<FilterWindow> {
|
|||
Res.get("filterWindow.disableTradeBelowVersion"));
|
||||
InputTextField bannedPrivilegedDevPubKeysTF = addTopLabelInputTextField(gridPane, ++rowIndex,
|
||||
Res.get("filterWindow.bannedPrivilegedDevPubKeys")).second;
|
||||
InputTextField autoConfExplorersTF = addTopLabelInputTextField(gridPane, ++rowIndex,
|
||||
Res.get("filterWindow.autoConfExplorers")).second;
|
||||
|
||||
Filter filter = filterManager.getDevFilter();
|
||||
if (filter != null) {
|
||||
|
@ -178,6 +180,7 @@ public class FilterWindow extends Overlay<FilterWindow> {
|
|||
setupFieldFromList(priceRelayNodesTF, filter.getPriceRelayNodes());
|
||||
setupFieldFromList(btcNodesTF, filter.getBtcNodes());
|
||||
setupFieldFromList(bannedPrivilegedDevPubKeysTF, filter.getBannedPrivilegedDevPubKeys());
|
||||
setupFieldFromList(autoConfExplorersTF, filter.getBannedAutoConfExplorers());
|
||||
|
||||
preventPublicBtcNetworkCheckBox.setSelected(filter.isPreventPublicBtcNetwork());
|
||||
disableDaoCheckBox.setSelected(filter.isDisableDao());
|
||||
|
@ -215,7 +218,8 @@ public class FilterWindow extends Overlay<FilterWindow> {
|
|||
filterManager.getOwnerPubKey(),
|
||||
signerPubKeyAsHex,
|
||||
readAsList(bannedPrivilegedDevPubKeysTF),
|
||||
disableAutoConfCheckBox.isSelected()
|
||||
disableAutoConfCheckBox.isSelected(),
|
||||
readAsList(autoConfExplorersTF)
|
||||
);
|
||||
|
||||
// We remove first the old filter
|
||||
|
|
|
@ -660,6 +660,7 @@ message Filter {
|
|||
string signer_pub_key_as_hex = 22;
|
||||
repeated string bannedPrivilegedDevPubKeys = 23;
|
||||
bool disable_auto_conf = 24;
|
||||
repeated string banned_auto_conf_explorers = 25;
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
|
|
Loading…
Add table
Reference in a new issue