diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp index 60799ccc7..fdf1e37e2 100644 --- a/src/cryptonote_core/cryptonote_tx_utils.cpp +++ b/src/cryptonote_core/cryptonote_tx_utils.cpp @@ -351,9 +351,22 @@ namespace cryptonote bool noncarrot_found = false; tx.type = cryptonote::transaction_type::PROTOCOL; - const bool force_carrot = hard_fork_version >= HF_VERSION_ENFORCE_CARROT; - if (force_carrot) + // Scan the protocol_data to make sure all or none are Carrot + for (auto const& entry: protocol_data) { + if (entry.is_carrot) carrot_found = true; + else noncarrot_found = true; + } + + if (carrot_found && noncarrot_found) { + LOG_ERROR("Cannot mix Carrot and non-Carrot outputs in the same protocol transaction"); + return false; + } + + if (carrot_found || hard_fork_version >= HF_VERSION_ENFORCE_CARROT) { + + // Ensure the TX version is correct + tx.version = TRANSACTION_VERSION_CARROT; try { // Create a vector of enotes @@ -373,7 +386,6 @@ namespace cryptonote memcpy(e.enote_ephemeral_pubkey.data, entry.return_pubkey.data, sizeof(crypto::public_key)); enotes.push_back(e); } - carrot_found = true; tx = store_carrot_to_coinbase_transaction_v1(enotes, std::string{}, cryptonote::transaction_type::PROTOCOL, height); tx.amount_burnt = 0; tx.invalidate_hashes(); @@ -412,14 +424,12 @@ namespace cryptonote additional_tx_public_keys.push_back(entry.return_pubkey); tx.vout.push_back(out); - carrot_found = true; } else { // Create the TX output for this refund tx_out out; cryptonote::set_tx_out(entry.amount_burnt, entry.destination_asset, CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW, entry.return_address, false, crypto::view_tag{}, out); additional_tx_public_keys.push_back(entry.return_pubkey); tx.vout.push_back(out); - noncarrot_found = true; } } else if (entry.type == cryptonote::transaction_type::AUDIT) { // PAYOUT @@ -430,19 +440,9 @@ namespace cryptonote cryptonote::set_tx_out(entry.amount_burnt, entry.destination_asset, CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW, entry.return_address, false, crypto::view_tag{}, out); additional_tx_public_keys.push_back(entry.return_pubkey); tx.vout.push_back(out); - noncarrot_found = true; } } - if (carrot_found && noncarrot_found) { - LOG_ERROR("Cannot mix Carrot and non-Carrot outputs in the same protocol transaction"); - return false; - } - if (carrot_found) { - // Ensure the TX version is correct - tx.version = TRANSACTION_VERSION_CARROT; - } - // Add in all of the additional TX pubkeys we need to process the payments add_additional_tx_pub_keys_to_extra(tx.extra, additional_tx_public_keys); diff --git a/src/version.cpp.in b/src/version.cpp.in index 829bcfd7a..e471011fc 100644 --- a/src/version.cpp.in +++ b/src/version.cpp.in @@ -1,5 +1,5 @@ #define DEF_SALVIUM_VERSION_TAG "@VERSIONTAG@" -#define DEF_SALVIUM_VERSION "1.0.0-rc3" +#define DEF_SALVIUM_VERSION "1.0.0-rc4" #define DEF_MONERO_VERSION_TAG "release" #define DEF_MONERO_VERSION "0.18.3.4" #define DEF_MONERO_RELEASE_NAME "One"