updated to support N-out-TX operation of Salvium v0.6.x

This commit is contained in:
Some Random Crypto Guy
2024-10-31 11:23:46 +00:00
parent 7e4f6adb2b
commit c971c9846b
3 changed files with 19 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
#pragma once #pragma once
#define CURRENT_TRANSACTION_VERSION 2 #define CURRENT_TRANSACTION_VERSION 2
#define HF_VERSION_ENABLE_N_OUTS 2
#define PRICING_RECORD_VALID_TIME_DIFF_FROM_BLOCK 120 // seconds #define PRICING_RECORD_VALID_TIME_DIFF_FROM_BLOCK 120 // seconds

View File

@@ -200,6 +200,10 @@ namespace cryptonote
cryptonote::salvium_transaction_type type; cryptonote::salvium_transaction_type type;
// Return address // Return address
crypto::public_key return_address; crypto::public_key return_address;
// Return address list (must be at least 1 and at most BULLETPROOF_MAX_OUTPUTS-1 - the "-1" is for the change output)
std::vector<crypto::public_key> return_address_list;
//return_address_change_mask
std::vector<uint8_t> return_address_change_mask;
// Return TX public key // Return TX public key
crypto::public_key return_pubkey; crypto::public_key return_pubkey;
// Source asset type // Source asset type
@@ -222,8 +226,13 @@ namespace cryptonote
if (type != cryptonote::salvium_transaction_type::PROTOCOL) { if (type != cryptonote::salvium_transaction_type::PROTOCOL) {
VARINT_FIELD(amount_burnt) VARINT_FIELD(amount_burnt)
if (type != cryptonote::salvium_transaction_type::MINER) { if (type != cryptonote::salvium_transaction_type::MINER) {
FIELD(return_address) if (type == cryptonote::transaction_type::TRANSFER && version >= TRANSACTION_VERSION_N_OUTS) {
FIELD(return_pubkey) FIELD(return_address_list)
FIELD(return_address_change_mask)
} else {
FIELD(return_address)
FIELD(return_pubkey)
}
FIELD(source_asset_type) FIELD(source_asset_type)
FIELD(destination_asset_type) FIELD(destination_asset_type)
VARINT_FIELD(amount_slippage_limit) VARINT_FIELD(amount_slippage_limit)
@@ -332,6 +341,8 @@ namespace cryptonote
// Salvium-specific fields // Salvium-specific fields
type = cryptonote::salvium_transaction_type::UNSET; type = cryptonote::salvium_transaction_type::UNSET;
return_address = null_pkey; return_address = null_pkey;
return_address_list.clear();
return_address_change_mask.clear();
return_pubkey = null_pkey; return_pubkey = null_pkey;
source_asset_type.clear(); source_asset_type.clear();
destination_asset_type.clear(); destination_asset_type.clear();

View File

@@ -264,7 +264,11 @@ namespace cryptonote
blob = t_serializable_object_to_blob(static_cast<const block_header&>(b)); blob = t_serializable_object_to_blob(static_cast<const block_header&>(b));
crypto::hash tree_root_hash = get_tx_tree_hash(b); crypto::hash tree_root_hash = get_tx_tree_hash(b);
blob.append(reinterpret_cast<const char*>(&tree_root_hash), sizeof(tree_root_hash)); blob.append(reinterpret_cast<const char*>(&tree_root_hash), sizeof(tree_root_hash));
blob.append(tools::get_varint_data(b.tx_hashes.size()+1)); if (b.blob_type == BLOB_TYPE_CRYPTONOTE_SALVIUM) {
blob.append(tools::get_varint_data(b.tx_hashes.size() + (b.major_version >= HF_VERSION_ENABLE_N_OUTS ? 2 : 1)));
} else {
blob.append(tools::get_varint_data(b.tx_hashes.size() + 1));
}
return true; return true;
} }
//--------------------------------------------------------------- //---------------------------------------------------------------