| 827 | ******************************************************************************/ |
| 828 | |
| 829 | void OutputGroup::Insert(const std::shared_ptr<COutput>& output, size_t ancestors, size_t cluster_count) { |
| 830 | m_outputs.push_back(output); |
| 831 | auto& coin = *m_outputs.back(); |
| 832 | |
| 833 | fee += coin.GetFee(); |
| 834 | |
| 835 | coin.long_term_fee = coin.input_bytes < 0 ? 0 : m_long_term_feerate.GetFee(coin.input_bytes); |
| 836 | long_term_fee += coin.long_term_fee; |
| 837 | |
| 838 | effective_value += coin.GetEffectiveValue(); |
| 839 | |
| 840 | m_from_me &= coin.from_me; |
| 841 | m_value += coin.txout.nValue; |
| 842 | m_depth = std::min(m_depth, coin.depth); |
| 843 | // ancestors here express the number of ancestors the new coin will end up having, which is |
| 844 | // the sum, rather than the max; this will overestimate in the cases where multiple inputs |
| 845 | // have common ancestors |
| 846 | m_ancestors += ancestors; |
| 847 | // This is the maximum cluster count among all outputs. If these outputs are from distinct clusters but spent in the |
| 848 | // same transaction, their clusters will be merged, potentially exceeding the mempool's max cluster count. |
| 849 | m_max_cluster_count = std::max(m_max_cluster_count, cluster_count); |
| 850 | |
| 851 | if (output->input_bytes > 0) { |
| 852 | m_weight += output->input_bytes * WITNESS_SCALE_FACTOR; |
| 853 | } |
| 854 | } |
| 855 | |
| 856 | bool OutputGroup::EligibleForSpending(const CoinEligibilityFilter& eligibility_filter) const |
| 857 | { |