refactor: Use ToIntegral in CreateFromDump
The unsigned version is never serialized with a `+` prefix, so the stricter ToIntegral can be used.
This commit is contained in:
1 file changed
+4
-4
+4
-4
@@ -151,13 +151,13 @@ bool CreateFromDump(const ArgsManager& args, const std::string& name, const fs::
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Check the version number (value of first record)
|
// Check the version number (value of first record)
|
||||||
uint32_t ver;
|
const auto ver{ToIntegral<uint32_t>(version_value)};
|
||||||
if (!ParseUInt32(version_value, &ver)) {
|
if (!ver) {
|
||||||
error =strprintf(_("Error: Unable to parse version %u as a uint32_t"), version_value);
|
error = strprintf(_("Error: Unable to parse version %u as a uint32_t"), version_value);
|
||||||
dump_file.close();
|
dump_file.close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ver != DUMP_VERSION) {
|
if (*ver != DUMP_VERSION) {
|
||||||
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);
|
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);
|
||||||
dump_file.close();
|
dump_file.close();
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in new issue
Block a user