Skip to content
Bitcoin Roots

v30.3-roots.1 · Commit 20: [PATCH 20/68] modernize: use string_view prefix checks

src/node/mempool_args.cpp

Before: src/node/mempool_args.cpp · After: src/node/mempool_args.cpp

File metadata
index 78acc97314d6b083eb4e58fc512ce44de5ac9bb6..cce243554c0b0ee1433e81548b47a769bde69ffe 100644

Download original patch · Release notes

Diff rows 1–16 of 16. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

src/node/mempool_args.cpp CHANGED
@@ -67,7 +67,7 @@ util::Result<std::pair<int32_t, int>> ParseDustDynamicOpt(std::string_view optst
67
67
  optstr.remove_prefix(pos + 1);
68
68
  }
69
69
 
70
- if (optstr.rfind("target:", 0) == 0) {
70
+ if (optstr.starts_with("target:")) {
71
71
  const auto val = ToIntegral<uint16_t>(optstr.substr(7));
72
72
  if (!val) {
73
73
  return util::Error{_("failed to parse target block count")};
@@ -79,7 +79,7 @@ util::Result<std::pair<int32_t, int>> ParseDustDynamicOpt(std::string_view optst
79
79
  return util::Error{strprintf(_("target can only be at most %s blocks"), max_fee_estimate_blocks)};
80
80
  }
81
81
  return std::pair<int32_t, int>(-*val, multiplier);
82
- } else if (optstr.rfind("mempool:", 0) == 0) {
82
+ } else if (optstr.starts_with("mempool:")) {
83
83
  const auto val = ToIntegral<int32_t>(optstr.substr(8));
84
84
  if (!val) {
85
85
  return util::Error{_("failed to parse mempool position")};