diff options
| author | luigi1111 <luigi1111w@gmail.com> | 2024-12-23 11:04:59 -0500 |
|---|---|---|
| committer | luigi1111 <luigi1111w@gmail.com> | 2024-12-23 11:04:59 -0500 |
| commit | a6f21ca4bd88f87a9167b40ecb53374db969be60 (patch) | |
| tree | 4ca84a7dbb787a55f17b82af1fd6615358e8b204 /src/daemon | |
| parent | f498b4d10d7e9a9a01b881c56dd671a312038729 (diff) | |
| parent | a1b545a2f7b2ac48d66e7fd846ca5093286525c7 (diff) | |
| download | monzero-core-a6f21ca4bd88f87a9167b40ecb53374db969be60.tar.gz monzero-core-a6f21ca4bd88f87a9167b40ecb53374db969be60.tar.xz monzero-core-a6f21ca4bd88f87a9167b40ecb53374db969be60.zip | |
Merge pull request #9616
a1b545a p2p: allow comments in banlist files (jeffro256)
Diffstat (limited to 'src/daemon')
| -rw-r--r-- | src/daemon/command_parser_executor.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp index 20c906141..087a4e48b 100644 --- a/src/daemon/command_parser_executor.cpp +++ b/src/daemon/command_parser_executor.cpp @@ -696,6 +696,16 @@ bool t_command_parser_executor::ban(const std::vector<std::string>& args) std::ifstream ifs(ban_list_path.string()); for (std::string line; std::getline(ifs, line); ) { + // ignore comments after '#' character + const size_t pound_idx = line.find('#'); + if (pound_idx != std::string::npos) + line.resize(pound_idx); + + // trim whitespace and ignore empty lines + boost::trim(line); + if (line.empty()) + continue; + auto subnet = net::get_ipv4_subnet_address(line); if (subnet) { |
