updated pricing record to support timestamps
This commit is contained in:
committed by
MoneroOcean
parent
b402ceb37f
commit
d1a0cf9439
@@ -35,33 +35,63 @@
|
||||
#include "serialization.h"
|
||||
#include "debug_archive.h"
|
||||
#include "offshore/pricing_record.h"
|
||||
#include "cryptonote_config.h"
|
||||
|
||||
/*
|
||||
// read
|
||||
template <template <bool> class Archive>
|
||||
bool do_serialize(Archive<false> &ar, offshore::pricing_record &pr)
|
||||
bool do_serialize(Archive<false> &ar, offshore::pricing_record &pr, uint8_t version)
|
||||
{
|
||||
// very basic sanity check
|
||||
if (ar.remaining_bytes() < sizeof(offshore::pricing_record)) {
|
||||
ar.stream().setstate(std::ios::failbit);
|
||||
return false;
|
||||
if (version < HF_VERSION_XASSET_FEES_V2)
|
||||
{
|
||||
// very basic sanity check
|
||||
if (ar.remaining_bytes() < sizeof(offshore::pricing_record_v1)) {
|
||||
ar.stream().setstate(std::ios::failbit);
|
||||
return false;
|
||||
}
|
||||
|
||||
offshore::pricing_record_v1 pr_v1;
|
||||
ar.serialize_blob(&pr_v1, sizeof(offshore::pricing_record_v1), "");
|
||||
if (!ar.stream().good())
|
||||
return false;
|
||||
|
||||
if (!pr_v1.write_to_pr(pr))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// very basic sanity check
|
||||
if (ar.remaining_bytes() < sizeof(offshore::pricing_record)) {
|
||||
ar.stream().setstate(std::ios::failbit);
|
||||
return false;
|
||||
}
|
||||
|
||||
ar.serialize_blob(&pr, sizeof(offshore::pricing_record), "");
|
||||
if (!ar.stream().good())
|
||||
return false;
|
||||
}
|
||||
ar.serialize_blob(&pr, sizeof(offshore::pricing_record), "");
|
||||
if (!ar.stream().good())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// write
|
||||
template <template <bool> class Archive>
|
||||
bool do_serialize(Archive<true> &ar, offshore::pricing_record &pr)
|
||||
bool do_serialize(Archive<true> &ar, offshore::pricing_record &pr, uint8_t version)
|
||||
{
|
||||
ar.begin_string();
|
||||
ar.serialize_blob(&pr, sizeof(offshore::pricing_record), "");
|
||||
if (version < HF_VERSION_XASSET_FEES_V2)
|
||||
{
|
||||
offshore::pricing_record_v1 pr_v1;
|
||||
if (!pr_v1.read_from_pr(pr))
|
||||
return false;
|
||||
ar.serialize_blob(&pr_v1, sizeof(offshore::pricing_record_v1), "");
|
||||
}
|
||||
else
|
||||
{
|
||||
ar.serialize_blob(&pr, sizeof(offshore::pricing_record), "");
|
||||
}
|
||||
if (!ar.stream().good())
|
||||
return false;
|
||||
ar.end_string();
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
BLOB_SERIALIZER(offshore::pricing_record);
|
||||
BLOB_SERIALIZER(offshore::pricing_record);
|
||||
|
||||
Reference in New Issue
Block a user