From 6889321361818571ab3211715462c9893360d8e1 Mon Sep 17 00:00:00 2001 From: Some Random Crypto Guy Date: Tue, 11 Feb 2025 12:18:08 +0000 Subject: [PATCH] fixed possible throw() when dust in index=0; bumped version number --- README.md | 10 +++++----- src/cryptonote_core/blockchain.cpp | 4 +++- src/hardforks/hardforks.cpp | 8 +++++++- src/simplewallet/simplewallet.cpp | 22 ++++++++++++++++------ src/version.cpp.in | 2 +- 5 files changed, 32 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index ad6f46d..5f08cfc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Salvium Zero v0.9.1 +# Salvium Zero v0.9.2 Copyright (c) 2023-2024, Salvium Portions Copyright (c) 2014-2023, The Monero Project @@ -172,7 +172,7 @@ invokes cmake commands as needed. ```bash cd salvium - git checkout v0.9.1 + git checkout v0.9.2 make ``` @@ -251,7 +251,7 @@ Tested on a Raspberry Pi Zero with a clean install of minimal Raspbian Stretch ( ```bash git clone https://github.com/salvium/salvium cd salvium - git checkout v0.9.1 + git checkout v0.9.2 ``` * Build: @@ -370,10 +370,10 @@ application. 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.9.1'. 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.9.2'. If you don't care about the version and just want binaries from master, skip this step: ```bash - git checkout v0.9.1 + git checkout v0.9.2 ``` * If you are on a 64-bit system, run: diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index f37af72..0ac6922 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -4514,7 +4514,9 @@ bool Blockchain::calculate_audit_payouts(const uint64_t start_height, std::vecto } // Build a blacklist of staking TXs _not_ to pay out for - const std::set txs_blacklist = {}; + const std::set txs_blacklist = { + "017a79539e69ce16e91d9aa2267c102f336678c41636567c1129e3e72149499a" + }; // Get the ABI information for the 21,600 blocks that the matured TX(s), we can calculate audit for (const auto& entry: audit_entries) { diff --git a/src/hardforks/hardforks.cpp b/src/hardforks/hardforks.cpp index c4cb93f..9a5d3b2 100644 --- a/src/hardforks/hardforks.cpp +++ b/src/hardforks/hardforks.cpp @@ -49,6 +49,9 @@ const hardfork_t mainnet_hard_forks[] = { // version 6 starts from block 154750, which is on or around the 4th of February, 2025. Fork time finalised on 2025-01-31. No fork voting occurs for the v6 fork. { 6, 154750, 0, 1738336000 }, + + // version 7 starts from block 161900, which is on or around the 14th of February, 2025. Fork time finalised on 2025-02-04. No fork voting occurs for the v7 fork. + { 7, 161900, 0, 1739264400 }, }; const size_t num_mainnet_hard_forks = sizeof(mainnet_hard_forks) / sizeof(mainnet_hard_forks[0]); const uint64_t mainnet_hard_fork_version_1_till = ((uint64_t)-1); @@ -69,8 +72,11 @@ const hardfork_t testnet_hard_forks[] = { // version 5 (TX shutdown) starts from block 800 { 5, 800, 0, 1734607005 }, - // version 6 (audit) starts from block 815 + // version 6 (audit 1) starts from block 815 { 6, 815, 0, 1734608000 }, + + // version 7 (audit 1 pause) starts from block 900 + { 7, 900, 0, 1739264400 }, }; const size_t num_testnet_hard_forks = sizeof(testnet_hard_forks) / sizeof(testnet_hard_forks[0]); const uint64_t testnet_hard_fork_version_1_till = ((uint64_t)-1); diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 56cb394..38c5879 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -6981,12 +6981,22 @@ bool simple_wallet::transfer_main( // Skip this wallet if there is no balance unlocked to audit if (unlocked_balance_per_subaddr.count(subaddr_index) == 0) continue; - - std::set subaddr_indices_single; - subaddr_indices_single.insert(subaddr_index); - uint64_t unlock_block = get_config(m_wallet->nettype()).AUDIT_LOCK_PERIOD; - std::vector ptx_vector_audit = m_wallet->create_transactions_all(0, cryptonote::transaction_type::AUDIT, source_asset, m_wallet->get_subaddress({m_current_subaddress_account, subaddr_index}), (subaddr_index>0), 1, fake_outs_count, unlock_block, priority, extra, m_current_subaddress_account, subaddr_indices_single); - ptx_vector.insert(ptx_vector.end(), ptx_vector_audit.begin(), ptx_vector_audit.end()); + + try { + + std::set subaddr_indices_single; + subaddr_indices_single.insert(subaddr_index); + uint64_t unlock_block = get_config(m_wallet->nettype()).AUDIT_LOCK_PERIOD; + std::vector ptx_vector_audit = m_wallet->create_transactions_all(0, cryptonote::transaction_type::AUDIT, source_asset, m_wallet->get_subaddress({m_current_subaddress_account, subaddr_index}), (subaddr_index>0), 1, fake_outs_count, unlock_block, priority, extra, m_current_subaddress_account, subaddr_indices_single); + ptx_vector.insert(ptx_vector.end(), ptx_vector_audit.begin(), ptx_vector_audit.end()); + + } catch (const std::exception &e) { + + // Let's skip this wallet - we have already reported the error + if (unlocked_balance_per_subaddr[subaddr_index].first < 250000000) { + fail_msg_writer() << boost::format(tr("Subaddress index %u has insufficient funds (%s) to pay for audit")) % subaddr_index % print_money(unlocked_balance_per_subaddr[subaddr_index].first); + } + } } } else { diff --git a/src/version.cpp.in b/src/version.cpp.in index bfd9dc5..88aa1d6 100644 --- a/src/version.cpp.in +++ b/src/version.cpp.in @@ -1,5 +1,5 @@ #define DEF_SALVIUM_VERSION_TAG "@VERSIONTAG@" -#define DEF_SALVIUM_VERSION "0.9.1" +#define DEF_SALVIUM_VERSION "0.9.2" #define DEF_MONERO_VERSION_TAG "release" #define DEF_MONERO_VERSION "0.18.3.3" #define DEF_MONERO_RELEASE_NAME "Zero"