mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-29 18:53:14 +00:00
simplewallet: fix output representation offset
This commit is contained in:
parent
35e0a968bd
commit
588e670089
2 changed files with 3 additions and 3 deletions
|
@ -5579,7 +5579,7 @@ bool simple_wallet::print_ring_members(const std::vector<tools::wallet2::pending
|
|||
if (j == source.real_output)
|
||||
highlight_height = heights[j];
|
||||
}
|
||||
std::pair<std::string, std::string> ring_str = show_outputs_line(heights, highlight_height);
|
||||
std::pair<std::string, std::string> ring_str = show_outputs_line(heights, blockchain_height, highlight_height);
|
||||
ostr << ring_str.first << tr("\n|") << ring_str.second << tr("|\n");
|
||||
}
|
||||
// warn if rings contain keys originating from the same tx or temporally very close block heights
|
||||
|
|
|
@ -964,13 +964,13 @@ gamma_picker::gamma_picker(const std::vector<uint64_t> &rct_offsets, double shap
|
|||
gamma = std::gamma_distribution<double>(shape, scale);
|
||||
THROW_WALLET_EXCEPTION_IF(rct_offsets.size() <= CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE, error::wallet_internal_error, "Bad offset calculation");
|
||||
const size_t blocks_in_a_year = 86400 * 365 / DIFFICULTY_TARGET_V2;
|
||||
const size_t blocks_to_consider = rct_offsets.size() < blocks_in_a_year;
|
||||
const size_t blocks_to_consider = std::min<size_t>(rct_offsets.size(), blocks_in_a_year);
|
||||
const size_t outputs_to_consider = rct_offsets.back() - (blocks_to_consider < rct_offsets.size() ? rct_offsets[rct_offsets.size() - blocks_to_consider - 1] : 0);
|
||||
begin = rct_offsets.data();
|
||||
end = rct_offsets.data() + rct_offsets.size() - CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE;
|
||||
num_rct_outputs = *(end - 1);
|
||||
THROW_WALLET_EXCEPTION_IF(num_rct_outputs == 0, error::wallet_internal_error, "No rct outputs");
|
||||
average_output_time = DIFFICULTY_TARGET_V2 * rct_offsets.size() / num_rct_outputs; // this assumes constant target over the whole rct range
|
||||
average_output_time = DIFFICULTY_TARGET_V2 * blocks_to_consider / outputs_to_consider; // this assumes constant target over the whole rct range
|
||||
};
|
||||
|
||||
gamma_picker::gamma_picker(const std::vector<uint64_t> &rct_offsets): gamma_picker(rct_offsets, GAMMA_SHAPE, GAMMA_SCALE) {}
|
||||
|
|
Loading…
Reference in a new issue