Skip to content

Commit 41c4bc4

Browse files
committed
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.
1 parent 58a1d54 commit 41c4bc4

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/cryptonote_core/blockchain.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2363,17 +2363,8 @@ void Blockchain::get_output_key_mask_unlocked(const uint64_t& amount, const uint
23632363
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
23642364
{
23652365
// rct outputs don't exist before v4
2366-
if (amount == 0)
2367-
{
2368-
switch (m_nettype)
2369-
{
2370-
case STAGENET: start_height = stagenet_hard_forks[3].height; break;
2371-
case TESTNET: start_height = testnet_hard_forks[3].height; break;
2372-
case MAINNET: start_height = mainnet_hard_forks[3].height; break;
2373-
case FAKECHAIN: start_height = 0; break;
2374-
default: return false;
2375-
}
2376-
}
2366+
if (amount == 0 && m_nettype != network_type::FAKECHAIN)
2367+
start_height = m_hardfork->get_earliest_ideal_height_for_version(HF_VERSION_DYNAMIC_FEE);
23772368
else
23782369
start_height = 0;
23792370
base = 0;

0 commit comments

Comments
 (0)