diff --git a/src/cryptonote_basic/cryptonote_basic.h b/src/cryptonote_basic/cryptonote_basic.h index 8ef9de2..75d1d14 100644 --- a/src/cryptonote_basic/cryptonote_basic.h +++ b/src/cryptonote_basic/cryptonote_basic.h @@ -447,8 +447,11 @@ namespace cryptonote // SALVIUM-SPECIFIC FIELDS // TX type cryptonote::salvium_transaction_type tx_type; - // 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 return_address_list; + //return_address_change_mask + std::vector return_address_change_mask; // Return TX public key crypto::public_key return_pubkey; // Source asset type @@ -737,8 +740,13 @@ namespace cryptonote if (tx_type != cryptonote::salvium_transaction_type::PROTOCOL) { VARINT_FIELD(amount_burnt) if (tx_type != cryptonote::salvium_transaction_type::MINER) { - FIELD(return_address) - FIELD(return_pubkey) + if (type == cryptonote::transaction_type::TRANSFER && version >= TRANSACTION_VERSION_N_OUTS) { + FIELD(return_address_list) + FIELD(return_address_change_mask) + } else { + FIELD(return_address) + FIELD(return_pubkey) + } FIELD(source_asset_type) FIELD(destination_asset_type) VARINT_FIELD(amount_slippage_limit) @@ -915,6 +923,15 @@ namespace cryptonote amount_minted = 0; output_unlock_times.clear(); collateral_indices.clear(); + // SAL + tx_type = cryptonote::transaction_type::UNSET; + return_address = crypto::null_pkey; + return_address_list.clear(); + return_address_change_mask.clear(); + return_pubkey = crypto::null_pkey; + source_asset_type.clear(); + destination_asset_type.clear(); + amount_slippage_limit = 0; } inline diff --git a/src/cryptonote_basic/cryptonote_format_utils.cpp b/src/cryptonote_basic/cryptonote_format_utils.cpp index c403909..457d78a 100644 --- a/src/cryptonote_basic/cryptonote_format_utils.cpp +++ b/src/cryptonote_basic/cryptonote_format_utils.cpp @@ -287,7 +287,11 @@ namespace cryptonote } crypto::hash tree_root_hash = get_tx_tree_hash(b); blob.append(reinterpret_cast(&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)); + } if (b.blob_type == BLOB_TYPE_CRYPTONOTE3) { blob.append(reinterpret_cast(&b.uncle), sizeof(b.uncle)); } diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 5a88aa5..8627430 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -8,6 +8,8 @@ #define HF_VERSION_XASSET_FEES_V2 17 #define HF_VERSION_HAVEN2 18 #define HF_VERSION_USE_COLLATERAL 20 +#define HF_VERSION_ENABLE_N_OUTS 2 +#define TRANSACTION_VERSION_N_OUTS 3 // UNLOCK TIMES #define TX_V6_OFFSHORE_UNLOCK_BLOCKS 21*720 // 21 day unlock time