aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjeffro256 <jeffro256@tutanota.com>2024-12-16 15:16:34 -0600
committerjeffro256 <jeffro256@tutanota.com>2024-12-16 15:23:27 -0600
commit41c4bc45578a36806a81b9ae13e91ce1183eba86 (patch)
tree54268fe6fbd81681e70f6faf880a7f2ae466ee71 /src
parent58a1d54a4f90a235616ede3f8ebae2b8dca41589 (diff)
downloadmonzero-core-41c4bc45578a36806a81b9ae13e91ce1183eba86.tar.gz
monzero-core-41c4bc45578a36806a81b9ae13e91ce1183eba86.tar.xz
monzero-core-41c4bc45578a36806a81b9ae13e91ce1183eba86.zip
Blockchain: get height of RingCT fork programmatically
Get height of the RingCT fork to start the output distributuon programmatically, instead of using a hardcoded index. If using a hardcoded index, when the hardfork tables are modified, this can cause segmentation faults or horrific privacy issues: https://codeberg.org/wownero/wownero/issues/488#issuecomment-2514880.
Diffstat (limited to 'src')
-rw-r--r--src/cryptonote_core/blockchain.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index ca63d36a7..e8e35c84a 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -2363,17 +2363,8 @@ void Blockchain::get_output_key_mask_unlocked(const uint64_t& amount, const uint
bool Blockchain::get_output_distribution(uint64_t amount, uint64_t from_height, uint64_t to_height, uint64_t &start_height, std::vector<uint64_t> &distribution, uint64_t &base) const
{
// rct outputs don't exist before v4
- if (amount == 0)
- {
- switch (m_nettype)
- {
- case STAGENET: start_height = stagenet_hard_forks[3].height; break;
- case TESTNET: start_height = testnet_hard_forks[3].height; break;
- case MAINNET: start_height = mainnet_hard_forks[3].height; break;
- case FAKECHAIN: start_height = 0; break;
- default: return false;
- }
- }
+ if (amount == 0 && m_nettype != network_type::FAKECHAIN)
+ start_height = m_hardfork->get_earliest_ideal_height_for_version(HF_VERSION_DYNAMIC_FEE);
else
start_height = 0;
base = 0;