Add addedBtcNodes and addedSeedNodes fields to Filter.

Signed-off-by: HenrikJannsen <boilingfrog@gmx.com>
This commit is contained in:
HenrikJannsen 2024-06-07 18:11:23 +07:00
parent 5d8e36215f
commit 01355fdc54
No known key found for this signature in database
GPG Key ID: 02AA2BAE387C8307
5 changed files with 51 additions and 11 deletions

View File

@ -123,6 +123,10 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
// Added at v1.9.13
private final List<PaymentAccountFilter> delayedPayoutPaymentAccounts;
// Added at v 1.9.16
private final List<String> addedBtcNodes;
private final List<String> addedSeedNodes;
// After we have created the signature from the filter data we clone it and apply the signature
static Filter cloneWithSig(Filter filter, String signatureAsBase64) {
return new Filter(filter.getBannedOfferIds(),
@ -160,7 +164,9 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
filter.getTakerFeeBtc(),
filter.getMakerFeeBsq(),
filter.getTakerFeeBsq(),
filter.getDelayedPayoutPaymentAccounts());
filter.getDelayedPayoutPaymentAccounts(),
filter.getAddedBtcNodes(),
filter.getAddedSeedNodes());
}
// Used for signature verification as we created the sig without the signatureAsBase64 field we set it to null again
@ -200,7 +206,9 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
filter.getTakerFeeBtc(),
filter.getMakerFeeBsq(),
filter.getTakerFeeBsq(),
filter.getDelayedPayoutPaymentAccounts());
filter.getDelayedPayoutPaymentAccounts(),
filter.getAddedBtcNodes(),
filter.getAddedSeedNodes());
}
public Filter(List<String> bannedOfferIds,
@ -235,7 +243,9 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
long takerFeeBtc,
long makerFeeBsq,
long takerFeeBsq,
List<PaymentAccountFilter> delayedPayoutPaymentAccounts) {
List<PaymentAccountFilter> delayedPayoutPaymentAccounts,
List<String> addedBtcNodes,
List<String> addedSeedNodes) {
this(bannedOfferIds,
nodeAddressesBannedFromTrading,
bannedPaymentAccounts,
@ -271,7 +281,9 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
takerFeeBtc,
makerFeeBsq,
takerFeeBsq,
delayedPayoutPaymentAccounts);
delayedPayoutPaymentAccounts,
addedBtcNodes,
addedSeedNodes);
}
@ -315,7 +327,9 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
long takerFeeBtc,
long makerFeeBsq,
long takerFeeBsq,
List<PaymentAccountFilter> delayedPayoutPaymentAccounts) {
List<PaymentAccountFilter> delayedPayoutPaymentAccounts,
List<String> addedBtcNodes,
List<String> addedSeedNodes) {
this.bannedOfferIds = bannedOfferIds;
this.nodeAddressesBannedFromTrading = nodeAddressesBannedFromTrading;
this.bannedPaymentAccounts = bannedPaymentAccounts;
@ -352,6 +366,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
this.makerFeeBsq = makerFeeBsq;
this.takerFeeBsq = takerFeeBsq;
this.delayedPayoutPaymentAccounts = delayedPayoutPaymentAccounts;
this.addedBtcNodes = addedBtcNodes;
this.addedSeedNodes = addedSeedNodes;
// ownerPubKeyBytes can be null when called from tests
if (ownerPubKeyBytes != null) {
@ -403,7 +419,9 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
.setTakerFeeBtc(takerFeeBtc)
.setMakerFeeBsq(makerFeeBsq)
.setTakerFeeBsq(takerFeeBsq)
.addAllDelayedPayoutPaymentAccounts(delayedPayoutPaymentAccountList);
.addAllDelayedPayoutPaymentAccounts(delayedPayoutPaymentAccountList)
.addAllAddedBtcNodes(addedBtcNodes)
.addAllAddedSeedNodes(addedSeedNodes);
Optional.ofNullable(signatureAsBase64).ifPresent(builder::setSignatureAsBase64);
Optional.ofNullable(extraDataMap).ifPresent(builder::putAllExtraData);
@ -454,7 +472,9 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
proto.getTakerFeeBtc(),
proto.getMakerFeeBsq(),
proto.getTakerFeeBsq(),
delayedPayoutPaymentAccounts
delayedPayoutPaymentAccounts,
ProtoUtil.protocolStringListToList(proto.getAddedBtcNodesList()),
ProtoUtil.protocolStringListToList(proto.getAddedSeedNodesList())
);
}
@ -512,6 +532,8 @@ public final class Filter implements ProtectedStoragePayload, ExpirablePayload {
",\n takerFeeBtc=" + takerFeeBtc +
",\n makerFeeBsq=" + makerFeeBsq +
",\n takerFeeBsq=" + takerFeeBsq +
",\n addedBtcNodes=" + addedBtcNodes +
",\n addedSeedNodes=" + addedSeedNodes +
"\n}";
}
}

