From 4bc6616e7a8e5d20db55666cf1b5d0fbc7494322 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Tue, 27 Aug 2019 19:27:39 +0200 Subject: [PATCH] Do not send BSQ blocks to full nodes --- common/src/main/java/bisq/common/app/Capability.java | 2 +- .../core/dao/node/messages/NewBlockBroadcastMessage.java | 2 +- .../java/bisq/core/setup/CoreNetworkCapabilities.java | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/bisq/common/app/Capability.java b/common/src/main/java/bisq/common/app/Capability.java index ed11d61c879..31ce6bd822f 100644 --- a/common/src/main/java/bisq/common/app/Capability.java +++ b/common/src/main/java/bisq/common/app/Capability.java @@ -31,7 +31,7 @@ public enum Capability { PROPOSAL, BLIND_VOTE, ACK_MSG, - BSQ_BLOCK, + RECEIVE_BSQ_BLOCK, DAO_STATE, BUNDLE_OF_ENVELOPES, SIGNED_ACCOUNT_AGE_WITNESS diff --git a/core/src/main/java/bisq/core/dao/node/messages/NewBlockBroadcastMessage.java b/core/src/main/java/bisq/core/dao/node/messages/NewBlockBroadcastMessage.java index 4e78d912c8f..e5dbfefc900 100644 --- a/core/src/main/java/bisq/core/dao/node/messages/NewBlockBroadcastMessage.java +++ b/core/src/main/java/bisq/core/dao/node/messages/NewBlockBroadcastMessage.java @@ -64,6 +64,6 @@ public static NetworkEnvelope fromProto(protobuf.NewBlockBroadcastMessage proto, @Override public Capabilities getRequiredCapabilities() { - return new Capabilities(Capability.BSQ_BLOCK); + return new Capabilities(Capability.RECEIVE_BSQ_BLOCK); } } diff --git a/core/src/main/java/bisq/core/setup/CoreNetworkCapabilities.java b/core/src/main/java/bisq/core/setup/CoreNetworkCapabilities.java index 0a84eee15f3..868ca5ef56d 100644 --- a/core/src/main/java/bisq/core/setup/CoreNetworkCapabilities.java +++ b/core/src/main/java/bisq/core/setup/CoreNetworkCapabilities.java @@ -29,10 +29,10 @@ public class CoreNetworkCapabilities { public static void setSupportedCapabilities(BisqEnvironment bisqEnvironment) { Capabilities.app.addAll(Capability.TRADE_STATISTICS, Capability.TRADE_STATISTICS_2, Capability.ACCOUNT_AGE_WITNESS, Capability.ACK_MSG); - Capabilities.app.addAll(Capability.BUNDLE_OF_ENVELOPES,Capability.SIGNED_ACCOUNT_AGE_WITNESS); + Capabilities.app.addAll(Capability.BUNDLE_OF_ENVELOPES, Capability.SIGNED_ACCOUNT_AGE_WITNESS); if (BisqEnvironment.isDaoActivated(bisqEnvironment)) { - Capabilities.app.addAll(Capability.PROPOSAL, Capability.BLIND_VOTE, Capability.BSQ_BLOCK, Capability.DAO_STATE); + Capabilities.app.addAll(Capability.PROPOSAL, Capability.BLIND_VOTE, Capability.DAO_STATE); maybeApplyDaoFullMode(bisqEnvironment); } @@ -46,6 +46,10 @@ public static void maybeApplyDaoFullMode(BisqEnvironment bisqEnvironment) { if (isFullDaoNode != null && !isFullDaoNode.isEmpty() && isFullDaoNode.toLowerCase().equals("true")) { log.info("Set Capability.DAO_FULL_NODE"); Capabilities.app.addAll(Capability.DAO_FULL_NODE); + } else { + // A lite node has the capability to receive bsq blocks. We do not want to send BSQ blocks to full nodes + // as they ignore them anyway. + Capabilities.app.addAll(Capability.RECEIVE_BSQ_BLOCK); } } }