Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 75e5e04509 | |||
| 1a31a67303 | |||
| ee84d41d34 | |||
| 5bda5f949e | |||
| 52bb818185 |
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cryptoforknote-util",
|
"name": "cryptoforknote-util",
|
||||||
"version": "3.0.0",
|
"version": "4.1.0",
|
||||||
"main": "cryptoforknote-util",
|
"main": "cryptoforknote-util",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "LucasJones",
|
"name": "LucasJones",
|
||||||
|
|||||||
@@ -137,6 +137,15 @@ namespace cryptonote
|
|||||||
END_SERIALIZE()
|
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
|
class transaction_prefix
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -151,20 +160,45 @@ namespace cryptonote
|
|||||||
//extra
|
//extra
|
||||||
std::vector<uint8_t> extra;
|
std::vector<uint8_t> extra;
|
||||||
|
|
||||||
|
//
|
||||||
|
// NOTE: Loki specific
|
||||||
|
//
|
||||||
std::vector<uint64_t> output_unlock_times;
|
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()
|
BEGIN_SERIALIZE()
|
||||||
VARINT_FIELD(version)
|
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(output_unlock_times)
|
||||||
FIELD(is_deregister)
|
if (version == loki_version_3_per_output_unlock_times)
|
||||||
|
FIELD(is_deregister)
|
||||||
}
|
}
|
||||||
VARINT_FIELD(unlock_time)
|
VARINT_FIELD(unlock_time)
|
||||||
FIELD(vin)
|
FIELD(vin)
|
||||||
FIELD(vout)
|
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)
|
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()
|
END_SERIALIZE()
|
||||||
|
|
||||||
|
|
||||||
@@ -185,7 +219,7 @@ namespace cryptonote
|
|||||||
BEGIN_SERIALIZE_OBJECT()
|
BEGIN_SERIALIZE_OBJECT()
|
||||||
FIELDS(*static_cast<transaction_prefix *>(this))
|
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.tag("signatures");
|
||||||
ar.begin_array();
|
ar.begin_array();
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ namespace cryptonote
|
|||||||
bool get_transaction_hash(const transaction& t, crypto::hash& res, size_t* blob_size)
|
bool get_transaction_hash(const transaction& t, crypto::hash& res, size_t* blob_size)
|
||||||
{
|
{
|
||||||
// v1 transactions hash the entire blob
|
// 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;
|
size_t ignored_blob_size, &blob_size_ref = blob_size ? *blob_size : ignored_blob_size;
|
||||||
return get_object_hash(t, res, blob_size_ref);
|
return get_object_hash(t, res, blob_size_ref);
|
||||||
|
|||||||
Reference in New Issue
Block a user