View File

@ -85,6 +85,8 @@ public class FilterManager {
private static final String BANNED_PRICE_RELAY_NODES = "bannedPriceRelayNodes";
private static final String BANNED_SEED_NODES = "bannedSeedNodes";
private static final String BANNED_BTC_NODES = "bannedBtcNodes";
private static final String FILTER_PROVIDED_SEED_NODES = "filterProvidedSeedNodes";
private static final String FILTER_PROVIDED_BTC_NODES = "filterProvidedBtcNodes";
///////////////////////////////////////////////////////////////////////////////////////////
// Listener
@ -570,6 +572,8 @@ public class FilterManager {
// We persist it to the property file which is read before any other initialisation.
saveBannedNodes(BANNED_SEED_NODES, newFilter.getSeedNodes());
saveBannedNodes(BANNED_BTC_NODES, newFilter.getBtcNodes());
saveBannedNodes(FILTER_PROVIDED_BTC_NODES, newFilter.getAddedBtcNodes());
saveBannedNodes(FILTER_PROVIDED_SEED_NODES, newFilter.getAddedSeedNodes());
// Banned price relay nodes we can apply at runtime
List<String> priceRelayNodes = newFilter.getPriceRelayNodes();
@ -614,7 +618,9 @@ public class FilterManager {
// Clears options files from banned nodes
private void clearBannedNodes() {
saveBannedNodes(BANNED_BTC_NODES, null);
saveBannedNodes(FILTER_PROVIDED_BTC_NODES, null);
saveBannedNodes(BANNED_SEED_NODES, null);
saveBannedNodes(FILTER_PROVIDED_SEED_NODES, null);
saveBannedNodes(BANNED_PRICE_RELAY_NODES, null);
if (providersRepository.getBannedNodes() != null) {

View File

@ -3057,8 +3057,10 @@ filterWindow.arbitrators=Filtered arbitrators (comma sep. onion addresses)
filterWindow.mediators=Filtered mediators (comma sep. onion addresses)
filterWindow.refundAgents=Filtered refund agents (comma sep. onion addresses)
filterWindow.seedNode=Filtered seed nodes (comma sep. onion addresses)
filterWindow.addedSeedNodes=Added Seed nodes (comma sep. addresses + port)
filterWindow.priceRelayNode=Filtered price relay nodes (comma sep. onion addresses)
filterWindow.btcNode=Filtered Bitcoin nodes (comma sep. addresses + port)
filterWindow.btcNode=Banned Bitcoin nodes (comma sep. addresses + port)
filterWindow.addedBtcNodes=Added Bitcoin nodes (comma sep. addresses + port)
filterWindow.preventPublicBtcNetwork=Prevent usage of public Bitcoin network
filterWindow.disableDao=Disable DAO
filterWindow.disableAutoConf=Disable auto-confirm

View File

@ -168,12 +168,16 @@ public class FilterWindow extends Overlay<FilterWindow> {
Res.get("filterWindow.btcFeeReceiverAddresses"));
InputTextField seedNodesTF = addInputTextField(gridPane, ++rowIndex,
Res.get("filterWindow.seedNode"));
InputTextField addedSeedNodesTF = addInputTextField(gridPane, ++rowIndex,
Res.get("filterWindow.addedSeedNodes"));
InputTextField priceRelayNodesTF = addInputTextField(gridPane, ++rowIndex,
Res.get("filterWindow.priceRelayNode"));
InputTextField btcNodesTF = addInputTextField(gridPane, ++rowIndex,
Res.get("filterWindow.btcNode"));
InputTextField addedBtcNodesTF = addInputTextField(gridPane, ++rowIndex,
Res.get("filterWindow.addedBtcNodes"));
CheckBox preventPublicBtcNetworkCheckBox = addLabelCheckBox(gridPane, ++rowIndex,
Res.get("filterWindow.preventPublicBtcNetwork"));
Res.get("filterWindow.preventPublicBtcNetwork"), 15);
CheckBox disableDaoCheckBox = addLabelCheckBox(gridPane, ++rowIndex,
Res.get("filterWindow.disableDao"));
CheckBox disableAutoConfCheckBox = addLabelCheckBox(gridPane, ++rowIndex,
@ -187,7 +191,7 @@ public class FilterWindow extends Overlay<FilterWindow> {
InputTextField autoConfExplorersTF = addTopLabelInputTextField(gridPane, ++rowIndex,
Res.get("filterWindow.autoConfExplorers")).second;
CheckBox disableMempoolValidationCheckBox = addLabelCheckBox(gridPane, ++rowIndex,
Res.get("filterWindow.disableMempoolValidation"));
Res.get("filterWindow.disableMempoolValidation"), 15);
CheckBox disableApiCheckBox = addLabelCheckBox(gridPane, ++rowIndex,
Res.get("filterWindow.disableApi"));
CheckBox disablePowMessage = addLabelCheckBox(gridPane, ++rowIndex,
@ -220,8 +224,10 @@ public class FilterWindow extends Overlay<FilterWindow> {
setupFieldFromList(refundAgentsTF, filter.getRefundAgents());
setupFieldFromList(btcFeeReceiverAddressesTF, filter.getBtcFeeReceiverAddresses());
setupFieldFromList(seedNodesTF, filter.getSeedNodes());
setupFieldFromList(addedSeedNodesTF, filter.getAddedSeedNodes());
setupFieldFromList(priceRelayNodesTF, filter.getPriceRelayNodes());
setupFieldFromList(btcNodesTF, filter.getBtcNodes());
setupFieldFromList(addedBtcNodesTF, filter.getAddedBtcNodes());
setupFieldFromList(bannedPrivilegedDevPubKeysTF, filter.getBannedPrivilegedDevPubKeys());
setupFieldFromList(autoConfExplorersTF, filter.getBannedAutoConfExplorers());
setupFieldFromList(enabledPowVersionsTF, filter.getEnabledPowVersions());
@ -284,7 +290,9 @@ public class FilterWindow extends Overlay<FilterWindow> {
ParsingUtils.parseToCoin(takerFeeBtcTF.getText(), btcFormatter).value,
ParsingUtils.parseToCoin(makerFeeBsqTF.getText(), bsqFormatter).value,
ParsingUtils.parseToCoin(takerFeeBsqTF.getText(), bsqFormatter).value,
readAsPaymentAccountFiltersList(delayedPayoutTF)
readAsPaymentAccountFiltersList(delayedPayoutTF),
readAsList(addedBtcNodesTF),
readAsList(addedSeedNodesTF)
);
// We remove first the old filter

View File

@ -767,6 +767,8 @@ message Filter {
int64 taker_fee_bsq = 34;
repeated int32 enabled_pow_versions = 35;
repeated PaymentAccountFilter delayedPayoutPaymentAccounts = 36;
repeated string addedBtcNodes = 37;
repeated string addedSeedNodes = 38;
}
/* Deprecated */