Skip to content

Commit

Permalink
Updated for Salvium v0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MoneroOcean committed Oct 23, 2024
1 parent 01ed146 commit 655f79b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
23 changes: 20 additions & 3 deletions src/cryptonote_basic/cryptonote_basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<crypto::public_key> return_address_list;
//return_address_change_mask
std::vector<uint8_t> return_address_change_mask;
// Return TX public key
crypto::public_key return_pubkey;
// Source asset type
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/cryptonote_basic/cryptonote_format_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,11 @@ namespace cryptonote
}
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(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<const char*>(&b.uncle), sizeof(b.uncle));
}
Expand Down
2 changes: 2 additions & 0 deletions src/cryptonote_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 655f79b

Please sign in to comment.