Skip to content

Commit fa98041

Browse files
author
MarcoFalke
committed
refactor: Use ToIntegral in CreateFromDump
The unsigned version is never serialized with a `+` prefix, so the stricter ToIntegral can be used.
1 parent fa23ed7 commit fa98041

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/wallet/dump.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ bool CreateFromDump(const ArgsManager& args, const std::string& name, const fs::
151151
return false;
152152
}
153153
// Check the version number (value of first record)
154-
uint32_t ver;
155-
if (!ParseUInt32(version_value, &ver)) {
156-
error =strprintf(_("Error: Unable to parse version %u as a uint32_t"), version_value);
154+
const auto ver{ToIntegral<uint32_t>(version_value)};
155+
if (!ver) {
156+
error = strprintf(_("Error: Unable to parse version %u as a uint32_t"), version_value);
157157
dump_file.close();
158158
return false;
159159
}
160-
if (ver != DUMP_VERSION) {
160+
if (*ver != DUMP_VERSION) {
161161
error = strprintf(_("Error: Dumpfile version is not supported. This version of bitcoin-wallet only supports version 1 dumpfiles. Got dumpfile with version %s"), version_value);
162162
dump_file.close();
163163
return false;

0 commit comments

Comments
 (0)