Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/utils/monero_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,15 +342,15 @@ void monero_utils::validate_mnemonic(const std::string& mnemonic, const std::str

void monero_utils::json_to_binary(const std::string &json, std::string &bin) {
epee::serialization::portable_storage ps;
ps.load_from_json(json);
if (!ps.load_from_json(json)) throw std::runtime_error("Invalid JSON");
epee::byte_stream bs;
ps.store_to_binary(bs);
bin = std::string((char*) bs.data(), bs.size());
}

void monero_utils::binary_to_json(const std::string &bin, std::string &json) {
epee::serialization::portable_storage ps;
ps.load_from_binary(bin);
if (!ps.load_from_binary(bin)) throw std::runtime_error("Invalid binary");
ps.dump_as_json(json);
}

Expand Down
Loading