diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index b17431e3f..5817d3b4c 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -6338,29 +6338,25 @@ namespace // their ordering, but it could become more murky if we add scores later. float wallet2::get_output_relatedness(const transfer_details &td0, const transfer_details &td1) const { - int dh; + const int64_t dh = td0.m_block_height > td1.m_block_height ? td0.m_block_height - td1.m_block_height : td1.m_block_height - td0.m_block_height; - // expensive test, and same tx will fall onto the same block height below - if (td0.m_txid == td1.m_txid) - return 1.0f; + // don't think these are particularly related + if (dh >= 10) + return 0.0f; - // same block height -> possibly tx burst, or same tx (since above is disabled) - dh = td0.m_block_height > td1.m_block_height ? td0.m_block_height - td1.m_block_height : td1.m_block_height - td0.m_block_height; - if (dh == 0) - return 0.9f; + // similar block heights + if (dh > 1) + return 0.2f; // adjacent blocks -> possibly tx burst if (dh == 1) return 0.8f; - // could extract the payment id, and compare them, but this is a bit expensive too + // expensive test, and same tx will fall onto the same block height below + if (td0.m_txid == td1.m_txid) + return 1.0f; - // similar block heights - if (dh < 10) - return 0.2f; - - // don't think these are particularly related - return 0.0f; + return 0.9f; } //---------------------------------------------------------------------------------------------------- size_t wallet2::pop_best_value_from(const transfer_container &transfers, std::vector &unused_indices, const std::vector& selected_transfers, bool smallest) const