Skip to content

Knots Privacy Tweaks #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 28.x-knots
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ std::string CopyrightHolders(const std::string& strPrefix);
/** Returns licensing information (for -version) */
std::string LicenseInfo();

static constexpr bool DEFAULT_UA_HIDE_KNOTS = false;

static constexpr int64_t SECONDS_PER_YEAR = 31558060;
static constexpr int POSIX_EPOCH_YEAR = 1970;
static constexpr int64_t DEFAULT_SOFTWARE_EXPIRY_OFFSET = 26784000; // Around Nov 7
Expand Down
8 changes: 3 additions & 5 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ void SetupServerArgs(ArgsManager& argsman)
argsman.AddArg("-printpriority", strprintf("Log transaction priority and fee rate in " + CURRENCY_UNIT + "/kvB when mining blocks (default: %u)", DEFAULT_PRINT_MODIFIED_FEE), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-uaappend=<cmt>", "Append literal to the user agent string (should only be used for software embedding)", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
argsman.AddArg("-uacomment=<cmt>", "Append comment to the user agent string", ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-uahideknots", strprintf("Hide Knots from the user agent string (default: %u)", DEFAULT_UA_HIDE_KNOTS), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);

SetupChainParamsBaseOptions(argsman);

Expand Down Expand Up @@ -1508,7 +1509,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters."), cmt));
uacomments.push_back(cmt);
}
strSubVersion = FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, uacomments);
bool base_name_only = args.GetBoolArg("-uahideknots", DEFAULT_UA_HIDE_KNOTS);
strSubVersion = FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, uacomments, base_name_only);
for (auto append : gArgs.GetArgs("-uaappend")) {
if (append.back() != '/') append += '/';
strSubVersion += append;
Expand Down Expand Up @@ -1702,10 +1704,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
LogPrintf("* Flushing caches if available system memory drops below %s MiB\n", g_low_memory_threshold / 1024 / 1024);
}

if (mempool_opts.rbf_policy == RBFPolicy::Always) {
nLocalServices = ServiceFlags(nLocalServices | NODE_REPLACE_BY_FEE);
}

for (bool fLoaded = false; !fLoaded && !ShutdownRequested(node);) {
bilingual_str mempool_error;
node.mempool = std::make_unique<CTxMemPool>(mempool_opts, mempool_error);
Expand Down
1 change: 0 additions & 1 deletion src/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ static std::string serviceFlagToStr(size_t bit)
case NODE_COMPACT_FILTERS: return "COMPACT_FILTERS";
case NODE_NETWORK_LIMITED: return "NETWORK_LIMITED";
case NODE_P2P_V2: return "P2P_V2";
case NODE_REPLACE_BY_FEE: return "REPLACE_BY_FEE?";
// Not using default, so we get warned when a case is missing
}

Expand Down
2 changes: 0 additions & 2 deletions src/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,6 @@ enum ServiceFlags : uint64_t {
// collisions and other cases where nodes may be advertising a service they
// do not actually support. Other service bits should be allocated via the
// BIP process.

NODE_REPLACE_BY_FEE = (1 << 26),
};

/**
Expand Down
8 changes: 0 additions & 8 deletions test/functional/feature_rbf.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ def test_rpc_rbf_policy():
test_rpc_rbf_policy()

self.log.info("Running test service flag")
def test_service_flag():
NODE_REPLACE_BY_FEE = (1 << 26)
for i in range(3):
assert not (int(self.nodes[i].getnetworkinfo()['localservices'], 0x10) & NODE_REPLACE_BY_FEE)
assert 'REPLACE_BY_FEE?' not in self.nodes[i].getnetworkinfo()['localservicesnames']
assert int(self.nodes[3].getnetworkinfo()['localservices'], 0x10) & NODE_REPLACE_BY_FEE
assert 'REPLACE_BY_FEE?' in self.nodes[3].getnetworkinfo()['localservicesnames']
test_service_flag()

self.log.info("Running test simple doublespend...")
self.test_simple_doublespend()
Expand Down
3 changes: 1 addition & 2 deletions test/functional/p2p_node_network_limited.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
NODE_NETWORK_LIMITED,
NODE_P2P_V2,
NODE_WITNESS,
NODE_REPLACE_BY_FEE,
msg_getdata,
)
from test_framework.p2p import P2PInterface
Expand Down Expand Up @@ -120,7 +119,7 @@ def test_avoid_requesting_historical_blocks(self):
def run_test(self):
node = self.nodes[0].add_p2p_connection(P2PIgnoreInv())

expected_services = NODE_BLOOM | NODE_WITNESS | NODE_NETWORK_LIMITED | NODE_REPLACE_BY_FEE
expected_services = NODE_BLOOM | NODE_WITNESS | NODE_NETWORK_LIMITED
if self.options.v2transport:
expected_services |= NODE_P2P_V2

Expand Down
1 change: 0 additions & 1 deletion test/functional/test_framework/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
NODE_COMPACT_FILTERS = (1 << 6)
NODE_NETWORK_LIMITED = (1 << 10)
NODE_P2P_V2 = (1 << 11)
NODE_REPLACE_BY_FEE = (1 << 26)

MSG_TX = 1
MSG_BLOCK = 2
Expand Down