Fixed XTNC support

This commit is contained in:
MoneroOcean
2020-01-03 22:54:07 -08:00
parent 61fecb0757
commit 9451fed838
4 changed files with 15 additions and 14 deletions

View File

@@ -3,13 +3,14 @@
#define CURRENT_TRANSACTION_VERSION 1 #define CURRENT_TRANSACTION_VERSION 1
enum BLOB_TYPE { enum BLOB_TYPE {
BLOB_TYPE_CRYPTONOTE = 0, BLOB_TYPE_CRYPTONOTE = 0,
BLOB_TYPE_FORKNOTE1 = 1, BLOB_TYPE_FORKNOTE1 = 1,
BLOB_TYPE_FORKNOTE2 = 2, BLOB_TYPE_FORKNOTE2 = 2,
BLOB_TYPE_CRYPTONOTE2 = 3, // Masari BLOB_TYPE_CRYPTONOTE2 = 3, // Masari
BLOB_TYPE_CRYPTONOTE_RYO = 4, // Ryo BLOB_TYPE_CRYPTONOTE_RYO = 4, // Ryo
BLOB_TYPE_CRYPTONOTE_LOKI = 5, // Loki BLOB_TYPE_CRYPTONOTE_LOKI = 5, // Loki
BLOB_TYPE_CRYPTONOTE3 = 6, // Masari BLOB_TYPE_CRYPTONOTE3 = 6, // Masari
BLOB_TYPE_AEON = 7, // Aeon BLOB_TYPE_AEON = 7, // Aeon
BLOB_TYPE_CRYPTONOTE_CUCKOO = 8, // MoneroV / Swap BLOB_TYPE_CRYPTONOTE_CUCKOO8 = 8, // MoneroV / Swap
BLOB_TYPE_CRYPTONOTE_CUCKOO = 9, // XTNC
}; };

View File

@@ -438,7 +438,7 @@ namespace cryptonote
VARINT_FIELD(minor_version) VARINT_FIELD(minor_version)
if (blob_type != BLOB_TYPE_FORKNOTE2) VARINT_FIELD(timestamp) if (blob_type != BLOB_TYPE_FORKNOTE2) VARINT_FIELD(timestamp)
FIELD(prev_id) FIELD(prev_id)
if (blob_type == BLOB_TYPE_CRYPTONOTE_CUCKOO) FIELD(nonce8) if (blob_type == BLOB_TYPE_CRYPTONOTE_CUCKOO8) FIELD(nonce8)
if (blob_type != BLOB_TYPE_FORKNOTE2) { if (blob_type != BLOB_TYPE_FORKNOTE2) {
if (blob_type == BLOB_TYPE_AEON) { if (blob_type == BLOB_TYPE_AEON) {
FIELD(nonce) FIELD(nonce)
@@ -449,7 +449,7 @@ namespace cryptonote
if (!typename Archive<W>::is_saving()) nonce = nonce32; if (!typename Archive<W>::is_saving()) nonce = nonce32;
} }
} }
if (blob_type == BLOB_TYPE_CRYPTONOTE_CUCKOO) FIELD(cycle) if (blob_type == BLOB_TYPE_CRYPTONOTE_CUCKOO || blob_type == BLOB_TYPE_CRYPTONOTE_CUCKOO8) FIELD(cycle)
END_SERIALIZE() END_SERIALIZE()
}; };

View File

@@ -429,7 +429,7 @@ namespace cryptonote
//--------------------------------------------------------------- //---------------------------------------------------------------
bool get_block_hashing_blob(const block& b, blobdata& blob) bool get_block_hashing_blob(const block& b, blobdata& blob)
{ {
if (b.blob_type == BLOB_TYPE_CRYPTONOTE_CUCKOO) { if (b.blob_type == BLOB_TYPE_CRYPTONOTE_CUCKOO || b.blob_type == BLOB_TYPE_CRYPTONOTE_CUCKOO8) {
blob = t_serializable_object_to_blob(b.major_version); blob = t_serializable_object_to_blob(b.major_version);
blob.append(reinterpret_cast<const char*>(&b.minor_version), sizeof(b.minor_version)); blob.append(reinterpret_cast<const char*>(&b.minor_version), sizeof(b.minor_version));
blob.append(reinterpret_cast<const char*>(&b.timestamp), sizeof(b.timestamp)); blob.append(reinterpret_cast<const char*>(&b.timestamp), sizeof(b.timestamp));
@@ -444,7 +444,7 @@ namespace cryptonote
if (b.blob_type == BLOB_TYPE_CRYPTONOTE3) { if (b.blob_type == BLOB_TYPE_CRYPTONOTE3) {
blob.append(reinterpret_cast<const char*>(&b.uncle), sizeof(b.uncle)); blob.append(reinterpret_cast<const char*>(&b.uncle), sizeof(b.uncle));
} }
if (b.blob_type == BLOB_TYPE_CRYPTONOTE_CUCKOO) { if (b.blob_type == BLOB_TYPE_CRYPTONOTE_CUCKOO8) {
blob.append(reinterpret_cast<const char*>(&b.nonce8), sizeof(b.nonce8)); blob.append(reinterpret_cast<const char*>(&b.nonce8), sizeof(b.nonce8));
} }
return true; return true;

View File

@@ -216,7 +216,7 @@ NAN_METHOD(construct_block_blob) { // (parentBlockTemplateBuffer, nonceBuffer, c
if (!mergeBlocks(parent_block, b, std::vector<crypto::hash>())) return THROW_ERROR_EXCEPTION("Failed to postprocess mining block"); if (!mergeBlocks(parent_block, b, std::vector<crypto::hash>())) return THROW_ERROR_EXCEPTION("Failed to postprocess mining block");
} }
if (blob_type == BLOB_TYPE_CRYPTONOTE_CUCKOO) { if (blob_type == BLOB_TYPE_CRYPTONOTE_CUCKOO || blob_type == BLOB_TYPE_CRYPTONOTE_CUCKOO8) {
if (info.Length() != 4) return THROW_ERROR_EXCEPTION("You must provide 4 arguments."); if (info.Length() != 4) return THROW_ERROR_EXCEPTION("You must provide 4 arguments.");
Local<Array> cycle = Local<Array>::Cast(info[3]); Local<Array> cycle = Local<Array>::Cast(info[3]);
for (int i = 0; i < 32; i++ ) b.cycle.data[i] = cycle->Get(i)->NumberValue(); for (int i = 0; i < 32; i++ ) b.cycle.data[i] = cycle->Get(i)->NumberValue();