aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/rpc_payment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc/rpc_payment.cpp')
-rw-r--r--src/rpc/rpc_payment.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/rpc/rpc_payment.cpp b/src/rpc/rpc_payment.cpp
index bf6584f72..f0c513911 100644
--- a/src/rpc/rpc_payment.cpp
+++ b/src/rpc/rpc_payment.cpp
@@ -293,12 +293,13 @@ namespace cryptonote
MINFO("loading rpc payments data from " << state_file_path);
std::ifstream data;
data.open(state_file_path, std::ios_base::binary | std::ios_base::in);
+ std::string bytes(std::istream_iterator<char>{data}, std::istream_iterator<char>{});
if (!data.fail())
{
bool loaded = false;
try
{
- binary_archive<false> ar(data);
+ binary_archive<false> ar{epee::strspan<std::uint8_t>(bytes)};
if (::serialization::serialize(ar, *this))
if (::serialization::check_stream_state(ar))
loaded = true;
@@ -306,6 +307,8 @@ namespace cryptonote
catch (...) {}
if (!loaded)
{
+ bytes.clear();
+ bytes.shrink_to_fit();
try
{
boost::archive::portable_binary_iarchive a(data);