fixed edge case where returning pre-HF2 transfer using HF2 CLI wallet _before_ HF2; bumped version
This commit is contained in:
10
README.md
10
README.md
@@ -1,4 +1,4 @@
|
|||||||
# Salvium Zero v0.6.2
|
# Salvium Zero v0.6.3
|
||||||
|
|
||||||
Copyright (c) 2023-2024, Salvium
|
Copyright (c) 2023-2024, Salvium
|
||||||
Portions Copyright (c) 2014-2023, The Monero Project
|
Portions Copyright (c) 2014-2023, The Monero Project
|
||||||
@@ -172,7 +172,7 @@ invokes cmake commands as needed.
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd salvium
|
cd salvium
|
||||||
git checkout v0.6.2
|
git checkout v0.6.3
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -251,7 +251,7 @@ Tested on a Raspberry Pi Zero with a clean install of minimal Raspbian Stretch (
|
|||||||
```bash
|
```bash
|
||||||
git clone https://github.com/salvium/salvium
|
git clone https://github.com/salvium/salvium
|
||||||
cd salvium
|
cd salvium
|
||||||
git checkout v0.6.2
|
git checkout v0.6.3
|
||||||
```
|
```
|
||||||
|
|
||||||
* Build:
|
* Build:
|
||||||
@@ -370,10 +370,10 @@ application.
|
|||||||
cd salvium
|
cd salvium
|
||||||
```
|
```
|
||||||
|
|
||||||
* If you would like a specific [version/tag](https://github.com/salvium/salvium/tags), do a git checkout for that version. eg. 'v0.6.2'. If you don't care about the version and just want binaries from master, skip this step:
|
* If you would like a specific [version/tag](https://github.com/salvium/salvium/tags), do a git checkout for that version. eg. 'v0.6.3'. If you don't care about the version and just want binaries from master, skip this step:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git checkout v0.6.2
|
git checkout v0.6.3
|
||||||
```
|
```
|
||||||
|
|
||||||
* If you are on a 64-bit system, run:
|
* If you are on a 64-bit system, run:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#define DEF_SALVIUM_VERSION_TAG "@VERSIONTAG@"
|
#define DEF_SALVIUM_VERSION_TAG "@VERSIONTAG@"
|
||||||
#define DEF_SALVIUM_VERSION "0.6.2"
|
#define DEF_SALVIUM_VERSION "0.6.3"
|
||||||
#define DEF_MONERO_VERSION_TAG "release"
|
#define DEF_MONERO_VERSION_TAG "release"
|
||||||
#define DEF_MONERO_VERSION "0.18.3.3"
|
#define DEF_MONERO_VERSION "0.18.3.3"
|
||||||
#define DEF_MONERO_RELEASE_NAME "Zero"
|
#define DEF_MONERO_RELEASE_NAME "Zero"
|
||||||
|
|||||||
@@ -11363,8 +11363,8 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_return(std::vector
|
|||||||
crypto::public_key P_change = crypto::null_pkey;
|
crypto::public_key P_change = crypto::null_pkey;
|
||||||
uint8_t change_index;
|
uint8_t change_index;
|
||||||
uint32_t hf_version = get_current_hard_fork();
|
uint32_t hf_version = get_current_hard_fork();
|
||||||
if (hf_version >= HF_VERSION_ENABLE_N_OUTS && td_origin.m_tx.version >= TRANSACTION_VERSION_N_OUTS) {
|
if (td_origin.m_tx.version >= TRANSACTION_VERSION_N_OUTS) {
|
||||||
|
|
||||||
// Calculate z_i (the shared secret between sender and ourselves for the original TX)
|
// Calculate z_i (the shared secret between sender and ourselves for the original TX)
|
||||||
crypto::public_key txkey_pub = null_pkey; // R
|
crypto::public_key txkey_pub = null_pkey; // R
|
||||||
const std::vector<crypto::public_key> in_additional_tx_pub_keys = get_additional_tx_pub_keys_from_extra(td_origin.m_tx);
|
const std::vector<crypto::public_key> in_additional_tx_pub_keys = get_additional_tx_pub_keys_from_extra(td_origin.m_tx);
|
||||||
@@ -11392,21 +11392,43 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_return(std::vector
|
|||||||
std::strncpy(buf.domain_separator, "RETURN", 7);
|
std::strncpy(buf.domain_separator, "RETURN", 7);
|
||||||
buf.amount_key = rct::sk2rct(z_i);
|
buf.amount_key = rct::sk2rct(z_i);
|
||||||
crypto::hash_to_scalar(&buf, sizeof(buf), y);
|
crypto::hash_to_scalar(&buf, sizeof(buf), y);
|
||||||
|
|
||||||
// The change_index needs decoding too
|
// The change_index needs decoding too
|
||||||
uint8_t eci_data = td_origin.m_tx.return_address_change_mask[td_origin.m_internal_output_index];
|
uint8_t eci_data = td_origin.m_tx.return_address_change_mask[td_origin.m_internal_output_index];
|
||||||
|
|
||||||
// Calculate the encrypted_change_index data for this output
|
// Calculate the encrypted_change_index data for this output
|
||||||
std::memset(buf.domain_separator, 0x0, sizeof(buf.domain_separator));
|
std::memset(buf.domain_separator, 0x0, sizeof(buf.domain_separator));
|
||||||
std::strncpy(buf.domain_separator, "CHG_IDX", 8);
|
std::strncpy(buf.domain_separator, "CHG_IDX", 8);
|
||||||
crypto::secret_key eci_out;
|
crypto::secret_key eci_out;
|
||||||
keccak((uint8_t *)&buf, sizeof(buf), (uint8_t*)&eci_out, sizeof(eci_out));
|
keccak((uint8_t *)&buf, sizeof(buf), (uint8_t*)&eci_out, sizeof(eci_out));
|
||||||
change_index = eci_data ^ eci_out.data[0];
|
change_index = eci_data ^ eci_out.data[0];
|
||||||
|
|
||||||
return_address = td_origin.m_tx.return_address_list[td_origin.m_internal_output_index];
|
return_address = td_origin.m_tx.return_address_list[td_origin.m_internal_output_index];
|
||||||
|
|
||||||
} else {
|
// Sanity check that we aren't attempting to return our own TX change output to ourselves
|
||||||
|
THROW_WALLET_EXCEPTION_IF(change_index == td_origin.m_internal_output_index, error::wallet_internal_error, tr("Attempting to return change to ourself"));
|
||||||
|
|
||||||
|
// Sanity check that we can obtain the change output from the origin TX
|
||||||
|
THROW_WALLET_EXCEPTION_IF(!cryptonote::get_output_public_key(td_origin.m_tx.vout[change_index], P_change),
|
||||||
|
error::wallet_internal_error,
|
||||||
|
tr("Failed to identify change output"));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Change index is the one we didn't receive
|
||||||
|
change_index = (td_origin.m_internal_output_index == 0) ? 1 : 0;
|
||||||
|
|
||||||
|
// Return address was provided
|
||||||
|
return_address = td_origin.m_tx.return_address;
|
||||||
|
|
||||||
|
// Sanity check that we aren't attempting to return our own TX change output to ourselves
|
||||||
|
THROW_WALLET_EXCEPTION_IF(change_index == td_origin.m_internal_output_index, error::wallet_internal_error, tr("Attempting to return change to ourself"));
|
||||||
|
|
||||||
|
// Sanity check that we can obtain the change output from the origin TX
|
||||||
|
THROW_WALLET_EXCEPTION_IF(!cryptonote::get_output_public_key(td_origin.m_tx.vout[change_index], P_change),
|
||||||
|
error::wallet_internal_error,
|
||||||
|
tr("Failed to identify change output"));
|
||||||
|
|
||||||
// Calculate y
|
// Calculate y
|
||||||
struct {
|
struct {
|
||||||
char domain_separator[8];
|
char domain_separator[8];
|
||||||
@@ -11416,21 +11438,8 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_return(std::vector
|
|||||||
std::strncpy(buf.domain_separator, "RETURN", 6);
|
std::strncpy(buf.domain_separator, "RETURN", 6);
|
||||||
buf.pubkey = P_change;
|
buf.pubkey = P_change;
|
||||||
crypto::hash_to_scalar(&buf, sizeof(buf), y);
|
crypto::hash_to_scalar(&buf, sizeof(buf), y);
|
||||||
|
|
||||||
// Change index is the one we didn't receive
|
|
||||||
change_index = (td_origin.m_internal_output_index == 0) ? 1 : 0;
|
|
||||||
|
|
||||||
return_address = td_origin.m_tx.return_address;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanity check that we aren't attempting to return our own TX change output to ourselves
|
|
||||||
THROW_WALLET_EXCEPTION_IF(change_index == td_origin.m_internal_output_index, error::wallet_internal_error, tr("Attempting to return change to ourself"));
|
|
||||||
|
|
||||||
// Sanity check that we can obtain the change output from the origin TX
|
|
||||||
THROW_WALLET_EXCEPTION_IF(!cryptonote::get_output_public_key(td_origin.m_tx.vout[change_index], P_change),
|
|
||||||
error::wallet_internal_error,
|
|
||||||
tr("Failed to identify change output"));
|
|
||||||
|
|
||||||
// Calculate yF
|
// Calculate yF
|
||||||
rct::key key_y = (rct::key&)(y);
|
rct::key key_y = (rct::key&)(y);
|
||||||
rct::key key_F = (rct::key&)(return_address);
|
rct::key key_F = (rct::key&)(return_address);
|
||||||
|
|||||||
Reference in New Issue
Block a user