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