added Carrot support to construct_protocol_tx

This commit is contained in:
Some Random Crypto Guy
2025-05-21 12:25:01 +01:00
parent 4ee14df3c6
commit 33535531ec
8 changed files with 69 additions and 7 deletions

View File

@@ -357,16 +357,18 @@ bool try_load_carrot_from_transaction_v1(const cryptonote::transaction &tx,
//-------------------------------------------------------------------------------------------------------------------
cryptonote::transaction store_carrot_to_coinbase_transaction_v1(
const std::vector<CarrotCoinbaseEnoteV1> &enotes,
const cryptonote::blobdata &extra_nonce)
const cryptonote::blobdata &extra_nonce,
const cryptonote::transaction_type &tx_type)
{
CARROT_CHECK_AND_THROW(tx_type == cryptonote::transaction_type::MINER || tx_type == cryptonote::transaction_type::PROTOCOL, invalid_tx_type, "invalid tx_type : is not MINER or PROTOCOL");
const size_t nouts = enotes.size();
const std::uint64_t block_index = enotes.at(0).block_index;
cryptonote::transaction tx;
tx.type = cryptonote::transaction_type::MINER;
tx.type = tx_type;
tx.pruned = false;
tx.version = 2;
tx.unlock_time = block_index + CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW;
tx.unlock_time = CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW;
tx.vin.reserve(1);
tx.vout.reserve(nouts);
tx.extra.reserve(MAX_TX_EXTRA_SIZE);
@@ -423,7 +425,7 @@ cryptonote::transaction make_single_enote_carrot_coinbase_transaction_v1(const C
std::vector<CarrotCoinbaseEnoteV1> enotes(1);
get_coinbase_output_proposal_v1(payment_proposal, block_index, enotes.front());
return store_carrot_to_coinbase_transaction_v1(enotes, extra_nonce);
return store_carrot_to_coinbase_transaction_v1(enotes, extra_nonce, cryptonote::transaction_type::MINER);
}
//-------------------------------------------------------------------------------------------------------------------
bool try_load_carrot_coinbase_enote_from_transaction_v1(const cryptonote::transaction &tx,