Skip to content

Commit

Permalink
Merge pull request #4 from Doy-lee/LokiSupportPR
Browse files Browse the repository at this point in the history
Update cryptonote utils for Loki hardfork 11
  • Loading branch information
MoneroOcean authored Mar 18, 2019
2 parents 5bda5f9 + ee84d41 commit 1a31a67
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions src/cryptonote_core/cryptonote_basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ namespace cryptonote
END_SERIALIZE()
};

enum loki_version
{
loki_version_0 = 0,
loki_version_1,
loki_version_2,
loki_version_3_per_output_unlock_times,
loki_version_4_tx_types,
};

class transaction_prefix
{

Expand All @@ -151,20 +160,45 @@ namespace cryptonote
//extra
std::vector<uint8_t> extra;

//
// NOTE: Loki specific
//
std::vector<uint64_t> output_unlock_times;
bool is_deregister;
enum loki_type_t
{
loki_type_standard,
loki_type_deregister,
loki_type_key_image_unlock,
loki_type_count,
};

union
{
bool is_deregister;
uint16_t type;
};

BEGIN_SERIALIZE()
VARINT_FIELD(version)
if (blob_type == BLOB_TYPE_CRYPTONOTE_LOKI)
if (version > loki_version_2 && blob_type == BLOB_TYPE_CRYPTONOTE_LOKI)
{
FIELD(output_unlock_times)
FIELD(is_deregister)
if (version == loki_version_3_per_output_unlock_times)
FIELD(is_deregister)
}
VARINT_FIELD(unlock_time)
FIELD(vin)
FIELD(vout)
if (blob_type == BLOB_TYPE_CRYPTONOTE_LOKI)
{
if (version >= loki_version_3_per_output_unlock_times && vout.size() != output_unlock_times.size()) return false;
}
FIELD(extra)
if (blob_type == BLOB_TYPE_CRYPTONOTE_LOKI && version >= loki_version_4_tx_types)
{
VARINT_FIELD(type)
if (static_cast<uint16_t>(type) >= loki_type_count) return false;
}
END_SERIALIZE()


Expand Down

0 comments on commit 1a31a67

Please sign in to comment.