Compare commits

...

5 Commits

Author SHA1 Message Date
MoneroOcean 75e5e04509 Moved version 2019-03-18 08:47:34 -07:00
MoneroOcean 1a31a67303 Merge pull request #4 from Doy-lee/LokiSupportPR
Update cryptonote utils for Loki hardfork 11
2019-03-18 16:46:37 +01:00
Doyle ee84d41d34 Update cryptonote utils for Loki hardfork 11, Infinite Staking 2019-03-18 14:20:49 +11:00
MoneroOcean 5bda5f949e MSR fixes 2019-01-26 09:19:31 -08:00
MoneroOcean 52bb818185 Updated version 2019-01-26 08:40:49 -08:00
3 changed files with 40 additions and 6 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cryptoforknote-util",
"version": "3.0.0",
"version": "4.1.0",
"main": "cryptoforknote-util",
"author": {
"name": "LucasJones",
+38 -4
View File
@@ -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
{
@@ -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()
@@ -185,7 +219,7 @@ namespace cryptonote
BEGIN_SERIALIZE_OBJECT()
FIELDS(*static_cast<transaction_prefix *>(this))
if (version == 1 && blob_type != BLOB_TYPE_CRYPTONOTE2)
if (version == 1 && blob_type != BLOB_TYPE_CRYPTONOTE2 && blob_type != BLOB_TYPE_CRYPTONOTE3)
{
ar.tag("signatures");
ar.begin_array();
@@ -370,7 +370,7 @@ namespace cryptonote
bool get_transaction_hash(const transaction& t, crypto::hash& res, size_t* blob_size)
{
// v1 transactions hash the entire blob
if (t.version == 1 && t.blob_type != BLOB_TYPE_CRYPTONOTE2)
if (t.version == 1 && t.blob_type != BLOB_TYPE_CRYPTONOTE2 && t.blob_type != BLOB_TYPE_CRYPTONOTE3)
{
size_t ignored_blob_size, &blob_size_ref = blob_size ? *blob_size : ignored_blob_size;
return get_object_hash(t, res, blob_size_ref);