Skip to content

Commit

Permalink
release: change name, stagenet: checkpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
hayzamjs committed Aug 7, 2023
1 parent 830704c commit 8f7b77e
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 53 deletions.
13 changes: 13 additions & 0 deletions src/checkpoints/checkpoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,20 @@ bool checkpoints::init_default_checkpoints(network_type nettype) {
if (nettype == TESTNET) {
return true;
}

if (nettype == STAGENET) {
ADD_CHECKPOINT2(
10, "4d8fe186fab1be886342954824efef811585442191cb3338e8c70ee7b29cad96",
"0x25");
ADD_CHECKPOINT2(
100, "331cc0c4e1a4acbc734e636452758af9577aac898edc8f38cf3d1b479cfe27ad",
"0x4f224");
ADD_CHECKPOINT2(
150, "c0ff612f107eda2dd6139bb7914a0956db5c02a76552728a6eb8ba1ef0a197ff",
"0x9e566");
ADD_CHECKPOINT2(
200, "eff30fe3ea097a7ead70bd4a70c2fa0ed52a8a37c49c1679250feb7a0a5ad511",
"0x19e868");
return true;
}

Expand Down
14 changes: 7 additions & 7 deletions src/cryptonote_basic/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ const command_line::arg_descriptor<std::string> arg_spendkey = {

miner::miner(i_miner_handler *phandler, const get_block_hash_t &gbh)
: m_stop(1), m_template{}, m_template_no(0), m_diffic(0), m_thread_index(0),
m_phandler(phandler), m_gbh(gbh), m_height(0), m_last_mined(0), m_threads_active(0),
m_pausers_count(0), m_threads_total(0), m_starter_nonce(0),
m_last_hr_merge_time(0), m_hashes(0), m_total_hashes(0),
m_do_print_hashrate(false), m_do_mining(false), m_current_hash_rate(0),
m_is_background_mining_enabled(false),
m_phandler(phandler), m_gbh(gbh), m_height(0), m_last_mined(0),
m_threads_active(0), m_pausers_count(0), m_threads_total(0),
m_starter_nonce(0), m_last_hr_merge_time(0), m_hashes(0),
m_total_hashes(0), m_do_print_hashrate(false), m_do_mining(false),
m_current_hash_rate(0), m_is_background_mining_enabled(false),
m_min_idle_seconds(
BACKGROUND_MINING_DEFAULT_MIN_IDLE_INTERVAL_IN_SECONDS),
m_idle_threshold(BACKGROUND_MINING_DEFAULT_IDLE_THRESHOLD_PERCENTAGE),
Expand Down Expand Up @@ -619,8 +619,8 @@ bool miner::worker_thread() {
continue;
}

if(m_last_mined == height) {
continue;
if (m_last_mined == height) {
continue;
}

b.nonce = nonce;
Expand Down
59 changes: 30 additions & 29 deletions src/cryptonote_core/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1450,47 +1450,48 @@ bool Blockchain::validate_diardi_miner_v2(const block &b) {
std::string vM;
cryptonote::address_parse_info pVm;

for (auto const &sM : diardi_miners_list) {
public_key pubKey;

for(auto const& sM : diardi_miners_list) {
public_key pubKey;

if(!get_output_public_key(b.miner_tx.vout.back(), pubKey)) {
LOG_PRINT_L1("Diardi: Failed to get miner public key");
return false;
}
if (!get_output_public_key(b.miner_tx.vout.back(), pubKey)) {
LOG_PRINT_L1("Diardi: Failed to get miner public key");
return false;
}

if(validate_diardi_reward_key(block_height, sM, b.miner_tx.vout.size() - 1, pubKey, m_nettype)) {
vM = sM;
cryptonote::get_account_address_from_str(pVm, m_nettype, vM);
break;
}
if (validate_diardi_reward_key(block_height, sM, b.miner_tx.vout.size() - 1,
pubKey, m_nettype)) {
vM = sM;
cryptonote::get_account_address_from_str(pVm, m_nettype, vM);
break;
}
}

if (vM.empty()) {
return true;
return true;
}

crypto::hash sig_data = get_sig_data(block_height);
crypto::signature signature = b.signature;

if (!crypto::check_signature(sig_data, pVm.address.m_spend_public_key, signature)) {
LOG_PRINT_L1("Diardi: Miner signature incorrect");
return false;
if (!crypto::check_signature(sig_data, pVm.address.m_spend_public_key,
signature)) {
LOG_PRINT_L1("Diardi: Miner signature incorrect");
return false;
}

cryptonote::block oDb;
bool oOb = false;
bool getOldBlock = get_block_by_hash(
m_db->get_block_hash_from_height((block_height - 4)), oDb, &oOb);
m_db->get_block_hash_from_height((block_height - 4)), oDb, &oOb);

if (!getOldBlock) {
LOG_PRINT_L1("Diardi: Could not get old block");
return false;
LOG_PRINT_L1("Diardi: Could not get old block");
return false;
}

if (check_last_diardi_miner(this, vM, m_nettype)) {
LOG_PRINT_L1("Diardi: Miner already mined a block < 4 blocks ago");
return false;
LOG_PRINT_L1("Diardi: Miner already mined a block < 4 blocks ago");
return false;
}

return true;
Expand Down Expand Up @@ -1583,7 +1584,8 @@ bool Blockchain::validate_miner_transaction(
}

if (m_nettype == cryptonote::MAINNET) {
//txout_to_key instead of txout_to_tagged_key because we don't have view tags before version 15
// txout_to_key instead of txout_to_tagged_key because we don't have
// view tags before version 15
if (!validate_diardi_reward_key(
block_height, diardi_maintainer_address,
b.miner_tx.vout.size() - 1,
Expand All @@ -1603,16 +1605,15 @@ bool Blockchain::validate_miner_transaction(
cryptonote::address_parse_info diardi_miner_address;

public_key pubKey;
if(!get_output_public_key(b.miner_tx.vout.back(), pubKey)) {
LOG_PRINT_L1("Diardi: Failed to get miner public key");
return false;
if (!get_output_public_key(b.miner_tx.vout.back(), pubKey)) {
LOG_PRINT_L1("Diardi: Failed to get miner public key");
return false;
}

for (auto const &sM : diardi_miners_list) {
if (validate_diardi_reward_key(
m_db->height(), sM, b.miner_tx.vout.size() - 1,
pubKey,
m_nettype)) {
if (validate_diardi_reward_key(m_db->height(), sM,
b.miner_tx.vout.size() - 1, pubKey,
m_nettype)) {
vM = sM;
break;
}
Expand Down
30 changes: 14 additions & 16 deletions src/cryptonote_core/cryptonote_tx_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,17 +449,17 @@ bool construct_miner_tx(size_t height, size_t median_weight,
uint64_t amount = out_amounts[no];
summary_amounts += out.amount = out_amounts[no];

if(hard_fork_version < 15) {
txout_to_key tk;
tk.key = out_eph_public_key;
out.target = tk;
if (hard_fork_version < 15) {
txout_to_key tk;
tk.key = out_eph_public_key;
out.target = tk;
} else {
txout_to_tagged_key tk;
crypto::view_tag view_tag;
crypto::derive_view_tag(derivation, no, view_tag);
tk.key = out_eph_public_key;
cryptonote::set_tx_out(amount, out_eph_public_key, true, view_tag, out);
out.target = tk;
txout_to_tagged_key tk;
crypto::view_tag view_tag;
crypto::derive_view_tag(derivation, no, view_tag);
tk.key = out_eph_public_key;
cryptonote::set_tx_out(amount, out_eph_public_key, true, view_tag, out);
out.target = tk;
}

tx.vout.push_back(out);
Expand Down Expand Up @@ -1131,15 +1131,13 @@ bool check_last_diardi_miner(const Blockchain *pbc, std::string wallet_address,
}

public_key pubKey;
if(!get_output_public_key(last_diardi_block.miner_tx.vout.back(), pubKey)) {
if (!get_output_public_key(last_diardi_block.miner_tx.vout.back(), pubKey)) {
return false;
}

if (validate_diardi_reward_key(
last_diardi_height, wallet_address,
last_diardi_block.miner_tx.vout.size() - 1,
pubKey,
nettype)) {
if (validate_diardi_reward_key(last_diardi_height, wallet_address,
last_diardi_block.miner_tx.vout.size() - 1,
pubKey, nettype)) {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/version.cpp.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define DEF_scala_VERSION_TAG "@VERSIONTAG@"
#define DEF_scala_VERSION "8.0.0"
#define DEF_scala_RELEASE_NAME "Panthera Tigris"
#define DEF_scala_RELEASE_NAME "Menger"
#define DEF_scala_VERSION_FULL DEF_scala_VERSION "-" DEF_scala_VERSION_TAG
#define DEF_scala_VERSION_IS_RELEASE @VERSION_IS_RELEASE@

Expand Down

0 comments on commit 8f7b77e

Please sign in to comment.