From 478f360381f073549cde35120508694f7d4de965 Mon Sep 17 00:00:00 2001 From: pmitchev Date: Wed, 21 Feb 2018 21:42:15 +0200 Subject: [PATCH] Starting work on Dashcoin with Monero core --- configs/aeon.json | 2 +- configs/dashcoin.json | 49 ++++ extensions/bytecoin-clone.json | 513 +++++++++++++++++++++++++++++++++ extensions/core/monero.json | 95 +++++- 4 files changed, 653 insertions(+), 6 deletions(-) create mode 100644 configs/dashcoin.json create mode 100644 extensions/bytecoin-clone.json diff --git a/configs/aeon.json b/configs/aeon.json index f11212b..004f948 100644 --- a/configs/aeon.json +++ b/configs/aeon.json @@ -22,7 +22,7 @@ "TESTNET_ZMQ_RPC_DEFAULT_PORT": 22282, "MAINNET_SEED_NODES":"full_addrs.insert(\"74.91.23.186:11180\");\nfull_addrs.insert(\"192.187.114.114:11180\");\nfull_addrs.insert(\"34.200.218.170:11180\");\nfull_addrs.insert(\"144.76.104.208:11180\");\n", "TESTNET_SEED_NODES":"full_addrs.insert(\"165.227.238.211\");\n", - "MAINET_CHECKPOINTS":" ADD_CHECKPOINT(1, \"1440a20f078bf3264822234b347f8382606577d73d4e9d3cb7296d73889bc421\");\n ADD_CHECKPOINT(100, \"6dd13aaab16679f49ee6b2b75c7dc99b1fd09ab2282b18cb4b55b73110655742\");\n ADD_CHECKPOINT(1000, \"bc6458452fd0575a314089bf302f6fd68ebaa2d689c42f3365293b96bbdf1f25\");\n ADD_CHECKPOINT(10000, \"1ac1ebd25baf0d6ec593daa3389f1aa7e860ff2cc29f3cf1be586d245b379da4\");\n ADD_CHECKPOINT(15000, \"15567af42afc1ed00538f53b5e3822d421e3ed6372ca79f4ea4e3e3bab709a87\");\n ADD_CHECKPOINT(175500, \"3f7dd748b3b863b04654d87a387f2b65a365f467188971f3192eab2368e64a35\");\n ADD_CHECKPOINT(450000, \"f69a6e57c4dd5df2f492c9d31c50f11aad2c25a64d540ce5f5d11b572aec8ab7\");\n ADD_CHECKPOINT(540000, \"94e19cf9d5a16ae90f67c321f8376b87da21d6d6c2cb0957b9ab558dca66c1dc\");\n ADD_CHECKPOINT(592001, \"e8bc936b287a9c426a15cf127624b064c88e6d37655cc87f9a62cf1623c62385\");\n ADD_CHECKPOINT(798358, \"804c7fe07511d9387e7cda534c9e8b644d406d8d0ff299799a8177850d4e75a0\");\n ADD_CHECKPOINT(871000, \"99f7e5460da3fb4e2b15214017b0a17ff0294823ad852259ff837f0ffeeb90f0\");\n", + "MAINNET_CHECKPOINTS":" ADD_CHECKPOINT(1, \"1440a20f078bf3264822234b347f8382606577d73d4e9d3cb7296d73889bc421\");\n ADD_CHECKPOINT(100, \"6dd13aaab16679f49ee6b2b75c7dc99b1fd09ab2282b18cb4b55b73110655742\");\n ADD_CHECKPOINT(1000, \"bc6458452fd0575a314089bf302f6fd68ebaa2d689c42f3365293b96bbdf1f25\");\n ADD_CHECKPOINT(10000, \"1ac1ebd25baf0d6ec593daa3389f1aa7e860ff2cc29f3cf1be586d245b379da4\");\n ADD_CHECKPOINT(15000, \"15567af42afc1ed00538f53b5e3822d421e3ed6372ca79f4ea4e3e3bab709a87\");\n ADD_CHECKPOINT(175500, \"3f7dd748b3b863b04654d87a387f2b65a365f467188971f3192eab2368e64a35\");\n ADD_CHECKPOINT(450000, \"f69a6e57c4dd5df2f492c9d31c50f11aad2c25a64d540ce5f5d11b572aec8ab7\");\n ADD_CHECKPOINT(540000, \"94e19cf9d5a16ae90f67c321f8376b87da21d6d6c2cb0957b9ab558dca66c1dc\");\n ADD_CHECKPOINT(592001, \"e8bc936b287a9c426a15cf127624b064c88e6d37655cc87f9a62cf1623c62385\");\n ADD_CHECKPOINT(798358, \"804c7fe07511d9387e7cda534c9e8b644d406d8d0ff299799a8177850d4e75a0\");\n ADD_CHECKPOINT(871000, \"99f7e5460da3fb4e2b15214017b0a17ff0294823ad852259ff837f0ffeeb90f0\");\n", "MAINNET_HARDFORKS":"{ 1, 1, 0, 1341378000 }", "TESTNET_HARDFORKS":"{ 1, 1, 0, 1341378000 }", "MAINNET_HARDFORK_V1_LAST_BLOCK": -1, diff --git a/configs/dashcoin.json b/configs/dashcoin.json new file mode 100644 index 0000000..f89b6c2 --- /dev/null +++ b/configs/dashcoin.json @@ -0,0 +1,49 @@ +{ + "extensions": [ + "core/monero.json", + "bytecoin-clone.json" + ], + "base_coin": { + "name": "monero", + "git": "https://github.com/monero-project/monero.git" + }, + "core": { + "COIN_NAME": "Dashcoin", + "CRYPTONOTE_NAME": "dashcoin.monero", + "CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX": 72, + "CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX": 73, + "CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX": 42, + "MAINNET_P2P_DEFAULT_PORT": 29080, + "MAINNET_RPC_DEFAULT_PORT": 29081, + "MAINNET_ZMQ_RPC_DEFAULT_PORT": 29082, + "MAINNET_SEED_NODES":"full_addrs.insert(\"108.61.188.93:7610\");\nfull_addrs.insert(\"104.238.188.213:7610\");\n", + "MAINNET_CHECKPOINTS":" ADD_CHECKPOINT(28000, \"70d2531151529ac00bf875281e15f51324934bc85e5733dcd92e1ccb1a665ff8\");\nADD_CHECKPOINT(87500, \"cce8a035f34457ec1098ab41e5949cac3db00ebff3503e26f36bfa057543095a\");\nADD_CHECKPOINT(738000, \"8202b5dc2b070bd7743c44763e6eb5546ea7699f3829dc29594f046f21199b08\");\n", + "MAINNET_HARDFORKS":"{ 1, 1, 0, 1341378000 },\n { 2, 91453, 0, 1415599000 },", + "MAINNET_HARDFORK_V1_LAST_BLOCK": 91452, + + "CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1": 10000, + "CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2": 20000, + "CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5": 200000, + "CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW": 10, + "CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE": 0, + + "BYTECOIN_CLONE": 1, + + "P2P_STAT_TRUSTED_PUB_KEY": "", + + "MAINNET_GENESIS_TX": "010a01ff0001ffffffffffff0f029b2e4c0271c0b42e7c53291a94d1c0cbff8883f8024f5142ee494ffbbd08807121013c086a48c15fb637a96991bc6d53caf77068b5ba6eeb3c82357228c49790584a", + "MAINNET_GENESIS_NONCE": 70, + "MAINNET_NETWORK_ID": "0x12, 0x11, 0x21, 0x11, 0x11, 0x10, 0x41, 0x01, 0x13, 0x11, 0x00, 0x12, 0x12, 0x11, 0x01, 0x10", + + "MONEY_SUPPLY": -1, + "FINAL_SUBSIDY_PER_MINUTE": 0, + "MINIMUM_RELAY_FEE": 1000000, + "DEFAULT_FEE": 1000000000, + "NO_FEE_PER_KB_FEE_MAX_HEIGHT": -1, + "EMISSION_SPEED_FACTOR_PER_MINUTE": 19, + "DIFFICULTY_WINDOW_V1": 720, + "DIFFICULTY_WINDOW_V2": 720, + "DIFFICULTY_TARGET_V1": 120, + "DIFFICULTY_TARGET_V2": 120 + } +} diff --git a/extensions/bytecoin-clone.json b/extensions/bytecoin-clone.json new file mode 100644 index 0000000..e8e2c4e --- /dev/null +++ b/extensions/bytecoin-clone.json @@ -0,0 +1,513 @@ +{ + "TODO": "Not working. It need a lot of finishing work.", + "file": "bytecoin-clone.json", + "description": "Changes needed to run Bytecoin clone", + "required": [ + "core/monero.json" + ], + "files": [ + { + "path": "/src/cryptonote_config.h", + "changes": [ + { + "action": "add_below", + "marker": "#define CRYPTONOTE_NAME", + "parameters": { + "text": [ + "#define BYTECOIN_CLONE %s" + ], + "text_alt": [ + "#define BYTECOIN_CLONE 0" + ], + "var": "BYTECOIN_CLONE" + } + } + ] + }, + + { + "path": "/src/crypto/hash.h", + "changes": [ + { + "action": "add_above", + "marker": "inline void tree_hash(const hash *hashes, std::size_t count, hash &root_hash) {", + "parameters": { + "text": [ + "inline void tree_branch(const hash *hashes, size_t count, hash *branch) {", + " tree_branch(reinterpret_cast(hashes), count, reinterpret_cast(branch));", + "}", + "", + "inline void tree_hash_from_branch(const hash *branch, size_t depth, const hash &leaf, const void *path, hash &root_hash) {", + " tree_hash_from_branch(reinterpret_cast(branch), depth, reinterpret_cast(&leaf), path, reinterpret_cast(&root_hash));", + "}", + "" + ] + } + } + ] + }, + { + "path": "/src/crypto/hash-ops.h", + "changes": [ + { + "action": "add_above", + "marker": "void tree_hash(const char (*hashes)[HASH_SIZE], size_t count, char *root_hash);", + "parameters": { + "text": [ + "size_t tree_depth(size_t count);", + "void tree_branch(const char (*hashes)[HASH_SIZE], size_t count, char (*branch)[HASH_SIZE]);", + "void tree_hash_from_branch(const char (*branch)[HASH_SIZE], size_t depth, const char *leaf, const void *path, char *root_hash);" + ] + } + } + ] + }, + + + + { + "path": "/src/crypto/tree-hash.c", + "changes": [ + { + "action": "add_above", + "marker": "void tree_hash(const char (*hashes)[HASH_SIZE], size_t count, char *root_hash) {", + "parameters": { + "text": [ + "", + "size_t tree_depth(size_t count) {", + " size_t i;", + " size_t depth = 0;", + " assert(count > 0);", + " for (i = sizeof(size_t) << 2; i > 0; i >>= 1) {", + " if (count >> i > 0) {", + " count >>= i;", + " depth += i;", + " }", + " }", + " return depth;", + "}", + "", + "void tree_branch(const char (*hashes)[HASH_SIZE], size_t count, char (*branch)[HASH_SIZE]) {", + " size_t i, j;", + " size_t cnt = 1;", + " size_t depth = 0;", + " char (*ints)[HASH_SIZE];", + " assert(count > 0);", + " for (i = sizeof(size_t) << 2; i > 0; i >>= 1) {", + " if (cnt << i <= count) {", + " cnt <<= i;", + " depth += i;", + " }", + " }", + " assert(cnt == 1ULL << depth);", + " assert(depth == tree_depth(count));", + " ints = alloca((cnt - 1) * HASH_SIZE);", + " memcpy(ints, hashes + 1, (2 * cnt - count - 1) * HASH_SIZE);", + " for (i = 2 * cnt - count, j = 2 * cnt - count - 1; j < cnt - 1; i += 2, ++j) {", + " cn_fast_hash(hashes[i], 2 * HASH_SIZE, ints[j]);", + " }", + " assert(i == count);", + " while (depth > 0) {", + " assert(cnt == 1ULL << depth);", + " cnt >>= 1;", + " --depth;", + " memcpy(branch[depth], ints[0], HASH_SIZE);", + " for (i = 1, j = 0; j < cnt - 1; i += 2, ++j) {", + " cn_fast_hash(ints[i], 2 * HASH_SIZE, ints[j]);", + " }", + " }", + "}", + "", + "void tree_hash_from_branch(const char (*branch)[HASH_SIZE], size_t depth, const char *leaf, const void *path, char *root_hash) {", + " if (depth == 0) {", + " memcpy(root_hash, leaf, HASH_SIZE);", + " } else {", + " char buffer[2][HASH_SIZE];", + " int from_leaf = 1;", + " char *leaf_path, *branch_path;", + " while (depth > 0) {", + " --depth;", + " if (path && (((const char *) path)[depth >> 3] & (1 << (depth & 7))) != 0) {", + " leaf_path = buffer[1];", + " branch_path = buffer[0];", + " } else {", + " leaf_path = buffer[0];", + " branch_path = buffer[1];", + " }", + " if (from_leaf) {", + " memcpy(leaf_path, leaf, HASH_SIZE);", + " from_leaf = 0;", + " } else {", + " cn_fast_hash(buffer, 2 * HASH_SIZE, leaf_path);", + " }", + " memcpy(branch_path, branch[depth], HASH_SIZE);", + " }", + " cn_fast_hash(buffer, 2 * HASH_SIZE, root_hash);", + " }", + "}", + "" + ] + } + } + ] + }, + { + "path": "/src/cryptonote_basic/cryptonote_format_utils.h", + "changes": [ + { + "action": "add_above", + "marker": "bool add_extra_nonce_to_tx_extra(std::vector& tx_extra, const blobdata& extra_nonce);", + "parameters": { + "text": [ + "bool add_merge_mining_tag_to_tx_extra(std::vector& tx_extra, const tx_extra_merge_mining_tag& mm_tag);", + "bool get_merge_mining_tag_to_tx_extra(std::vector& tx_extra, const tx_extra_merge_mining_tag& mm_tag);" + ] + } + } + ] + }, + { + "path": "/src/cryptonote_basic/cryptonote_format_utils.cpp", + "changes": [ + { + "action": "add_above", + "marker": "bool add_extra_nonce_to_tx_extra(std::vector& tx_extra, const blobdata& extra_nonce)", + "parameters": { + "text": [ + "bool add_merge_mining_tag_to_tx_extra(std::vector& tx_extra, const tx_extra_merge_mining_tag& mm_tag) {", + " const uint8_t* mm_tag_ptr = reinterpret_cast(&mm_tag);", + "", + " tx_extra.push_back(TX_EXTRA_MERGE_MINING_TAG);", + " std::copy(mm_tag_ptr, mm_tag_ptr + sizeof(mm_tag), std::back_inserter(tx_extra));", + " return true;", + "}", + "", + "bool get_merge_mining_tag_to_tx_extra(const std::vector& tx_extra, tx_extra_merge_mining_tag& mm_tag) {", + " std::vector tx_extra_fields;", + " parse_tx_extra(tx_extra, tx_extra_fields);", + "", + " return find_tx_extra_field_by_type(tx_extra_fields, mm_tag);", + "}", + "" + ] + } + } + ] + }, + + { + "path": "/src/cryptonote_basic/cryptonote_boost_serialization.h", + "changes": [ + { + "action": "add_above", + "marker": "#include ", + "parameters": { + "text": [ + "//remove", + " #include " + ] + } + }, + { + "action": "add_above", + "marker": "a & b.major_version;", + "parameters": { + "text": [ + "std::ostream &gout00 = std::cout << \"REALLY HERE: \" << std::endl;" + ] + } + }, + { + "action": "add_above", + "marker": "a & b.miner_tx;", + "parameters": { + "text": [ + "std::ostream &gout01 = std::cout << \"REALLY HERE 2: \" << std::endl;" + ] + } + } + ] + }, + + + { + "path": "/src/cryptonote_basic/cryptonote_basic.h", + "changes": [ + { + "action": "add_above", + "marker": "#include ", + "parameters": { + "text": [ + "//remove", + " #include ", + "#include " + ] + } + }, + { + "action": "add_below", + "marker": "#include \"cryptonote_config.h\"", + "parameters": { + "text": [ + "#include \"cryptonote_basic/cryptonote_format_utils.h\"" + ] + } + }, + { + "action": "replace", + "marker": "block(): block_header(), hash_valid(false) {}", + "parameters": { + "text": [ + "block(): block_header(), parent_block(), hash_valid(false), is_input(true) {}" + ] + } + }, + { + "action": "replace", + "marker": "block(const block &b): block_header(b), hash_valid(false), miner_tx(b.miner_tx), tx_hashes(b.tx_hashes) { if (b.is_hash_valid()) { hash = b.hash; set_hash_valid(true); } }", + "parameters": { + "text": [ + " block(const block &b): block_header(b), hash_valid(false), is_input(false), parent_block(b.parent_block), miner_tx(b.miner_tx), tx_hashes(b.tx_hashes) { if (b.is_hash_valid()) { hash = b.hash; set_hash_valid(true); } }" + ] + } + }, + { + "action": "add_above", + "marker": "struct block_header", + "parameters": { + "text": [ + "struct parent_block", + "{", + " uint8_t major_version;", + " uint8_t minor_version;", + " crypto::hash previous_block_hash;", + " uint16_t transaction_count;", + " std::vector base_transaction_branch;", + " transaction_prefix base_transaction; //base transaction", + " std::vector blockchain_branch;", + "};", + "", + "struct parent_block_serializer {", + " parent_block_serializer(parent_block& _parent_block, uint64_t& _timestamp, uint32_t& _nonce, bool _hashing_serialization, bool _header_only, bool _is_input) :", + " parent_block(_parent_block), timestamp(_timestamp), nonce(_nonce), hashing_serialization(_hashing_serialization), header_only(_header_only, is_input(_is_input)) { }", + "", + " parent_block& parent_block;", + " uint64_t& timestamp;", + " uint32_t& nonce;", + " bool hashing_serialization;", + " bool header_only;", + " bool is_input;", + "", + + + " BEGIN_SERIALIZE()", + " VARINT_FIELD(parent_block.major_version)", + " VARINT_FIELD(parent_block.minor_version)", + " VARINT_FIELD(timestamp)", + " FIELD(parent_block.previous_block_hash)", + " FIELD(nonce)", + + + " if (hashing_serialization) {", + " crypto::hash minerTxHash;", + " if (!get_transaction_hash(parent_block.base_transaction, minerTxHash)) {", + "// throw std::runtime_error(\"Get transaction hash error\");", + " }", + + " crypto::hash merkleRoot;", + " crypto::tree_hash_from_branch(parent_block.base_transaction_branch.data(), parent_block.base_transaction_branch.size(), minerTxHash, 0, merkleRoot);", + " FIELD(merkleRoot)", + " }", + " uint64_t txNum = static_cast(parent_block.transaction_count);", + " VARINT_FIELD(txNum)", + " parent_block.transaction_count = static_cast(txNum);", + " if (parent_block.transaction_count < 1) {", + "// throw std::runtime_error(\"Wrong transactions number\");", + " }", + "", + " if (header_only) {", + " return;", + " }", + "", + " size_t branchSize = crypto::tree_depth(parent_block.transaction_count);", + "// if (serializer.type() == ISerializer::OUTPUT) {", + " if (is_input) {", + " if (parent_block.base_transaction_branch.size() != branchSize) {", + "// throw std::runtime_error(\"Wrong miner transaction branch size\");", + " }", + " } else {", + " parent_block.base_transaction_branch.resize(branchSize);", + " }", + "", + "// serializer(parent_block.base_transaction_branch, \"baseTransactionBranch\");", + " //TODO: Make arrays with computable size! This code won't work with json serialization!", + " for (crypto::hash& hash: parent_block.base_transaction_branch) {", + " FIELD(hash)", + " }", + " FIELD(parent_block.base_transaction)", + "", + " tx_extra_merge_mining_tag mm_tag;", + " if (!get_merge_mining_tag_to_tx_extra(parent_block.base_transaction.extra, mm_tag)) {", + " throw std::runtime_error(\"Can't get extra merge mining tag\");", + " }", + "", + " if (mm_tag.depth > 8 * sizeof(crypto::hash)) {", + " throw std::runtime_error(\"Wrong merge mining tag depth\");", + " }", + "", + "// if (serializer.type() == ISerializer::OUTPUT) {", + " if (is_input) {", + " if (mm_tag.depth != parent_block.base_transaction_branch.size()) {", + " throw std::runtime_error(\"Blockchain branch size must be equal to merge mining tag depth\");", + " }", + " } else {", + " parent_block.base_transaction_branch.resize(mm_tag.depth);", + " }", + "", + "// serializer(parent_block.base_transaction_branch, \"blockchainBranch\");", + " //TODO: Make arrays with computable size! This code won't work with json serialization!", + " for (crypto::hash& hash: parent_block.base_transaction_branch) {", + " FIELD(hash)", + " }", + " END_SERIALIZE()", + "};", + "" + ] + } + }, + { + "action": "add_above", + "marker": "transaction miner_tx;", + "parameters": { + "text": [ + " parent_block parent_block;" + ] + } + }, + { + "action": "add_above", + "marker": "FIELD(miner_tx)", + "parameters": { + "text": [ + "if (major_version >= 2 && BYTECOIN_CLONE == 1) {", + + "std::ostream &gout21 = std::cout << \"major_version: \" << std::to_string(major_version) << std::endl;", + "std::ostream &gout22 = std::cout << \"minor_version: \" << std::to_string(minor_version) << std::endl;", + + + " parent_block_serializer parent_block_serializer = {parent_block, timestamp, nonce, false, false, is_input};", + + "std::ostream &gout11 = std::cout << \"parent_block.major_version: \" << std::to_string(parent_block.major_version) << std::endl;", + "std::ostream &gout12 = std::cout << \"parent_block.minor_version: \" << std::to_string(parent_block.minor_version) << std::endl;", + + "std::ostream &gout01 = std::cout << \"parentBlock.major_version: \" << std::to_string(parent_block_serializer.parent_block.major_version) << std::endl;", + "std::ostream &gout02 = std::cout << \"parentBlock.minor_version: \" << std::to_string(parent_block_serializer.parent_block.minor_version) << std::endl;", + "std::ostream &gout03 = std::cout << \"parentBlock.transaction_count: \" << std::to_string(parent_block_serializer.parent_block.transaction_count) << std::endl;", + "std::ostream &gout1 = std::cout << \"timestamp: \" << parent_block_serializer.timestamp << std::endl;", + "std::ostream &gout2 = std::cout << \"nonce: \" << parent_block_serializer.nonce << std::endl;", + + "struct parent_block_serializer* strucPtr=&parent_block_serializer;", + "unsigned char* charPtr=(unsigned char*)strucPtr;", + "int i;", + "printf(\"structure size : %zu bytes\\n\",sizeof(struct parent_block_serializer));", + "for(i=0;iget_ideal_version();", + "parameters": { + "text": [ + "std::cout << \"BYTECOIN_CLONE: \" << BYTECOIN_CLONE << std::endl;", + "std::cout << \"b.major_version: \" << b.major_version << std::endl;", + "if (b.major_version == 1 && BYTECOIN_CLONE == 1) {", + " // check upgrade height to populate correct minor version", + "} else if (b.major_version >= 2 && BYTECOIN_CLONE == 1) {", + " // check upgrade height to populate correct minor version", + "", + " b.parent_block.major_version = 1;", + " b.parent_block.minor_version = 0;", + " b.parent_block.transaction_count = 1;", + + "std::ostream &gout01 = std::cout << \"b.parent_block.major_version: \" << std::to_string(b.parent_block.major_version) << std::endl;", + "std::ostream &gout02 = std::cout << \"b.parent_block.minor_version: \" << std::to_string(b.parent_block.minor_version) << std::endl;", + + "", + " tx_extra_merge_mining_tag mm_tag = boost::value_initialized();", + " if (!add_merge_mining_tag_to_tx_extra(b.parent_block.base_transaction.extra, mm_tag)) {", + " LOG_ERROR(\"Failed to append merge mining tag to extra of the parent block miner transaction\");", + " return false;", + " }", + "}", + "" + ] + } + } + ] + }, + + { + "path": "/src/cryptonote_basic/cryptonote_basic.h", + "multiline": true, + "changes": [ + { + "action": "replace", + "marker": "(struct block: public block_header)[^@]+(mutable std::atomic hash_valid;)", + "parameters": { + "text": [ + " struct block: public block_header", + " {", + " private:", + " // hash cash", + " mutable std::atomic hash_valid;", + " mutable std::atomic is_input;", + " " + ] + } + } + ] + }, + + { + "path": "/src/cryptonote_basic/cryptonote_basic.h", + "multiline": true, + "changes": [ + { + "action": "replace", + "marker": " (VARINT_FIELD\\(major_version\\))[^@]+(FIELD\\(nonce\\))", + "parameters": { + "text": [ + " VARINT_FIELD(major_version)", + " if (BYTECOIN_CLONE == 1 && major_version > 3) {", + " throw std::runtime_error(\"Wrong major version\");", + " }", + " VARINT_FIELD(minor_version)", + " if (BYTECOIN_CLONE == 0 || (BYTECOIN_CLONE == 1&& major_version == 1)) {", + " VARINT_FIELD(timestamp)", + " FIELD(prev_id)", + " FIELD(nonce)", + " } else if (major_version >= 2) {", + " FIELD(prev_id)", + " } else {", + " throw std::runtime_error(\"Wrong major version\");", + " }" + ] + } + } + ] + } + ] +} diff --git a/extensions/core/monero.json b/extensions/core/monero.json index 73b782a..83c419f 100644 --- a/extensions/core/monero.json +++ b/extensions/core/monero.json @@ -156,6 +156,28 @@ "var": "TESTNET_GENESIS_TX" } }, + { + "action": "replace", + "marker": "uint32_t const GENESIS_NONCE = 10000;", + "parameters": { + "mandatory": false, + "text": [ + " uint32_t const GENESIS_NONCE = %s;" + ], + "var": "MAINNET_GENESIS_NONCE" + } + }, + { + "action": "replace", + "marker": " uint32_t const GENESIS_NONCE = 10001;", + "parameters": { + "mandatory": false, + "text": [ + " uint32_t const GENESIS_NONCE = %s;" + ], + "var": "TESTNET_GENESIS_NONCE" + } + }, { "action": "replace", "marker": "#define MONEY_SUPPLY", @@ -189,8 +211,6 @@ "var": "FINAL_SUBSIDY_PER_MINUTE" } }, - - { "action": "replace", "marker": "#define DIFFICULTY_TARGET_V2", @@ -213,8 +233,6 @@ "var": "DIFFICULTY_TARGET_V1" } }, - - { "action": "replace", "marker": "#define DIFFICULTY_WINDOW", @@ -248,7 +266,6 @@ "var": "DIFFICULTY_LAG" } }, - { "action": "replace", "marker": "#define CRYPTONOTE_DISPLAY_DECIMAL_POINT", @@ -281,6 +298,72 @@ ], "var": "DEFAULT_DUST_THRESHOLD" } + }, + { + "action": "replace", + "marker": "#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2 60000", + "parameters": { + "mandatory": false, + "text": [ + "#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2 %s" + ], + "var": "CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2" + } + }, + { + "action": "replace", + "marker": "#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 20000", + "parameters": { + "mandatory": false, + "text": [ + "#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 %s" + ], + "var": "CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1" + } + }, + { + "action": "replace", + "marker": "#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5 300000", + "parameters": { + "mandatory": false, + "text": [ + "#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5 %s" + ], + "var": "CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5" + } + }, + { + "action": "replace", + "marker": "#define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW 60", + "parameters": { + "mandatory": false, + "text": [ + "#define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW %s" + ], + "var": "CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW" + } + }, + { + "action": "replace", + "marker": "#define CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE 10", + "parameters": { + "mandatory": false, + "text": [ + "#define CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE %s" + ], + "var": "CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE" + } + }, + { + "action": "replace", + "marker": "#define EMISSION_SPEED_FACTOR_PER_MINUTE (20)", + "parameters": { + "mandatory": false, + "text": [ + "#define EMISSION_SPEED_FACTOR_PER_MINUTE (%s)" + ], + "var": "EMISSION_SPEED_FACTOR_PER_MINUTE" + } } ] }, @@ -381,6 +464,8 @@ } ] }, + + { "path": "/src/cryptonote_basic/cryptonote_basic_impl.cpp", "changes": [